src/emu/cpu/i386/i386.c
| r11975 | r11976 | |
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | cpustate->CPL = cpustate->sreg[CS].selector & 0x03; |
| 827 | | printf("286 Task Switch from selector %04x to %04x",old_task,seg.selector); |
| 827 | printf("286 Task Switch from selector %04x to %04x\n",old_task,seg.selector); |
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | static void i386_task_switch(i386_state *cpustate, UINT16 selector, UINT8 nested) |
| r11975 | r11976 | |
| 1413 | 1413 | if(DPL < CPL && (desc.flags & 0x0004) == 0) |
| 1414 | 1414 | { |
| 1415 | 1415 | I386_SREG stack; |
| 1416 | I386_SREG temp; |
| 1416 | 1417 | UINT32 oldSS,oldESP; |
| 1417 | 1418 | /* more privilege */ |
| 1418 | 1419 | /* Check new SS segment for privilege level from TSS */ |
| r11975 | r11976 | |
| 1523 | 1524 | PUSH16(cpustate,oldESP & 0xffff); |
| 1524 | 1525 | } |
| 1525 | 1526 | |
| 1526 | | for(x=0;x<(gate.dword_count & 0x1f);x++) |
| 1527 | memset(&temp, 0, sizeof(temp)); |
| 1528 | temp.selector = oldSS; |
| 1529 | i386_load_protected_mode_segment(cpustate,&temp); |
| 1530 | /* copy parameters from old stack to new stack */ |
| 1531 | for(x=(gate.dword_count & 0x1f)-1;x>=0;x--) |
| 1527 | 1532 | { |
| 1528 | | /* TODO: copy parameters from old stack to new stack */ |
| 1529 | | PUSH16(cpustate,0x1234); |
| 1533 | UINT32 addr = temp.base + oldESP + (x*2); |
| 1534 | PUSH16(cpustate,READ16(cpustate,addr)); |
| 1530 | 1535 | } |
| 1531 | | logerror("Call gate parameters pushed = %i\n",gate.dword_count); |
| 1532 | 1536 | cpustate->CPL = (stack.flags >> 5) & 0x03; |
| 1533 | 1537 | SetRPL = 1; |
| 1534 | 1538 | } |