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: second post SOS pls. Context switching and loading problem.? for sparc target. Thanks


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

> I have asked such simliar question but seems nobody answer me, maybe because
> of my poor english, so I check the question I post before and revise them as
> much as I can and write it down as the following. And hope this time I can
> make it as clear as I can make and maybe any expert can help me a little
> bit. Thank you very much.
> (I do believe I still have many unclear english explainings in the following
> sentence, but may I appologize for that. thank you.)

There are two reasons why you may not be getting many answers. First,
there are very few sparc experts here. Both Gary and I have answered
the questions we can, but neither of us had anything to do with the
original port -- and all we are doing is reading the code and telling
you what it says. Second, your questions are mostly answerable by
reference to the sparc architecture and ABI manuals, they have often
little to do with eCos specifically.


> 
> Q1.
> While loading a thread(from very beginning hal_thread_load_context in
> context.S ) why need to save the whole register windows set (8 register
> windows) before loading the thread's context but the %sp is not saved
> anywhere? Isn't the part should be in the hal_thread_switch_context (the
> first part before entering into hal_thread_load_context)??
>

The %sp value is written to [%o1] -- its the second instruction in
hal_thread_switch_context.

> 
> Q2.  When switching from a current thread to a new thread why just one
> register window(the last register window) got restored from the stack? How
> about the rest register windows (upper register windows)?  if the last
> register is 4, how about the register windows 8,7,6,5? no need restore?? but
> if return from callee to caller the register window is not the one expected?
> 

We rely on the standard register window save/restore mechanism to do
this. There is no need to load any more than the first window. The
window we restore is that for the caller, the hal_thread_* routines do
not have windows of their own.

I strongly suggest that you read some sparc architecture and ABI
manuals. Everything we do in the sparc HAL is standard stuff explained
there. 

-- 
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]