emulenv.cc (5966:833e487aa8f7) emulenv.cc (6071:551b62d68f43)
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use of this software in source and binary forms,
6 * with or without modification, are permitted provided that the
7 * following conditions are met:
8 *

--- 65 unchanged lines hidden (view full) ---

74 //changes, but that's managed by the predecoder.
75 if (machInst.sib.base == INTREG_RBP && machInst.modRM.mod == 0)
76 base = NUM_INTREGS;
77 //In -this- special case, we don't use an index.
78 if (index == INTREG_RSP)
79 index = NUM_INTREGS;
80 } else {
81 if (machInst.addrSize == 2) {
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use of this software in source and binary forms,
6 * with or without modification, are permitted provided that the
7 * following conditions are met:
8 *

--- 65 unchanged lines hidden (view full) ---

74 //changes, but that's managed by the predecoder.
75 if (machInst.sib.base == INTREG_RBP && machInst.modRM.mod == 0)
76 base = NUM_INTREGS;
77 //In -this- special case, we don't use an index.
78 if (index == INTREG_RSP)
79 index = NUM_INTREGS;
80 } else {
81 if (machInst.addrSize == 2) {
82 warn("I'm not really using 16 bit MODRM like I'm supposed to!\n");
82 unsigned rm = machInst.modRM.rm;
83 if (rm <= 3) {
84 scale = 1;
85 if (rm < 2) {
86 base = INTREG_RBX;
87 } else {
88 base = INTREG_RBP;
89 }
90 index = (rm % 2) ? INTREG_RDI : INTREG_RSI;
91 } else {
92 scale = 0;
93 switch (rm) {
94 case 4:
95 base = INTREG_RSI;
96 break;
97 case 5:
98 base = INTREG_RDI;
99 break;
100 case 6:
101 base = INTREG_RBP;
102 break;
103 case 7:
104 base = INTREG_RBX;
105 break;
106 }
107 }
83 } else {
84 scale = 0;
85 base = machInst.modRM.rm | (machInst.rex.b << 3);
86 if (machInst.modRM.mod == 0 && machInst.modRM.rm == 5) {
87 //Since we need to use a different encoding of this
88 //instruction anyway, just ignore the base in those cases
89 base = NUM_INTREGS;
90 }

--- 25 unchanged lines hidden ---
108 } else {
109 scale = 0;
110 base = machInst.modRM.rm | (machInst.rex.b << 3);
111 if (machInst.modRM.mod == 0 && machInst.modRM.rm == 5) {
112 //Since we need to use a different encoding of this
113 //instruction anyway, just ignore the base in those cases
114 base = NUM_INTREGS;
115 }

--- 25 unchanged lines hidden ---