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: Qustion about Overflow and Underflow in Sparc?


Hi :
 Thanks for your help. Is that means during context switching the whole
register windows (8) will be saved to the old thread stack and the register
windows will be loaded with the new thread stack content? If not the whole
register windows how can it tells which thread does the previous register
window belongs to? For example:

Thread1 --- Thread1_Stack[ ]
has: Thread1_fun1() calls --> Thread1_fun2() --> Thread1_fun3() -->
Thread1_fun4() --> Thread1_fun5() returns


Thread2 --- Thread1_Stack[ ]
has: Thread2_fun1() calls --> Thread2_fun2() --> Thread2_fun3() -->
Thread2_fun4() --> Thread2_fun5() --> Thread2_fun6() returns


program excuting as:

Thread1_fun1() (uses: reg win #7) --> Thread1_fun2() (uses: reg win #6) -->
**Context Switch here**  "Question: Do we need to save reg win #1 and #2 to
Thread1_Stack[ ]??" --> Thread2_fun1() (Question: uses which reg win
here?) --> Thread2_fun2() (Question: uses which reg win here?) -->
Thread2_fun3() (Question: uses which reg win here?) --> **Context Switch
here** "Question : Do we need to save reg win #? #? #? to
Thread2_Stack[ ]??" --> "Question: Is here to restore the whole reg wins(reg
win #1 and #2)  (from Thread1_Stack[ ]) of Thread1??"

Thanks a lot

Regards!

qiang



-----Original Message-----
From: Nick Garnett [mailto:nickg@ecoscentric.com]
Sent: 12 August 2002 15:53
To: Qiang Huang
Cc: Ecos-Discuss (E-mail)
Subject: Re: [ECOS] Qustion about Overflow and Underflow in Sparc?


"Qiang Huang" <jameshq@liverpool.ac.uk> writes:

> Hi all:
>    I just looked at the code for handling the under/over-flow in sparc in
> ecos. A stack is growing while making function call, but why I can't find
> the code saving the whole register windows (not only one) when underflow
> happens? If for two threads how the register windows is used? while
> switching context should the whole reg win(8 win) be saved to the thread
> stack(so this will cause delay)? or other way? Thanks a lot
>

I am no expert on the SPARC code, so the following is only my best
recollection.

The SPARC code handles overflow and underflow on a window-by-window
basis for each thread. When a thread switch happens, then the entire
set for the outgoing thread is saved. Windows are then loaded on an
as-need basis for the incoming thread.

This approach keeps the costs of window handling deterministic, and
avoids the more complex issues of dealing with windows that belong to
threads other than the current one.

--
Nick Garnett - eCos Kernel Architect
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]