This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Why Just even registers get saved during registerwindowsunder/over flow in Sparc? Thanks. last question


Thanks a lot , but can I ask the Last question. Thanks

Is this process flow right?

Save --> decrement the register window and compare with the %wim -->
over_flow happens --> "__entry_wover" as below
But it seems just save one single register windows not the whole 8 register
windows? Or maybe I went someway wrong.
Where is jmpl %l1, %g0 branch to? (back to the traped routine?) Thanks a
lot!

__entry_wover:
	mov	%g1, %l3		! Save g1, we use it to hold the wim
	srl	%l0, 1, %g1		! Rotate wim right
	sll	%l0, __WINSIZE-1, %l0
	or	%l0, %g1, %g1

	save				! Slip into next window
	mov	%g1, %wim		! Install the new wim
					! (invalidates current window!)

	std	%l0, [%sp + 0 * 4]	! save L & I registers
	std	%l2, [%sp + 2 * 4]
	std	%l4, [%sp + 4 * 4]
	std	%l6, [%sp + 6 * 4]

	std	%i0, [%sp + 8 * 4]
	std	%i2, [%sp + 10 * 4]
	std	%i4, [%sp + 12 * 4]
	std	%i6, [%sp + 14 * 4]

	restore				! Go back to trap window.
	mov	%l3, %g1		! Restore %g1

	jmpl	%l1,  %g0
	rett	%l2



-----Original Message-----
From: Gary Thomas [mailto:gthomas@ecoscentric.com]
Sent: 13 August 2002 15:07
To: Qiang Huang
Cc: Ecos-Discuss (E-mail)
Subject: RE: [ECOS] Why Just even registers get saved during
registerwindowsunder/over flow in Sparc? Thanks.


On Tue, 2002-08-13 at 07:59, Qiang Huang wrote:
> Thanks for your reply. Do you mean the whole register windows (8 windows)
> will all be saved to stack while a context switching happens?  Why I just
> can't find the code does such job in the context.S --
> "hal_thread_switch_context:"  in the save part it seems it just save a
> single register window rather than the whole 8(or less) register windows?
> Also in the "hal_thread_load_context" it just load a single register
window
> from stack rather than 8(or less) register windows. Or am I going in the
> wrong way? Thanks a lot!
>

Actually, what happens is that when the new context is being "loaded",
it causes all of the windows for the previous thread to fault (overflow)
and be saved.  It's all kind of magic, but it works.

> Best regards!
>
>
> -----Original Message-----
> From: Gary Thomas [mailto:gthomas@ecoscentric.com]
> Sent: 13 August 2002 14:15
> To: Qiang Huang
> Cc: Ecos-Discuss (E-mail)
> Subject: Re: [ECOS] Why Just even registers get saved during
> registerwindows under/over flow in Sparc? Thanks.
>
>
> On Tue, 2002-08-13 at 06:24, Qiang Huang wrote:
> > Hi all:
> >    In the overflow/underflow handler in Sparc why just a single register
> > window(Isn't that all the register windows get saved to stack?) get
saved
> > and why just even register get saved? Thanks a lot.
>
> A Nick indicated yesterday, the entire window set is saved
> when a thread switch occurs.  Other than that, it makes sense
> to only bother with a single window when an under/overflow
> happens.
>
> As for "even registers only"; look more closely.  The registers
> are being saved as even/odd register pairs.  For example, the
> instruction (std %l0,[%sp+0]) saves registers %l0 and %l1 in
> a single instruction.  Much faster.
>
> --
> ------------------------------------------------------------
> Gary Thomas                  |
> eCosCentric, Ltd.            |
> +1 (970) 229-1963            |  eCos & RedBoot experts
> gthomas@ecoscentric.com      |
> http://www.ecoscentric.com/  |
> ------------------------------------------------------------
>
>
> --
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
--
------------------------------------------------------------
Gary Thomas                  |
eCosCentric, Ltd.            |
+1 (970) 229-1963            |  eCos & RedBoot experts
gthomas@ecoscentric.com      |
http://www.ecoscentric.com/  |
------------------------------------------------------------


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]