[syslinux] com32: custom int3 handler

H. Peter Anvin hpa at zytor.com
Sat Nov 20 12:21:15 PST 2004


Jeff Kalikstein wrote:
> Thanks, Peter-
> 
> After I sent the message, I discovered my mistake, and
> am now able to call my int3 handler.  However, I am
> not able to return correctly after the interrupt. 
> Based on the x86 documentation, I suspect that the
> problem is with adjusting the sp in the handler.  Do
> you have any gcc tricks that can help?
> 

Not only that, but you have to save all registers, not just the normal ones.

Some architectures have __attribute__((interrupt)) or 
__attribute__((naked)), but they don't work on i386.  That means gcc 
can't generate an interrupt-worthy function on i386, and you have to use 
an assembly wrapper.  At the simplest, this could look like:

	.globl int3_entry
	.type int3_entry, @function
int3_entry:
	pushal
	call int3
	popal
	iret
	.size int3_entry, .-int3_entry

I don't want to turn all of this into API functions, because a) I think 
it's a rare need, b) it can be done without code in syslinux, and c) I 
think it's asking for people who don't understand the limitations to try 
to use it.

	-hpa




More information about the Syslinux mailing list