[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Is the %ESP register special?



Using assembler in debian on an intel platform.

Is the %ESP register special in any way (except, of course,
ist use in the POP and PUSH istructions and their friends.)

Let me clarify.

On VMS (old VAX OS), the convnetion was that any data on the stack
above the stacp poibter was forfeit -- at any time tod OS could
come in and clobber it, even *during* instruction execution.
Firthermore, the value of the stack pointer clued in the OS as to whether
it chould create new pages to handle a page-fault exception, thereby
extending the stack.

As a result, if you used the stack pointer for anything other than
pointing to the top of the stack, even momentarily,  you were in deep,
deep trouble.

Are there simlar OS constraints imposed by the Linux kernel?  How do
pages get allocated to the stack, for example.  Is the user's %ESP
used in any way for this?  Can I make any use of %ESP that I want?
For example, can I allocate a lot of mini-stacks in garbage-collected
storage to handle, say, a coroutine system, without interference?
(And yes, it's a compressing garbage-collector. The stacks will
move around every time garbage-collection occurs.)

-- hendrik



Reply to: