int do_vbe_service(unsigned int AX, unsigned int BX, reg_frame * regs) { const unsigned interrupt = 0x10; unsigned function_sup; unsigned success; regs->ds = 0x0040; access_ptr_register(regs, eax) = AX; access_ptr_register(regs, ebx) = BX; if (real_mode_int(interrupt, regs)) { fprintf(stderr, "Error: something went wrong performing real mode interrupt\n"); return -1; } AX = access_ptr_register(regs, eax); function_sup = ((AX & 0xff) == 0x4f); success = ((AX & 0xff00) == 0); if (!success) { fprintf(stderr, "Real mode call failed\n"); return -2; } if (!function_sup) { fprintf(stderr, "Function not supported?\n"); return -3; } return access_ptr_register(regs, ebx); }
void BX_CPU_C::interrupt(Bit8u vector, bx_bool is_INT, bx_bool is_error_code, Bit16u error_code) { #if BX_DEBUGGER BX_CPU_THIS_PTR show_flag |= Flag_intsig; #if BX_DEBUG_LINUX if (bx_dbg.linux_syscall) { if (vector == 0x80) bx_dbg_linux_syscall(BX_CPU_ID); } #endif bx_dbg_interrupt(BX_CPU_ID, vector, error_code); #endif BX_DEBUG(("interrupt(): vector = %u, INT = %u, EXT = %u", (unsigned) vector, (unsigned) is_INT, (unsigned) BX_CPU_THIS_PTR EXT)); BX_INSTR_INTERRUPT(BX_CPU_ID, vector); invalidate_prefetch_q(); // Discard any traps and inhibits for new context; traps will // resume upon return. BX_CPU_THIS_PTR debug_trap = 0; BX_CPU_THIS_PTR inhibit_mask = 0; BX_CPU_THIS_PTR save_cs = BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS]; BX_CPU_THIS_PTR save_ss = BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS]; BX_CPU_THIS_PTR save_eip = RIP; BX_CPU_THIS_PTR save_esp = RSP; #if BX_SUPPORT_X86_64 if (long_mode()) { long_mode_int(vector, is_INT, is_error_code, error_code); return; } #endif if(real_mode()) { real_mode_int(vector, is_INT, is_error_code, error_code); } else { protected_mode_int(vector, is_INT, is_error_code, error_code); } }
void BX_CPU_C::interrupt(Bit8u vector, unsigned type, bx_bool push_error, Bit16u error_code) { #if BX_DEBUGGER BX_CPU_THIS_PTR show_flag |= Flag_intsig; #if BX_DEBUG_LINUX if (bx_dbg.linux_syscall) { if (vector == 0x80) bx_dbg_linux_syscall(BX_CPU_ID); } #endif bx_dbg_interrupt(BX_CPU_ID, vector, error_code); #endif BX_INSTR_INTERRUPT(BX_CPU_ID, vector); invalidate_prefetch_q(); bx_bool soft_int = 0; switch(type) { case BX_SOFTWARE_INTERRUPT: case BX_SOFTWARE_EXCEPTION: soft_int = 1; break; case BX_PRIVILEGED_SOFTWARE_INTERRUPT: case BX_EXTERNAL_INTERRUPT: case BX_NMI: case BX_HARDWARE_EXCEPTION: break; default: BX_PANIC(("interrupt(): unknown exception type %d", type)); } BX_DEBUG(("interrupt(): vector = %02x, TYPE = %u, EXT = %u", vector, type, (unsigned) BX_CPU_THIS_PTR EXT)); // Discard any traps and inhibits for new context; traps will // resume upon return. BX_CPU_THIS_PTR debug_trap = 0; BX_CPU_THIS_PTR inhibit_mask = 0; #if BX_SUPPORT_VMX BX_CPU_THIS_PTR in_event = 1; #endif #if BX_SUPPORT_X86_64 if (long_mode()) { long_mode_int(vector, soft_int, push_error, error_code); } else #endif { RSP_SPECULATIVE; if(real_mode()) { real_mode_int(vector, push_error, error_code); } else { protected_mode_int(vector, soft_int, push_error, error_code); } RSP_COMMIT; } #if BX_X86_DEBUGGER BX_CPU_THIS_PTR in_repeat = 0; #endif #if BX_SUPPORT_VMX BX_CPU_THIS_PTR in_event = 0; #endif }