public CPUx86() { EIP = new Register32Bit("EIP", 0, RegisterType.InstructionPointer, false); EFLAGS = new FlagsRegister(); EAX = new GeneralPurposeRegister("EAX", 0); EBX = new GeneralPurposeRegister("EBX", 1); ECX = new GeneralPurposeRegister("ECX", 2); EDX = new GeneralPurposeRegister("EDX", 3); ESP = new GeneralPurposeRegister("ESP", 4); EBP = new GeneralPurposeRegister("EBP", 5); ESI = new GeneralPurposeRegister("ESI", 6); EDI = new GeneralPurposeRegister("EDI", 7); CR0 = new CR0(); CR2 = new ControlRegister("CR2", 2); CR3 = new ControlRegister("CR3", 3); CR4 = new ControlRegister("CR3", 4); AX = new Legacy16BitRegister("AX", EAX); BX = new Legacy16BitRegister("BX", EBX); CX = new Legacy16BitRegister("CX", ECX); DX = new Legacy16BitRegister("DX", EDX); SI = new Legacy16BitRegister("SI", ESI); DI = new Legacy16BitRegister("DI", EDI); BP = new Legacy16BitRegister("BP", EBP); AL = new Legacy8BitLowRegister("AL", EAX); BL = new Legacy8BitLowRegister("BL", EBX); CL = new Legacy8BitLowRegister("CL", ECX); DL = new Legacy8BitLowRegister("DL", EDX); AH = new Legacy8BitHighRegister("AH", EAX); BH = new Legacy8BitHighRegister("BH", EBX); CH = new Legacy8BitHighRegister("CH", ECX); DH = new Legacy8BitHighRegister("DH", EDX); XMM0 = new RegisterFloatingPoint("XMM0", 0, RegisterType.FloatingPoint); XMM1 = new RegisterFloatingPoint("XMM1", 1, RegisterType.FloatingPoint); XMM2 = new RegisterFloatingPoint("XMM2", 2, RegisterType.FloatingPoint); XMM3 = new RegisterFloatingPoint("XMM3", 3, RegisterType.FloatingPoint); XMM4 = new RegisterFloatingPoint("XMM4", 4, RegisterType.FloatingPoint); XMM5 = new RegisterFloatingPoint("XMM5", 5, RegisterType.FloatingPoint); XMM6 = new RegisterFloatingPoint("XMM6", 6, RegisterType.FloatingPoint); XMM7 = new RegisterFloatingPoint("XMM7", 7, RegisterType.FloatingPoint); ST0 = new RegisterFloatingPoint("ST0", -1, RegisterType.FloatingPoint); CS = new SegmentRegister("CS", 0); DS = new SegmentRegister("DS", 1); ES = new SegmentRegister("ES", 2); FS = new SegmentRegister("FS", 3); GS = new SegmentRegister("GS", 4); SS = new SegmentRegister("SS", 5); Reset(); }
public CPUx86() { EIP = new Register32Bit("EIP", 0, RegisterType.InstructionPointer, false); EFLAGS = new FlagsRegister(); EAX = new GeneralPurposeRegister("EAX", 0); EBX = new GeneralPurposeRegister("EBX", 1); ECX = new GeneralPurposeRegister("ECX", 2); EDX = new GeneralPurposeRegister("EDX", 3); ESP = new GeneralPurposeRegister("ESP", 4); EBP = new GeneralPurposeRegister("EBP", 5); ESI = new GeneralPurposeRegister("ESI", 6); EDI = new GeneralPurposeRegister("EDI", 7); CR0 = new CR0(); CR2 = new ControlRegister("CR2", 2); CR3 = new ControlRegister("CR3", 3); CR4 = new ControlRegister("CR3", 4); AX = new Legacy16BitRegister("AX", EAX); BX = new Legacy16BitRegister("BX", EBX); CX = new Legacy16BitRegister("CX", ECX); DX = new Legacy16BitRegister("DX", EDX); SI = new Legacy16BitRegister("SI", ESI); DI = new Legacy16BitRegister("DI", EDI); BP = new Legacy16BitRegister("BP", EBP); AL = new Legacy8BitLowRegister("AL", EAX); BL = new Legacy8BitLowRegister("BL", EBX); CL = new Legacy8BitLowRegister("CL", ECX); DL = new Legacy8BitLowRegister("DL", EDX); AH = new Legacy8BitHighRegister("AH", EAX); BH = new Legacy8BitHighRegister("BH", EBX); CH = new Legacy8BitHighRegister("CH", ECX); DH = new Legacy8BitHighRegister("DH", EDX); XMM0 = new RegisterFloatingPoint("XMM0", 0, RegisterType.FloatingPoint); XMM1 = new RegisterFloatingPoint("XMM1", 1, RegisterType.FloatingPoint); XMM2 = new RegisterFloatingPoint("XMM2", 2, RegisterType.FloatingPoint); XMM3 = new RegisterFloatingPoint("XMM3", 3, RegisterType.FloatingPoint); XMM4 = new RegisterFloatingPoint("XMM4", 4, RegisterType.FloatingPoint); XMM5 = new RegisterFloatingPoint("XMM5", 5, RegisterType.FloatingPoint); XMM6 = new RegisterFloatingPoint("XMM6", 6, RegisterType.FloatingPoint); XMM7 = new RegisterFloatingPoint("XMM7", 7, RegisterType.FloatingPoint); ST0 = new RegisterFloatingPoint("ST0", -1, RegisterType.FloatingPoint); CS = new SegmentRegister("CS", 0); DS = new SegmentRegister("DS", 1); ES = new SegmentRegister("ES", 2); FS = new SegmentRegister("FS", 3); GS = new SegmentRegister("GS", 4); SS = new SegmentRegister("SS", 5); Reset(); }
internal void Assign(OpcodeInfo opcodeInfo, IntPtr rawCodes, Processor processor, uint ip) { base.Assign(opcodeInfo, rawCodes, processor.CS, ip, processor.GlobalSize != 0); this.EAX = (uint)processor.EAX; this.EBX = (uint)processor.EBX; this.ECX = (uint)processor.ECX; this.EDX = (uint)processor.EDX; this.ESI = processor.ESI; this.EDI = processor.EDI; this.EBP = processor.EBP; this.DS = processor.DS; this.ES = processor.ES; this.FS = processor.FS; this.GS = processor.GS; this.SS = processor.SS; this.ESP = processor.ESP; this.Flags = processor.Flags.Value & ~EFlags.Reserved1; this.CR0 = processor.CR0; }
public bool intersection_RayObject(V3 R0, V3 Rd, out V3 P, out V3 N, out float t) { V3 CR0; float A, B, C, delta, t1, t2; P = new V3(0, 0, 0); N = new V3(0, 0, 0); t = -1; CR0 = R0 - Center; // (t^2) rd^2 + 2*t*rd*b +b^2 = R^2 A = Rd.Norme2(); B = 2f * V3.prod_scal(ref Rd, ref CR0); C = CR0.Norme2() - (R * R); delta = (B * B) - (4 * A * C); if (delta < 0) { return(false); } t1 = (-B + (float)Math.Sqrt(delta)) / (2 * A); t2 = (-B - (float)Math.Sqrt(delta)) / (2 * A); t = (t1 > 0 && t1 < t2) ? t1 : t2; if (t < MIN_DISTANCE) { return(false); } P = R0 + t * Rd; N = getPixelSphereNormal(P); return(true); }