[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] what's wrong with this code?



Le Mon, 15 Aug 2005 20:52:21 +0100
<jan.thomas@bt.com> a écrit:

> -----Original Message-----
> From: mint-bounce@lists.fishpool.fi on behalf of Johan Klockars
> Sent: Mon 15/08/2005 19:50
> To: Mint list
> Subject: Re: [MiNT] what's wrong with this code?
> 
> <SNIP>
> 
> >There are physically separate registers for the various stack
> >pointers,  which just get "remapped" in hardware depending on the
> >bits in SR.
> 
> Question.
> 
> When you normally write the following...
> 
>         move.w D0,-(SP)   (or A7)
> 
> You write this instead...
> 
>         move.w D0,-(SSP)    or
>   
>         move.w D0,-(USP)
> 
> What happens when the CPU is in super or user mode?

ssp and usp are used through A7. Just look at generated assembler code.
The only difference is the 'move from usp' privileged instruction, used
for example in most system traps to read parameters on user stack, from supervisor mode:

my_xbios_trap:
	lea	sp@(8),a0	; start of stacked parameters if trap #14 from supervisor mode
	btst	#5,sp@			; check S bit in stacked SR
	bnes	supervisor_mode
	movl	usp,a0			; read user stack pointer if trap #14 from user mode
supervisor_mode:
	movew	a0@,d0		; read xbios function number

	[etc]

	rte

-- 
Patrice Mandin
WWW: http://membres.lycos.fr/pmandin/
Programmeur Linux, Atari
Spécialité: Développement, jeux