This is my C syscall handler: (only a piece)
Code: Select all
void syscall_callback(regs_t *r)
{
printf("Syscall: %d -> ", r->eax);
if(r->eax == SYSCALL_FS_FOPEN) { ...
called from an assembler function:
Code: Select all
global syscallisr
extern syscall_callback
syscallisr:
call syscall_callback
iret
and the handler was added with this call:
Code: Select all
idt_set_gate(84, (unsigned)syscallisr, 0x08, 0x8E);
I wanted to try if syscalls correctly run. I only put 1 on eax, and call the interrupt of syscall:
Code: Select all
asm volatile("mov $1,%eax\n int $84\n");