Re: [PATCH] 2.1.131: i386 tweak to switch_to()

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Fri, 18 Dec 1998 15:08:45 +0000


On Wed, Dec 16, 1998 at 02:26:47AM +0100, ralf@uni-koblenz.de wrote:
> > What is "cc" and why we need to declare "memory" clobbered after using
> > __switch_to()?
>
> The scheduler is running on the current thread's kernel stack but the
> current pointer is being changed in switch_to(). So any values gcc might
> have stored on the stack will now have to be refetched from memory
> as schedule() might otherwise continue with stale values.

I'm not sure this is true.

The stack slots hold temporaries which are spilled from registers and
local variables, which may be held in registers temporarily. But the
clobbers and constraints invalidate all the registers (except EBP which
is saved), so everything that has a stack slot will be stored there
before the switch, and restored afterwards as required.

I put "memory" in the clobber list because, well, memory might change :-)

-- Jamie

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