Re: push pop ebp
From: Alex McDonald (alex_mcd_at_btopenworld.com)
Date: 07/10/04
- Next message: Alex McDonald: "Re: ASM vs HLL : absurd war"
- Previous message: Phil Carmody: "Re: multiplication and tests"
- In reply to: Beth: "Re: push pop ebp"
- Next in thread: f0dder: "Re: push pop ebp"
- Reply: f0dder: "Re: push pop ebp"
- Reply: Beth: "Re: push pop ebp"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 10 Jul 2004 19:27:38 +0000 (UTC)
"Beth" <BethStone21@hotmail.NOSPICEDHAM.com> wrote in message
news:3BXGc.60$1t2.33@newsfe1-win.ntli.net...
> Alex McDonald wrote:
> > One more under Windows that's sometimes a
> > gotcha; don't expect any SEH (structured exception handlers)
> to work
> > properly, if at all, while ESP is pointing off in the wilds.
> SEH expects to
> > find ESP pointing to a valid stack, nowhere else.
>
> And as an exception could conceivably happen at almost any point
> in a program, then this is actually a pretty large limitation on
> the use of ESP for other things in Windows...
>
> Although, are you completely sure about this? (As it's hard to
> read in Usenet posts at times: no sarcasm there, actual
> legitimate question about whether you're completely certain
> because I'm thinking it through and there _might_ be a
> possibility...although, no, have NOT tested it so perhaps I'm
> simply missing something here...indeed, you sound very sure with
> "nowhere else" at the end that it sounds like you've actually
> done and know it isn't possible ;)...
>
===snipped
I have spent days of fruitless debugging trying to work out why the stack is
required for the chain of pointers created, and can't work out why. I've
written SEH code that uses other than the stack, and the response to errors
is complete shutdown of the app, immediately and without any intermediate
exception handlers being fired. That makes debugging difficult, and the
dubuggers I've been using won't survive the type of termination that seems
to happen -- the entire process tree ad the address space just disappears,
without even a puff of smoke. No errors in the event log either. All tried
under Win2K.
The code I am writing is for a Forth; Forth is a two stack VM, and the
stacks' contents just can't have any old rubbish pushed or popped off them
(such as SEH frames). The solution was to reserve the first 16K or so of the
ESP stack for Windows stacky type stuff; the SEH frames live there. EBP is
used as the second stack pointer, and SEH code provides a similar exception
based mechanism for providing memory to this second stack, much in the way
Windows provides it for the ESP stack.
As you noted, bitter experience. If anyone knows the answer to this, I'd be
delighted to know.
-- Regards Alex McDonald
- Next message: Alex McDonald: "Re: ASM vs HLL : absurd war"
- Previous message: Phil Carmody: "Re: multiplication and tests"
- In reply to: Beth: "Re: push pop ebp"
- Next in thread: f0dder: "Re: push pop ebp"
- Reply: f0dder: "Re: push pop ebp"
- Reply: Beth: "Re: push pop ebp"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]