Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!UOTTAWA.BITNET!451061 From: 451061@UOTTAWA.BITNET (Valentin Pepelea) Newsgroups: comp.sys.amiga.tech Subject: Re: UnLoadSeg() Message-ID: <8907032258.AA16367@jade.berkeley.edu> Date: 3 Jul 89 22:53:08 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 51 Francois Rouaix in message <1364@inria.inria.fr> writes > I have a doubt on the possibility that UnLoadSeg() might > Wait() somewhere. Does anybody knows for sure ? There is no reason why UnLoadSeg would want to call Wait(). > A program detaches itself from CLI (ya know, hacking the > SegList), runs, and at the end, unloads itself with UnLoadSeg(). > The very end of the code (ASM) looks like > > callsys Forbid > * setup UnLoadSeg > callsys UnLoadSeg > moveq.l 0,d0 > rts What happened to "callsys Permit"? Jette dans l'oubliette? > And occasionally, I get a Guru (4)... No wonder. "Merde alors!" Eh? > The only explanation I have yet is that UnLoadSeg() waits, > memory freed is reallocated, the last two lines get trashed, and boom. > Am I wrong ? I think there is a logic mistake here. Does UnLoadSeg() also remove the task associated with it? If so, then the Forbid() is immediately obsoleted, the memory associated with the task gets freed, but somehow you still insist running code within a task that does not exist anymore. I am surprised your code runs some of the time, it should fail instantly every time. > I could think of replacing the JSR to UnLoadSeg by a JMP, therefore > using the RTS of the routine, but since this bug appears quite randomly, > I'd like to be certain of its reason. Perhaps you should UnLoadSeg only other segments, never your-self. > Thanx for any help > --Francois For what it's worth... Valentin _________________________________________________________________________ "An operating system without Name: Valentin Pepelea virtual memory is an operating Phonet: (613) 231-7476 (New!) system without virtue." Bitnet: 451061@Uottawa.bitnet Usenet: Use cunyvm.cuny.edu gate - Ancient Inca Proverb Planet: 451061@acadvm1.UOttawa.CA