🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #12944

Re: Use of SuperState() call

#12944
From: Valentin Pepelea
Date: Thu, 01 Jun 1989 02:53
44 lines
2143 bytes
Mark Huth <mph@behemoth.phx.mcd.mot.com> writes in
Message-ID: <10975@behemoth.phx.mcd.mot.com>

> start:
>     movem.l d0-d7/a0-a6,-(a7)    save regs
>     movea.l AbsExecBase.w,a6    sets exec lib base register
>     callsys SuperState        get into supervisor mode
>     moveq.l #CacheOff,d1        constant to disable cache
>     movec   d1,cacr            write it to the cache control reg
>     callsys UserState
>     movem.l (a7)+,d0-d7/a0-a6
>     rts
>
> ...it's always off to the guru.
> Is there a secret that I'm missing?

The SuperState() & UserState() combo does not work. Use Supervisor() instead:

      movem.l a5,-(sp)
      movea.l ExecBase,a6
      lea.l   1$,a5
      CALLSYS Supervisor
      movem.l (sp)+,a5
      rts
1$
      moveq.l #CacheOff,d1
      move    d1,cacr
      rte

I've written replacement routines for SuperState() & UserState() which I use
in my code. They'll get published eventually. By the way, these two routines
are useful only with compilers which allocate variables on the stack. Lattice
C uses the LINK instruction to reserve space on the stack, and then references
that space through a5, so you do not need the two above routines, just use
Supervisor() instead. Remeber to always inspect the code produced by compilers
if you use assembler stubs with them.

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
Technical Details
Message-ID: <8906010307.AA11892@jade.berkeley.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!UOTTAWA.BITNET!451061

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: Use of SuperState() call
Message-ID: <8906010307.AA11892@jade.berkeley.edu>
Date: 1 Jun 89 02:53:16 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 44