Mail Archives: djgpp/2001/09/25/22:04:03
I wrote:
>This code doesn't segfault, and the handler gets called
>(I can see the hex dump of the stack), but I don't see
>the register values I'm looking for...
Oops, got it now. The software interupt handler has a
__dpmi_regs * argument. Good ol' trial and error:
#include <stdio.h> /* printf() */
#include <dpmi.h> /* __dpmi_regs, _go32_... */
#include <go32.h> /* _my_cs() */
#define VECT 0x32
static void syscall_int(__dpmi_regs *regs)
{ printf("%c%c%c%c%c%c", regs->h.al, regs->h.bl, regs->h.cl,
regs->h.dl, regs->x.si, regs->x.di); }
int main(void)
{ _go32_dpmi_seginfo old, syscall;
_go32_dpmi_get_protected_mode_interrupt_vector(VECT, &old);
syscall.pm_selector = _my_cs();
syscall.pm_offset = (unsigned long)syscall_int;
_go32_dpmi_allocate_iret_wrapper(&syscall);
_go32_dpmi_set_protected_mode_interrupt_vector(VECT, &syscall);
__asm__ __volatile__(
"int %0\n"
:
: "i"(VECT), "a"('h'), "b"('e'), "c"('l'),
"d"('l'), "S"('o'), "D"('\n'));
_go32_dpmi_set_protected_mode_interrupt_vector(VECT, &old);
_go32_dpmi_free_iret_wrapper(&syscall);
return 0; }
--
geezer@ | http://www.execpc.com/~geezer/osd
execpc.com | http://www.execpc.com/~geezer/os
- Raw text -