lin-club  

[Haifux] Saving registers during context switch

Erez Hadad
Sat, 29 Mar 2003 05:15:52 -0800

Hi all,

I may be missing a point here, but I'm a bit confused
about how registers are saved during the context switch, 
in Linux 2.5.X:
As I understand, since conext_switch() is defined as a
function (although inline), it has callee-caller relationship
with schedule(), meaning schedule() expects the registers
ebx, ebp, esi and edi to be left unchanged by context_switch().
However, the switch_to macro invoked by context_switch()
saves and restores only ebp, edi and edi (NOT ebx). This 
makes it possible that the code of schedule() after the 
call to context_switch() may rely on a value of ebx from
before the call to context_switch(), yielding unexpected
results.

Can anyone explain this, please?

Thanks, 
Erez Hadad

--------------------------------------------------------------------------
Haifa Linux Club Mailing List (http://www.haifux.org)
To unsub send an empty message to [EMAIL PROTECTED]