* vm86 trap handler; determines whether routine succeeded or not. * Called while in vm86 space, returns to calling process. */
| 677 | * Called while in vm86 space, returns to calling process. |
| 678 | */ |
| 679 | void |
| 680 | vm86_trap(struct vm86frame *vmf) |
| 681 | { |
| 682 | void (*p)(struct vm86frame *); |
| 683 | caddr_t addr; |
| 684 | |
| 685 | /* "should not happen" */ |
| 686 | if ((vmf->vmf_eflags & PSL_VM) == 0) |
| 687 | panic("vm86_trap called, but not in vm86 mode"); |
| 688 | |
| 689 | addr = MAKE_ADDR(vmf->vmf_cs, vmf->vmf_ip); |
| 690 | if (*(u_char *)addr == HLT) |
| 691 | vmf->vmf_trapno = vmf->vmf_eflags & PSL_C; |
| 692 | else |
| 693 | vmf->vmf_trapno = vmf->vmf_trapno << 16; |
| 694 | |
| 695 | p = (void (*)(struct vm86frame *))((uintptr_t)vm86_biosret + |
| 696 | setidt_disp); |
| 697 | p(vmf); |
| 698 | } |
| 699 | |
| 700 | int |
| 701 | vm86_intcall(int intnum, struct vm86frame *vmf) |