static RegisterInfo[] GetRegisterInfos() { var regInfos = new RegisterInfo[IcedConstants.RegisterEnumCount]; regInfos[(int)Register.EIP] = new RegisterInfo(Register.EIP, Register.EIP, Register.RIP, 4); regInfos[(int)Register.RIP] = new RegisterInfo(Register.RIP, Register.EIP, Register.RIP, 8); #if HAS_SPAN ReadOnlySpan <byte> data = new byte[] { #else var data = new byte[] { #endif (byte)Register.AL, (byte)Register.R15L, (byte)Register.RAX, 1, 0, (byte)Register.AX, (byte)Register.R15W, (byte)Register.RAX, 2, 0, (byte)Register.EAX, (byte)Register.R15D, (byte)Register.RAX, 4, 0, (byte)Register.RAX, (byte)Register.R15, (byte)Register.RAX, 8, 0, (byte)Register.ES, (byte)Register.GS, (byte)Register.ES, 2, 0, (byte)Register.XMM0, (byte)Register.XMM31, (byte)Register.ZMM0, 16, 0, (byte)Register.YMM0, (byte)Register.YMM31, (byte)Register.ZMM0, 32, 0, (byte)Register.ZMM0, (byte)Register.ZMM31, (byte)Register.ZMM0, 64, 0, (byte)Register.K0, (byte)Register.K7, (byte)Register.K0, 8, 0, (byte)Register.BND0, (byte)Register.BND3, (byte)Register.BND0, 16, 0, (byte)Register.CR0, (byte)Register.CR15, (byte)Register.CR0, 8, 0, (byte)Register.DR0, (byte)Register.DR15, (byte)Register.DR0, 8, 0, (byte)Register.ST0, (byte)Register.ST7, (byte)Register.ST0, 10, 0, (byte)Register.MM0, (byte)Register.MM7, (byte)Register.MM0, 8, 0, (byte)Register.TR0, (byte)Register.TR7, (byte)Register.TR0, 4, 0, (byte)Register.TMM0, (byte)Register.TMM7, (byte)Register.TMM0, 0, 4, #pragma warning disable CS0618 // Type or member is obsolete (byte)Register.DontUse0, (byte)Register.DontUse0, (byte)Register.DontUse0, 0, 0, (byte)Register.DontUseFA, (byte)Register.DontUseFF, (byte)Register.DontUseFA, 0, 0, #pragma warning restore CS0618 // Type or member is obsolete }; int i; for (i = 0; i < data.Length; i += 5) { var baseReg = (Register)data[i]; var reg = baseReg; var regEnd = (Register)data[i + 1]; var fullReg = (Register)data[i + 2]; int size = data[i + 3] | (data[i + 4] << 8); while (reg <= regEnd) { regInfos[(int)reg] = new RegisterInfo(reg, baseReg, fullReg, size); reg++; fullReg++; if (reg == Register.AH) { fullReg -= 4; } } } if (i != data.Length) { throw new InvalidOperationException(); } return(regInfos); }
static RegisterInfo[] GetRegisterInfos() { var regInfos = new RegisterInfo[IcedConstants.NumberOfRegisters]; regInfos[(int)Register.EIP] = new RegisterInfo(Register.EIP, Register.EIP, Register.RIP, 4); regInfos[(int)Register.RIP] = new RegisterInfo(Register.RIP, Register.EIP, Register.RIP, 8); #if HAS_SPAN ReadOnlySpan <byte> data = new byte[] { #else var data = new byte[] { #endif (byte)Register.AL, (byte)Register.R15L, (byte)Register.RAX, 1, (byte)Register.AX, (byte)Register.R15W, (byte)Register.RAX, 2, (byte)Register.EAX, (byte)Register.R15D, (byte)Register.RAX, 4, (byte)Register.RAX, (byte)Register.R15, (byte)Register.RAX, 8, (byte)Register.ES, (byte)Register.GS, (byte)Register.ES, 2, (byte)Register.XMM0, (byte)Register.XMM31, (byte)Register.ZMM0, 16, (byte)Register.YMM0, (byte)Register.YMM31, (byte)Register.ZMM0, 32, (byte)Register.ZMM0, (byte)Register.ZMM31, (byte)Register.ZMM0, 64, (byte)Register.K0, (byte)Register.K7, (byte)Register.K0, 8, (byte)Register.BND0, (byte)Register.BND3, (byte)Register.BND0, 16, (byte)Register.CR0, (byte)Register.CR15, (byte)Register.CR0, 8, (byte)Register.DR0, (byte)Register.DR15, (byte)Register.DR0, 8, (byte)Register.ST0, (byte)Register.ST7, (byte)Register.ST0, 10, (byte)Register.MM0, (byte)Register.MM7, (byte)Register.MM0, 8, (byte)Register.TR0, (byte)Register.TR7, (byte)Register.TR0, 4, }; int i; for (i = 0; i < data.Length; i += 4) { var baseReg = (Register)data[i]; var reg = baseReg; var regEnd = (Register)data[i + 1]; var fullReg = (Register)data[i + 2]; int size = data[i + 3]; while (reg <= regEnd) { regInfos[(int)reg] = new RegisterInfo(reg, baseReg, fullReg, size); reg++; fullReg++; if (reg == Register.AH) { fullReg -= 4; } } } if (i != data.Length) { throw new InvalidOperationException(); } return(regInfos); }