summaryrefslogtreecommitdiff
path: root/output/outas86.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-11-09 14:44:02 -0800
committerH. Peter Anvin <hpa@zytor.com>2007-11-09 14:44:02 -0800
commit34f6fb0a65b247442afcb2148c8c80112ab4cd59 (patch)
treed6de82ace10cb5da3709efc3e83b37f60a3766ce /output/outas86.c
parent7eaf919a22fa70208eea4de37ddccc344dd49ad8 (diff)
downloadnasm-34f6fb0a65b247442afcb2148c8c80112ab4cd59.tar.gz
nasm-34f6fb0a65b247442afcb2148c8c80112ab4cd59.tar.bz2
nasm-34f6fb0a65b247442afcb2148c8c80112ab4cd59.zip
Don't combine type and size into a single argument
Don't combine type and size into a single argument; *every* backend immediately breaks them apart, so it's really just a huge waste of effort. Additionally, it avoids using short immediates in the resulting code, which is a bad thing.
Diffstat (limited to 'output/outas86.c')
-rw-r--r--output/outas86.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/output/outas86.c b/output/outas86.c
index 02e682c..f342314 100644
--- a/output/outas86.c
+++ b/output/outas86.c
@@ -254,11 +254,11 @@ static void as86_add_piece(struct Section *sect, int type, int32_t offset,
p->number = raa_read(bsym, segment), p->type = 2;
}
-static void as86_out(int32_t segto, const void *data, uint64_t type,
+static void as86_out(int32_t segto, const void *data,
+ enum out_type type, uint64_t size,
int32_t segment, int32_t wrt)
{
struct Section *s;
- int64_t realbytes = type & OUT_SIZMASK;
int32_t offset;
uint8_t mydata[4], *p;
@@ -267,8 +267,6 @@ static void as86_out(int32_t segto, const void *data, uint64_t type,
error(ERR_NONFATAL, "WRT not supported by as86 output format");
}
- type &= OUT_TYPMASK;
-
/*
* handle absolute-assembly (structure definitions)
*/
@@ -295,10 +293,10 @@ static void as86_out(int32_t segto, const void *data, uint64_t type,
error(ERR_WARNING, "attempt to initialize memory in the"
" BSS section: ignored");
if (type == OUT_REL2ADR)
- realbytes = 2;
+ size = 2;
else if (type == OUT_REL4ADR)
- realbytes = 4;
- bsslen += realbytes;
+ size = 4;
+ bsslen += size;
return;
}
@@ -307,15 +305,15 @@ static void as86_out(int32_t segto, const void *data, uint64_t type,
error(ERR_WARNING, "uninitialized space declared in"
" %s section: zeroing",
(segto == stext.index ? "code" : "data"));
- as86_sect_write(s, NULL, realbytes);
- as86_add_piece(s, 0, 0L, 0L, realbytes, 0);
+ as86_sect_write(s, NULL, size);
+ as86_add_piece(s, 0, 0L, 0L, size, 0);
} else
- bsslen += realbytes;
+ bsslen += size;
} else if (type == OUT_RAWDATA) {
if (segment != NO_SEG)
error(ERR_PANIC, "OUT_RAWDATA with other than NO_SEG");
- as86_sect_write(s, data, realbytes);
- as86_add_piece(s, 0, 0L, 0L, realbytes, 0);
+ as86_sect_write(s, data, size);
+ as86_add_piece(s, 0, 0L, 0L, size, 0);
} else if (type == OUT_ADDRESS) {
if (segment != NO_SEG) {
if (segment % 2) {
@@ -323,13 +321,13 @@ static void as86_out(int32_t segto, const void *data, uint64_t type,
" segment base references");
} else {
offset = *(int32_t *)data;
- as86_add_piece(s, 1, offset, segment, realbytes, 0);
+ as86_add_piece(s, 1, offset, segment, size, 0);
}
} else {
p = mydata;
WRITELONG(p, *(int32_t *)data);
- as86_sect_write(s, data, realbytes);
- as86_add_piece(s, 0, 0L, 0L, realbytes, 0);
+ as86_sect_write(s, data, size);
+ as86_add_piece(s, 0, 0L, 0L, size, 0);
}
} else if (type == OUT_REL2ADR) {
if (segment == segto)
@@ -340,7 +338,7 @@ static void as86_out(int32_t segto, const void *data, uint64_t type,
" segment base references");
} else {
offset = *(int32_t *)data;
- as86_add_piece(s, 1, offset - realbytes + 2, segment, 2L,
+ as86_add_piece(s, 1, offset - size + 2, segment, 2L,
1);
}
}
@@ -353,7 +351,7 @@ static void as86_out(int32_t segto, const void *data, uint64_t type,
" segment base references");
} else {
offset = *(int32_t *)data;
- as86_add_piece(s, 1, offset - realbytes + 4, segment, 4L,
+ as86_add_piece(s, 1, offset - size + 4, segment, 4L,
1);
}
}