void syscall_gate() { __asm__("SYSTEM_CALL:"); __asm__("pushl $0"); store_reg(); svc(); restore_reg(); __asm__("add $4, %esp"); iret(); }
/* * Handle (synchronous) user traps. These are all reflected * to the current partition, except for the hypervisor reserved * interrupts when they are issued by the partition OS. When * a hypervisor interrupt is generate by a partition application * (ring 3) it is always reflected to the guest OS. */ void trap(struct cpu_thread *thread, uval32 trapno) { uval cpl = RPL(thread->tss.srs.regs.cs); if (likely(trapno >= BASE_HCALL_VECTOR && cpl < 3)) { switch (trapno) { case HCALL_VECTOR: /* hcall */ hcall(thread); break; case HCALL_VECTOR_IRET: /* iret */ iret(thread); break; default: hprintf("%s: int 0x%ulx in reserved range - ignored\n", __func__, trapno); break; } return; } raise_exception(thread, trapno); }
void do_irq_finish() { schedule(); iret(); /* now the system is in user mode */ }