Fixes from Bart Oldeman

This commit is contained in:
H. Peter Anvin 2002-09-19 04:27:01 +00:00
parent f394043af0
commit c9f57c24d0
4 changed files with 20 additions and 13 deletions

View file

@ -1,3 +1,8 @@
0.98.36
-------
* Fix signed/unsigned problems.
* Fix JMP FAR label and CALL FAR label.
0.98.35
-------
* Fix build failure on 16-bit DOS (Makefile.bc3 workaround for compiler bug.)

View file

@ -154,7 +154,7 @@ static unsigned char *do_ea (unsigned char *data, int modrm, int asize,
case 2:
op->segment |= SEG_DISP16;
op->offset = *data++;
op->offset |= (*data++) << 8;
op->offset |= ((unsigned) *data++) << 8;
break;
}
return data;
@ -229,7 +229,7 @@ static unsigned char *do_ea (unsigned char *data, int modrm, int asize,
case 2:
op->segment |= SEG_DISP32;
op->offset = *data++;
op->offset |= (*data++) << 8;
op->offset |= ((unsigned) *data++) << 8;
op->offset |= ((long) *data++) << 16;
op->offset |= ((long) *data++) << 24;
break;
@ -316,11 +316,11 @@ static int matches (struct itemplate *t, unsigned char *data, int asize,
ins->oprs[c-024].offset = *data++;
if (c >= 030 && c <= 032) {
ins->oprs[c-030].offset = *data++;
ins->oprs[c-030].offset |= (*data++ << 8);
ins->oprs[c-030].offset |= (((unsigned) *data++) << 8);
}
if (c >= 034 && c <= 036) {
ins->oprs[c-034].offset = *data++;
ins->oprs[c-034].offset |= (*data++ << 8);
ins->oprs[c-034].offset |= (((unsigned) *data++) << 8);
if (osize == 32) {
ins->oprs[c-034].offset |= (((long) *data++) << 16);
ins->oprs[c-034].offset |= (((long) *data++) << 24);
@ -330,13 +330,13 @@ static int matches (struct itemplate *t, unsigned char *data, int asize,
}
if (c >= 040 && c <= 042) {
ins->oprs[c-040].offset = *data++;
ins->oprs[c-040].offset |= (*data++ << 8);
ins->oprs[c-040].offset |= (((unsigned) *data++) << 8);
ins->oprs[c-040].offset |= (((long) *data++) << 16);
ins->oprs[c-040].offset |= (((long) *data++) << 24);
}
if (c >= 044 && c <= 046) {
ins->oprs[c-044].offset = *data++;
ins->oprs[c-044].offset |= (*data++ << 8);
ins->oprs[c-044].offset |= (((unsigned) *data++) << 8);
if (asize == 32) {
ins->oprs[c-044].offset |= (((long) *data++) << 16);
ins->oprs[c-044].offset |= (((long) *data++) << 24);
@ -350,13 +350,13 @@ static int matches (struct itemplate *t, unsigned char *data, int asize,
}
if (c >= 060 && c <= 062) {
ins->oprs[c-060].offset = *data++;
ins->oprs[c-060].offset |= (*data++ << 8);
ins->oprs[c-060].offset |= (((unsigned) *data++) << 8);
ins->oprs[c-060].segment |= SEG_RELATIVE;
ins->oprs[c-060].segment &= ~SEG_32BIT;
}
if (c >= 064 && c <= 066) {
ins->oprs[c-064].offset = *data++;
ins->oprs[c-064].offset |= (*data++ << 8);
ins->oprs[c-064].offset |= (((unsigned) *data++) << 8);
if (osize == 32) {
ins->oprs[c-064].offset |= (((long) *data++) << 16);
ins->oprs[c-064].offset |= (((long) *data++) << 24);
@ -372,7 +372,7 @@ static int matches (struct itemplate *t, unsigned char *data, int asize,
}
if (c >= 070 && c <= 072) {
ins->oprs[c-070].offset = *data++;
ins->oprs[c-070].offset |= (*data++ << 8);
ins->oprs[c-070].offset |= (((unsigned) *data++) << 8);
ins->oprs[c-070].offset |= (((long) *data++) << 16);
ins->oprs[c-070].offset |= (((long) *data++) << 24);
ins->oprs[c-070].segment |= SEG_32BIT | SEG_RELATIVE;
@ -386,11 +386,11 @@ static int matches (struct itemplate *t, unsigned char *data, int asize,
}
if (c >= 0130 && c <= 0132) {
ins->oprs[c-0130].offset = *data++;
ins->oprs[c-0130].offset |= (*data++ << 8);
ins->oprs[c-0130].offset |= (((unsigned) *data++) << 8);
}
if (c >= 0140 && c <= 0142) {
ins->oprs[c-0140].offset = *data++;
ins->oprs[c-0140].offset |= (*data++ << 8);
ins->oprs[c-0140].offset |= (((unsigned) *data++) << 8);
ins->oprs[c-0140].offset |= (((long) *data++) << 16);
ins->oprs[c-0140].offset |= (((long) *data++) << 24);
}

View file

@ -1101,7 +1101,8 @@ static void obj_out (long segto, const void *data, unsigned long type,
static void obj_write_fixup (ObjRecord *orp, int bytes,
int segrel, long seg, long wrt, struct Segment *segto)
{
int locat, method;
unsigned locat;
int method;
int base;
long tidx, fidx;
struct Segment *s = NULL;

View file

@ -484,7 +484,8 @@ insn *parse_line (int pass, char *buffer, insn *result,
bracket = FALSE; /* placate optimisers */
}
if((result->oprs[operand].type & FAR) && !mref)
if((result->oprs[operand].type & FAR) && !mref &&
result->opcode != I_JMP && result->opcode != I_CALL)
{
error (ERR_NONFATAL, "invalid use of FAR operand specifier");
}