assemble.c: Style nitfix
Various tabs/space mixture cleaned and some more. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
ab5bd05d82
commit
d6f31240c5
1 changed files with 899 additions and 898 deletions
83
assemble.c
83
assemble.c
|
@ -301,9 +301,8 @@ static void out(int64_t offset, int32_t segto, const void *data,
|
|||
* if it did. thus, these variables must be static
|
||||
*/
|
||||
|
||||
if (src_get(&lineno, &lnfname)) {
|
||||
if (src_get(&lineno, &lnfname))
|
||||
outfmt->current_dfmt->linenum(lnfname, lineno, segto);
|
||||
}
|
||||
|
||||
outfmt->output(segto, data, type, size, segment, wrt);
|
||||
}
|
||||
|
@ -1243,10 +1242,12 @@ static void gencode(int32_t segment, int64_t offset, int bits,
|
|||
break;
|
||||
|
||||
case4(014):
|
||||
/* The test for BITS8 and SBYTE here is intended to avoid
|
||||
warning on optimizer actions due to SBYTE, while still
|
||||
warn on explicit BYTE directives. Also warn, obviously,
|
||||
if the optimizer isn't enabled. */
|
||||
/*
|
||||
* The test for BITS8 and SBYTE here is intended to avoid
|
||||
* warning on optimizer actions due to SBYTE, while still
|
||||
* warn on explicit BYTE directives. Also warn, obviously,
|
||||
* if the optimizer isn't enabled.
|
||||
*/
|
||||
if (((opx->type & BITS8) ||
|
||||
!(opx->type & temp->opd[op1] & BYTENESS)) &&
|
||||
(opx->offset < -128 || opx->offset > 127)) {
|
||||
|
@ -2228,8 +2229,8 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||
output->bytes = 0; /* no offset necessary either */
|
||||
output->modrm = 0xC0 | ((rfield & 7) << 3) | (i & 7);
|
||||
} else { /* it's a memory reference */
|
||||
if (input->basereg == -1
|
||||
&& (input->indexreg == -1 || input->scale == 0)) {
|
||||
if (input->basereg == -1 &&
|
||||
(input->indexreg == -1 || input->scale == 0)) {
|
||||
/* it's a pure offset */
|
||||
|
||||
if (bits == 64 && ((input->type & IP_REL) == IP_REL) &&
|
||||
|
@ -2289,8 +2290,10 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||
|
||||
/* check for a 32/64-bit memory reference... */
|
||||
if ((ix|bx) & (BITS32|BITS64)) {
|
||||
/* it must be a 32/64-bit memory reference. Firstly we have
|
||||
* to check that all registers involved are type E/Rxx. */
|
||||
/*
|
||||
* it must be a 32/64-bit memory reference. Firstly we have
|
||||
* to check that all registers involved are type E/Rxx.
|
||||
*/
|
||||
int32_t sok = BITS32 | BITS64, o = input->offset;
|
||||
|
||||
if (it != -1) {
|
||||
|
@ -2308,8 +2311,10 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||
sok &= bx;
|
||||
}
|
||||
|
||||
/* While we're here, ensure the user didn't specify
|
||||
WORD or QWORD. */
|
||||
/*
|
||||
* While we're here, ensure the user didn't specify
|
||||
* WORD or QWORD
|
||||
*/
|
||||
if (input->disp_size == 16 || input->disp_size == 64)
|
||||
return NULL;
|
||||
|
||||
|
@ -2320,8 +2325,8 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||
|
||||
/* now reorganize base/index */
|
||||
if (s == 1 && bt != it && bt != -1 && it != -1 &&
|
||||
((hb == b && ht == EAH_NOTBASE)
|
||||
|| (hb == i && ht == EAH_MAKEBASE))) {
|
||||
((hb == b && ht == EAH_NOTBASE) ||
|
||||
(hb == i && ht == EAH_MAKEBASE))) {
|
||||
/* swap if hints say so */
|
||||
t = bt, bt = it, it = t;
|
||||
x = bx, bx = ix, ix = x;
|
||||
|
@ -2332,12 +2337,11 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||
/* make single reg base, unless hint */
|
||||
bt = it, bx = ix, it = -1, ix = 0;
|
||||
}
|
||||
if (((s == 2 && it != REG_NUM_ESP
|
||||
&& !(input->eaflags & EAF_TIMESTWO)) || s == 3
|
||||
|| s == 5 || s == 9) && bt == -1)
|
||||
if (((s == 2 && it != REG_NUM_ESP && !(input->eaflags & EAF_TIMESTWO)) ||
|
||||
s == 3 || s == 5 || s == 9) && bt == -1)
|
||||
bt = it, bx = ix, s--; /* convert 3*EAX to EAX+2*EAX */
|
||||
if (it == -1 && (bt & 7) != REG_NUM_ESP
|
||||
&& (input->eaflags & EAF_TIMESTWO))
|
||||
if (it == -1 && (bt & 7) != REG_NUM_ESP &&
|
||||
(input->eaflags & EAF_TIMESTWO))
|
||||
it = bt, ix = bx, bt = -1, bx = 0, s = 1;
|
||||
/* convert [NOSPLIT EAX] to sib format with 0x0 displacement */
|
||||
if (s == 1 && it == REG_NUM_ESP) {
|
||||
|
@ -2345,8 +2349,8 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||
t = it, it = bt, bt = t;
|
||||
x = ix, ix = bx, bx = x;
|
||||
}
|
||||
if (it == REG_NUM_ESP
|
||||
|| (s != 1 && s != 2 && s != 4 && s != 8 && it != -1))
|
||||
if (it == REG_NUM_ESP ||
|
||||
(s != 1 && s != 2 && s != 4 && s != 8 && it != -1))
|
||||
return NULL; /* wrong, for various reasons */
|
||||
|
||||
output->rex |= rexflags(it, ix, REX_X);
|
||||
|
@ -2363,13 +2367,12 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||
rm = (bt & 7);
|
||||
if (rm != REG_NUM_EBP && o == 0 &&
|
||||
seg == NO_SEG && !forw_ref &&
|
||||
!(input->eaflags &
|
||||
(EAF_BYTEOFFS | EAF_WORDOFFS)))
|
||||
!(input->eaflags & (EAF_BYTEOFFS | EAF_WORDOFFS)))
|
||||
mod = 0;
|
||||
else if (input->eaflags & EAF_BYTEOFFS ||
|
||||
(o >= -128 && o <= 127 && seg == NO_SEG
|
||||
&& !forw_ref
|
||||
&& !(input->eaflags & EAF_WORDOFFS)))
|
||||
(o >= -128 && o <= 127 &&
|
||||
seg == NO_SEG && !forw_ref &&
|
||||
!(input->eaflags & EAF_WORDOFFS)))
|
||||
mod = 1;
|
||||
else
|
||||
mod = 2;
|
||||
|
@ -2411,13 +2414,12 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||
base = (bt & 7);
|
||||
if (base != REG_NUM_EBP && o == 0 &&
|
||||
seg == NO_SEG && !forw_ref &&
|
||||
!(input->eaflags &
|
||||
(EAF_BYTEOFFS | EAF_WORDOFFS)))
|
||||
!(input->eaflags & (EAF_BYTEOFFS | EAF_WORDOFFS)))
|
||||
mod = 0;
|
||||
else if (input->eaflags & EAF_BYTEOFFS ||
|
||||
(o >= -128 && o <= 127 && seg == NO_SEG
|
||||
&& !forw_ref
|
||||
&& !(input->eaflags & EAF_WORDOFFS)))
|
||||
(o >= -128 && o <= 127 &&
|
||||
seg == NO_SEG && !forw_ref &&
|
||||
!(input->eaflags & EAF_WORDOFFS)))
|
||||
mod = 1;
|
||||
else
|
||||
mod = 2;
|
||||
|
@ -2437,9 +2439,8 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||
return NULL;
|
||||
|
||||
/* check all registers are BX, BP, SI or DI */
|
||||
if ((b != -1 && b != R_BP && b != R_BX && b != R_SI
|
||||
&& b != R_DI) || (i != -1 && i != R_BP && i != R_BX
|
||||
&& i != R_SI && i != R_DI))
|
||||
if ((b != -1 && b != R_BP && b != R_BX && b != R_SI && b != R_DI) ||
|
||||
(i != -1 && i != R_BP && i != R_BX && i != R_SI && i != R_DI))
|
||||
return NULL;
|
||||
|
||||
/* ensure the user didn't specify DWORD/QWORD */
|
||||
|
@ -2504,9 +2505,8 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||
!(input->eaflags & (EAF_BYTEOFFS | EAF_WORDOFFS)))
|
||||
mod = 0;
|
||||
else if (input->eaflags & EAF_BYTEOFFS ||
|
||||
(o >= -128 && o <= 127 && seg == NO_SEG
|
||||
&& !forw_ref
|
||||
&& !(input->eaflags & EAF_WORDOFFS)))
|
||||
(o >= -128 && o <= 127 && seg == NO_SEG &&
|
||||
!forw_ref && !(input->eaflags & EAF_WORDOFFS)))
|
||||
mod = 1;
|
||||
else
|
||||
mod = 2;
|
||||
|
@ -2605,10 +2605,11 @@ static void add_asp(insn *ins, int addrbits)
|
|||
|
||||
for (j = 0; j < ins->operands; j++) {
|
||||
if (!(MEM_OFFS & ~ins->oprs[j].type) &&
|
||||
(ins->oprs[j].disp_size ? ins->oprs[j].disp_size : defdisp)
|
||||
!= ins->addr_size) {
|
||||
/* mem_offs sizes must match the address size; if not,
|
||||
strip the MEM_OFFS bit and match only EA instructions */
|
||||
(ins->oprs[j].disp_size ? ins->oprs[j].disp_size : defdisp) != ins->addr_size) {
|
||||
/*
|
||||
* mem_offs sizes must match the address size; if not,
|
||||
* strip the MEM_OFFS bit and match only EA instructions
|
||||
*/
|
||||
ins->oprs[j].type &= ~(MEM_OFFS & ~MEMORY);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue