lkml.org 
[lkml]   [2001]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: switch_to()/doesnt %esp get replaced with %ebp on ret
Parity Error wrote:
> I dont know if you understood my doubt, but your pointer
> to bp accidentally or otherwise solved the mystery.

We agree, and I like your explanation.

> Still, could some one enlighten me on why esi and edi are
> also similarly saved and restored ?

The compiler _may_ cache other values in those registers across the call
to switch_to. Although this doesn't happen in your kernel, it does
sometimes happen and switch_to must be coded to assume that it does.

You can safely remove the esi & edi pushes and pops, if you put those
registers in the "clobber" list of the asm. In theory that's best,
because then the compiler will save the register values itself only if
it needs to.

In practice, putting them in the clobber list sometimes results in worse
code, at least when I tried this in the 2.2 series.

You can't put ebp in the clobber list for some reason: GCC silently
ignores it. (Maybe that's fixed now too, I don't know).

-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:29    [W:0.076 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site