Skip to content

Commit a087632

Browse files
committed
Fix compilation with Open Watcom
Open Watcom does not support 64-bit constants at 'case'. Signed-off-by: KO Myung-Hun <[email protected]>
1 parent 4e02919 commit a087632

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

asm/assemble.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,6 +3274,7 @@ static enum match_result matches(const struct itemplate * const itemp,
32743274
* If this is an *explicitly* sized immediate,
32753275
* allow it to match an extending pattern.
32763276
*/
3277+
#ifndef __WATCOMC__
32773278
switch (isize[i]) {
32783279
case BITS8:
32793280
if (ttype & BYTEEXTMASK) {
@@ -3288,6 +3289,18 @@ static enum match_result matches(const struct itemplate * const itemp,
32883289
default:
32893290
break;
32903291
}
3292+
#else
3293+
/* Open Watcom does not support 64-bit constants at *case*. */
3294+
if (isize[i] == BITS8) {
3295+
if (ttype & BYTEEXTMASK) {
3296+
isize[i] = tsize[i];
3297+
itype[i] |= BYTEEXTMASK;
3298+
}
3299+
} else if (isize[i] == BITS32) {
3300+
if (ttype & DWORDEXTMASK)
3301+
isize[i] = tsize[i];
3302+
}
3303+
#endif
32913304

32923305
/*
32933306
* MOST instructions which take an sdword64 are the only form;

disasm/disasm.c

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ static enum reg_enum whichreg(opflags_t regflags, int regval, uint32_t rex)
113113
*/
114114
static enum reg_enum implicit_reg(opflags_t regflags)
115115
{
116+
#ifndef __WATCOMC__
116117
switch (regflags) {
117118
case REG_AL: return R_AL;
118119
case REG_AX: return R_AX;
@@ -139,6 +140,56 @@ static enum reg_enum implicit_reg(opflags_t regflags)
139140
case OPMASK0: return R_K0;
140141
default: return 0;
141142
}
143+
#else
144+
/* Open Watcom does not support 64-bit constants at *case*. */
145+
if (regflags == REG_AL)
146+
return R_AL;
147+
if (regflags == REG_AX)
148+
return R_AX;
149+
if (regflags == REG_EAX)
150+
return R_EAX;
151+
if (regflags == REG_RAX)
152+
return R_RAX;
153+
if (regflags == REG_DL)
154+
return R_DL;
155+
if (regflags == REG_DX)
156+
return R_DX;
157+
if (regflags == REG_EDX)
158+
return R_EDX;
159+
if (regflags == REG_RDX)
160+
return R_RDX;
161+
if (regflags == REG_CL)
162+
return R_CL;
163+
if (regflags == REG_CX)
164+
return R_CX;
165+
if (regflags == REG_ECX)
166+
return R_ECX;
167+
if (regflags == REG_RCX)
168+
return R_RCX;
169+
if (regflags == FPU0)
170+
return R_ST0;
171+
if (regflags == XMM0)
172+
return R_XMM0;
173+
if (regflags == YMM0)
174+
return R_YMM0;
175+
if (regflags == ZMM0)
176+
return R_ZMM0;
177+
if (regflags == REG_ES)
178+
return R_ES;
179+
if (regflags == REG_CS)
180+
return R_CS;
181+
if (regflags == REG_SS)
182+
return R_SS;
183+
if (regflags == REG_DS)
184+
return R_DS;
185+
if (regflags == REG_FS)
186+
return R_FS;
187+
if (regflags == REG_GS)
188+
return R_GS;
189+
if (regflags == OPMASK0)
190+
return R_K0;
191+
return 0;
192+
#endif
142193
}
143194

144195
/*

0 commit comments

Comments
 (0)