My stump does this:
Code: Select all
# error code and interrupt number already pushed
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movw $0x10,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%fs
movw %ax,%gs
movw %ax,%ss
movl %esp,%eax
pushl %eax
movl $irqHandler, %eax
call *%eax # replace the old stack esp with the new one
popl %eax
movl %eax,%esp
popl %gs
popl %fs
popl %es
popl %ds
popa
addl $8,%esp
iret
Code: Select all
/* stacksetup = stacktop */
*stacksetup-- = 0x10; // gs
*stacksetup-- = 0x10; // fs
*stacksetup-- = 0x10; // es
*stacksetup-- = 0x10; // ds
*stacksetup-- = 0; // eax
*stacksetup-- = 0; // ecx
*stacksetup-- = 0; // edx
*stacksetup-- = 0; // ebx
*stacksetup-- = 0; // esp
*stacksetup-- = 0; // ebp
*stacksetup-- = 0; // esi
*stacksetup-- = 0; // edi
*stacksetup-- = 0x10; // ss
*stacksetup-- = 0x0202; // eflags
*stacksetup-- = 0x08; // cs
*stacksetup = entry; // eip