Upgrade RAA functions to hold 64-bit data.

This commit is contained in:
Charles Crayne 2007-11-07 19:03:46 -08:00
parent 8c7eca4936
commit 5fbbc8c2e7
4 changed files with 12 additions and 11 deletions

View File

@ -218,10 +218,10 @@ static void out(int64_t offset, int32_t segto, const void *data,
outfmt->output(segto, data, type, segment, wrt);
}
static int jmp_match(int32_t segment, int32_t offset, int bits,
static int jmp_match(int32_t segment, int64_t offset, int bits,
insn * ins, const char *code)
{
int32_t isize;
int64_t isize;
uint8_t c = code[0];
if (c != 0370 && c != 0371)
@ -723,7 +723,7 @@ int64_t insn_size(int32_t segment, int64_t offset, int bits, uint32_t cp,
if (m == 100) {
/* we've matched an instruction. */
int32_t isize;
int64_t isize;
const char *codes = temp->code;
int j;

5
nasm.c
View File

@ -837,7 +837,8 @@ static void assemble_file(char *fname)
insn output_ins;
int i, validid;
bool rn_error;
int32_t seg, offs;
int32_t seg;
int64_t offs;
struct tokenval tokval;
expr *e;
int pass, pass_max;
@ -1313,7 +1314,7 @@ static void assemble_file(char *fname)
if (pass1 == 1) {
int32_t l = insn_size(location.segment, offs, sb, cpu,
int64_t l = insn_size(location.segment, offs, sb, cpu,
&output_ins, report_error);
/* if (using_debug_info) && output_ins.opcode != -1) */

View File

@ -459,7 +459,7 @@ void raa_free(struct RAA *r)
}
}
int32_t raa_read(struct RAA *r, int32_t posn)
int64_t raa_read(struct RAA *r, int32_t posn)
{
if (posn >= r->stepsize * LAYERSIZ(r))
return 0; /* Return 0 for undefined entries */
@ -474,7 +474,7 @@ int32_t raa_read(struct RAA *r, int32_t posn)
return r->u.l.data[posn];
}
struct RAA *raa_write(struct RAA *r, int32_t posn, int32_t value)
struct RAA *raa_write(struct RAA *r, int32_t posn, int64_t value)
{
struct RAA *result;

View File

@ -212,7 +212,7 @@ void fwriteint64_t(int64_t data, FILE * fp);
* chunk.
*/
#define RAA_BLKSIZE 65536 /* this many longs allocated at once */
#define RAA_BLKSIZE 32768 /* this many longs allocated at once */
#define RAA_LAYERSIZE 32768 /* this many _pointers_ allocated */
typedef struct RAA RAA;
@ -239,7 +239,7 @@ struct RAA {
int32_t stepsize;
union RAA_UNION {
struct RAA_LEAF {
int32_t data[RAA_BLKSIZE];
int64_t data[RAA_BLKSIZE];
} l;
struct RAA_BRANCH {
struct RAA *data[RAA_LAYERSIZE];
@ -249,8 +249,8 @@ struct RAA {
struct RAA *raa_init(void);
void raa_free(struct RAA *);
int32_t raa_read(struct RAA *, int32_t);
struct RAA *raa_write(struct RAA *r, int32_t posn, int32_t value);
int64_t raa_read(struct RAA *, int32_t);
struct RAA *raa_write(struct RAA *r, int32_t posn, int64_t value);
/*
* Routines to manage a dynamic sequential-access array, under the