Can't use stack below ESP.

From: Les Pawelczyk (les_at_pixelpointpos_dot_com)
Date: 01/12/04


Date: Mon, 12 Jan 2004 12:39:50 -0500

Without doing proper homework I have assumed that use of the stack below ESP
(i.e. mov [esp-4], eax) was ok. I remember defending this technique during
PosChar challenge days. Apparently this is a no-no. If the interrupt occurs
(software or hardware) and as a result of this interrupt the program flow
switches to another code segment (including task switch) that is of equal
privilege level then the current stack will be used to save some data. I
have found that out during debugging session. Debugging traps are software
interrupts and they were apparently messing with the stack. So I did some
detailed reading on INT instruction and enlightenment came to me.

Les.



Relevant Pages

  • Re: Interrupt context...
    ... > gone through most of the posts on interrupt in usenet. ... > kernel stack and ISR is executed. ... More may be saved depending on the architecture. ... Here the kernel have assembler code to save all general ...
    (comp.os.linux.development.system)
  • Re: BTX on USB pen drive
    ... my pc but doesn't boot on my supermicro server. ... * Emulate MOV reg,CRx. ... * Protected Mode Hardware interrupt jump table. ... * We place a trampoline on the user stack that will return to rret_tramp ...
    (freebsd-stable)
  • Re: interrupt routine and application pages
    ... application stack in the interrupt context. ... are still in the context of interrupted thread. ... your code runs at raised IRQL, Memory Manager just had no chance to ...
    (microsoft.public.development.device.drivers)
  • [PATCH 4/6] UML - IRQ stacks
    ... Add a separate IRQ stack. ... interrupt run on a separate stack rather than starting on the normal ... The IRQ stack for CPU 0 is declared in the same way as the initial ... handler can't run because it has no idea what shape the stack is in. ...
    (Linux-Kernel)
  • Re: Question about interrupt in MINIX3
    ... a new stack for use during the interrupt service. ... stack is determined by an entry in the Task State Segment. ... does interrupt service just use five last entries in stackframe as its stack? ...
    (comp.os.minix)