| 87 | } |
| 88 | |
| 89 | void CPU::reset() { |
| 90 | this->flags = ID; |
| 91 | this->eip.u32 = 0; |
| 92 | this->instructionCount = 0; |
| 93 | for (int i=0;i<7;i++) { |
| 94 | this->setSeg(i, 0, 0); |
| 95 | } |
| 96 | for (int i=0;i<9;i++) { |
| 97 | this->reg[i].u32 = 0; |
| 98 | } |
| 99 | for (int i=0;i<8;i++) { |
| 100 | this->xmm[i].pi.u64[0] = 0; |
| 101 | this->xmm[i].pi.u64[1] = 0; |
| 102 | } |
| 103 | this->lazyFlagType = FLAGS_NONE; |
| 104 | this->setIsBig(1); |
| 105 | this->seg[CS].value = 0xF; // index 1, LDT, rpl=3 |
| 106 | this->seg[SS].value = 0x17; // index 2, LDT, rpl=3 |
| 107 | this->seg[DS].value = 0x17; // index 2, LDT, rpl=3 |
| 108 | this->seg[ES].value = 0x17; // index 2, LDT, rpl=3 |
| 109 | this->cpl = 3; // user mode |
| 110 | this->cr0 = CR0_PROTECTION | CR0_FPUPRESENT | CR0_PAGING; |
| 111 | this->flags|=IF; |
| 112 | this->fpu.FINIT(); |
| 113 | this->stackNotMask = 0; |
| 114 | this->stackMask = 0xFFFFFFFF; |
| 115 | this->nextOp = nullptr; |
| 116 | #ifdef BOXEDWINE_MULTI_THREADED |
| 117 | this->tmpLockAddress = 0; |
| 118 | #endif |
| 119 | #ifdef BOXEDWINE_JIT |
| 120 | memset(calculateCF, 0, sizeof(calculateCF)); |
| 121 | #endif |
| 122 | } |
| 123 | |
| 124 | void CPU::call(U32 big, U32 selector, U32 offset, U32 oldEip) { |
| 125 | if (this->flags & VM) { |