From: A DOT D DOT Brown AT bradford DOT ac DOT uk Subject: Re: Chaining real-mode interrupts To: bdavidson AT ra DOT isisnet DOT com (Bill Davidson) Date: Thu, 27 Apr 1995 11:45:25 +0100 (BST) Cc: eliz AT is DOT elta DOT co DOT il, djgpp AT sun DOT soe DOT clarkson DOT edu > As for my own code, I tried the -S option to gcc and looked over the > resulting assembler (also had -O2 in there). I noticed that in my > handler function, where it called memset() and where it called > _go32_dpmi_simulate_fcall_iret(), there was no cleaning-up of the stack > on return. I confess that I am not up on 386+ assembler (I learned 8088 > assembler then switched to C); I think the 'leave' command does the stack > cleanup (?), but it still looked wrong to me, especially in a handler > function. So I recompiled the module without any optimization, relinked, > and the program ran pretty good. The keyboard handler still seems to be > a problem, but at least I am getting some (unstable) results! I think you'll find there is something like: pushl %ebp movl %esp, %ebp at the top of the function. The leave instruction, at the end of the function, evaluates to: movl %ebp, %esp popl %ebp So, any pushes that are done after the first two instructions (for local variables) are effectivly elminated at the end of the function with the leave. Alistair -- EMAIL: A DOT D DOT Brown AT bradford DOT ac DOT uk