Skip to content

Commit 44790f9

Browse files
committed
simx86: fix codegen-x86 O_PUSH2 for cpatch multipush code
CPatch has some tricky code to deal with multiple cases of O_PUSH2 where the length of 16-bit and 32-bit sequences until the actual write are the same. Easiest to restore the nop then. Regression from 6be02db
1 parent 6c68c64 commit 44790f9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/base/emu-i386/simx86/codegen-x86.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,10 +1165,10 @@ arith0: {
11651165

11661166
case O_PUSH2: { /* register push only */
11671167
const unsigned char pseq16[] = {
1168-
// movw offs(%%ebx),%%ax (with 66 prefix)
1169-
/*00*/ 0x8b,0x43,0x00,
1168+
// movw offs(%%ebx),%%ax
1169+
/*00*/ 0x66,0x8b,0x43,0x00,
11701170
// leal -2(%%ecx),%%ecx
1171-
/*03*/ 0x8d,0x49,0xfe,
1171+
/*04*/ 0x8d,0x49,0xfe,
11721172
// andl StackMask(%%ebx),%%ecx
11731173
0x23,0x4b,Ofs_STACKM,
11741174
// leal (%%esi,%%ecx,1),%%edx
@@ -1178,7 +1178,7 @@ arith0: {
11781178
};
11791179
const unsigned char pseq32[] = {
11801180
// movl offs(%%ebx),%%eax
1181-
/*00*/ 0x8b,0x43,0x00,
1181+
/*00*/ 0x90,0x8b,0x43,0x00,
11821182
// leal -4(%%ecx),%%ecx
11831183
0x8d,0x49,0xfc,
11841184
// andl StackMask(%%ebx),%%ecx
@@ -1191,14 +1191,14 @@ arith0: {
11911191
const unsigned char *p;
11921192
unsigned char *q;
11931193
int sz;
1194-
if (mode&(SEGREG|DATA16)) G1(0x66,Cp),p=pseq16,sz=sizeof(pseq16);
1194+
if (mode&(SEGREG|DATA16)) p=pseq16,sz=sizeof(pseq16);
11951195
else p=pseq32,sz=sizeof(pseq32);
11961196
q=Cp; GNX(Cp, p, sz);
1197-
q[2] = IG->p0;
1197+
q[3] = IG->p0;
11981198
if ((mode & (SEGREG|DATA16)) == SEGREG) {
11991199
// use pseq16 but -4 for 32-bit segreg
12001200
// mirroring recent Intel CPUs
1201-
q[5] = 0xfc;
1201+
q[6] = 0xfc;
12021202
}
12031203
} break;
12041204

0 commit comments

Comments
 (0)