src/emu/cpu/i386/x87ops.c
| r12001 | r12002 | |
| 59 | 59 | static void I386OP(fpu_group_d8)(i386_state *cpustate) // Opcode 0xd8 |
| 60 | 60 | { |
| 61 | 61 | UINT8 modrm = FETCH(cpustate); |
| 62 | | fatalerror("I386: FPU Op D8 %02X at %08X", modrm, cpustate->pc-2); |
| 62 | if (modrm < 0xc0) |
| 63 | { |
| 64 | UINT32 ea = GetEA(cpustate,modrm); |
| 65 | |
| 66 | switch ((modrm >> 3) & 0x7) |
| 67 | { |
| 68 | case 6: // FDIV |
| 69 | UINT32 src = READ32(cpustate,ea); |
| 70 | if(src == 0) |
| 71 | fatalerror("FPU: Unimplemented Divide-by-zero exception at %08X.\n", cpustate->pc-2); |
| 72 | ST(0).f = ST(0).f / src; |
| 73 | CYCLES(cpustate,1); // TODO |
| 74 | break; |
| 75 | } |
| 76 | } |
| 77 | else |
| 78 | { |
| 79 | fatalerror("I386: FPU Op D8 %02X at %08X", modrm, cpustate->pc-2); |
| 80 | } |
| 63 | 81 | } |
| 64 | 82 | |
| 65 | 83 | static void I386OP(fpu_group_d9)(i386_state *cpustate) // Opcode 0xd9 |
src/emu/cpu/i386/i386.c
| r12001 | r12002 | |
| 556 | 556 | { |
| 557 | 557 | /* IRQ to inner privilege */ |
| 558 | 558 | I386_SREG stack; |
| 559 | UINT32 newESP,oldSS,oldESP; |
| 559 | 560 | |
| 560 | 561 | /* Check new stack segment in TSS */ |
| 561 | 562 | memset(&stack, 0, sizeof(stack)); |
| 562 | | stack.selector = i386_get_stack_segment(cpustate,DPL); |
| 563 | if(flags & 0x0008) |
| 564 | stack.selector = i386_get_stack_segment(cpustate,DPL); |
| 565 | else |
| 566 | stack.selector = i286_get_stack_segment(cpustate,DPL); |
| 563 | 567 | i386_load_protected_mode_segment(cpustate,&stack); |
| 568 | oldSS = cpustate->sreg[SS].selector; |
| 569 | if(flags & 0x0008) |
| 570 | oldESP = REG32(ESP); |
| 571 | else |
| 572 | oldESP = REG16(SP); |
| 564 | 573 | if((stack.selector & ~0x07) == 0) |
| 565 | 574 | { |
| 566 | 575 | logerror("IRQ: New stack selector is null.\n"); |
| r12001 | r12002 | |
| 604 | 613 | } |
| 605 | 614 | if(type & 0x08) // 32-bit gate |
| 606 | 615 | { |
| 607 | | UINT32 newESP = i386_get_stack_ptr(cpustate,DPL); |
| 616 | newESP = i386_get_stack_ptr(cpustate,DPL); |
| 608 | 617 | if(newESP < 20) |
| 609 | 618 | { |
| 610 | 619 | logerror("IRQ: New stack has no space for return addresses.\n"); |
| r12001 | r12002 | |
| 613 | 622 | } |
| 614 | 623 | else // 16-bit gate |
| 615 | 624 | { |
| 616 | | UINT32 newESP = i386_get_stack_ptr(cpustate,DPL); |
| 625 | newESP = i286_get_stack_ptr(cpustate,DPL); |
| 617 | 626 | if(newESP < 10) |
| 618 | 627 | { |
| 619 | 628 | logerror("IRQ: New stack has no space for return addresses.\n"); |
| r12001 | r12002 | |
| 626 | 635 | FAULT_EXP(FAULT_GP,0) |
| 627 | 636 | } |
| 628 | 637 | /* Load new stack segment descriptor */ |
| 629 | | cpustate->sreg[SS].selector = i386_get_stack_segment(cpustate,DPL); |
| 638 | cpustate->sreg[SS].selector = stack.selector; |
| 630 | 639 | i386_load_segment_descriptor(cpustate,SS); |
| 631 | | REG32(ESP) = i386_get_stack_ptr(cpustate,DPL); |
| 640 | if(flags & 0x0008) |
| 641 | REG32(ESP) = i386_get_stack_ptr(cpustate,DPL); |
| 642 | else |
| 643 | REG16(SP) = i286_get_stack_ptr(cpustate,DPL); |
| 632 | 644 | if(type & 0x08) |
| 633 | 645 | { |
| 634 | 646 | // 32-bit gate |
| 635 | | PUSH32(cpustate,cpustate->sreg[SS].selector); |
| 636 | | PUSH32(cpustate,REG32(ESP)); |
| 647 | PUSH32(cpustate,oldSS); |
| 648 | PUSH32(cpustate,oldESP); |
| 637 | 649 | } |
| 638 | 650 | else |
| 639 | 651 | { |
| 640 | 652 | // 16-bit gate |
| 641 | | PUSH16(cpustate,cpustate->sreg[SS].selector); |
| 642 | | PUSH16(cpustate,REG16(ESP)); |
| 653 | PUSH16(cpustate,oldSS); |
| 654 | PUSH16(cpustate,oldESP); |
| 643 | 655 | } |
| 644 | 656 | cpustate->CPL = DPL; |
| 645 | 657 | SetRPL = 1; |