From ed12eaf7ccb7e4d903b1b8b1ee98a6d0194647bf Mon Sep 17 00:00:00 2001 From: Matthias Hopf Date: Mon, 30 Jul 2007 13:05:28 +0200 Subject: Check for register sizes (32bit only ATM). Fix MM reg numbers. --- .gitignore | 4 ++++ indices.c | 20 +++++++++++++++++--- main.c | 8 ++++---- 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f257a3f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.o +atomdis +atombios.h +datastructs_gen.c diff --git a/indices.c b/indices.c index 3ac6a0a..a4d2d14 100644 --- a/indices.c +++ b/indices.c @@ -104,7 +104,7 @@ void index_load_registers (const char *file) FILE *f; char buf[512], kind[32], offset[32]; char *c, *d, *e, *name = NULL, *namefree = NULL; - int len, id, nr; + int len, id, nr, size = 0; if (! (f = fopen (file, "r")) ) { perror (file); @@ -117,6 +117,9 @@ void index_load_registers (const char *file) free (namefree); name = namefree = strndup (d+7, e-d-7); } + size = 0; + if ( (d = strstr (c, " size=\"")) ) + size = strtol (d+7, NULL, 0); } if ( (c = strstr (buf, ">= 2; + else + continue; + } if (index_tables[id].len <= nr || ! index_tables[id].tab) { len = (nr + 0x1f) & -0x20; if (len <= 0) @@ -155,9 +166,12 @@ void index_load_registers (const char *file) index_tables[id].len = len; } if (index_tables[id].tab[nr]) { - fprintf (stderr, "Register %s already present: %s for offset %04x in table %s\n", - name, index_tables[id].tab[nr], nr, index_tables[id].name); + fprintf (stderr, "Register clash: %04x = %s = %s in table %s\n", + nr, name, index_tables[id].tab[nr], index_tables[id].name); } else { +#if 0 + fprintf (stderr, " %s = %04x [%02x]\n", name, nr, size); +#endif index_tables[id].tab[nr] = name; namefree = NULL; } diff --git a/main.c b/main.c index 5f22a22..32774b3 100644 --- a/main.c +++ b/main.c @@ -214,8 +214,6 @@ int sub_dest (uint8_t *d, char *out, int type, int align, int size, int index) { } if (type == D_WS && (ind = get_index (INDEX_WORK_REG, val)) ) out += sprintf (out, "%s", ind); - else if (type == D_REG && (ind = get_index (last_reg_index, val+last_reg_offset)) ) - out += sprintf (out, "%04x=%s", val, ind); else if (r) out += sprintf (out, addrtypes [type], val); switch (size) { @@ -229,6 +227,8 @@ int sub_dest (uint8_t *d, char *out, int type, int align, int size, int index) { out += sprintf (out, " [%s]", align_long[align]); break; } + if (type == D_REG && (ind = get_index (last_reg_index, val+last_reg_offset)) ) + out += sprintf (out, " (%s)", ind); if (r && (ind = get_index (index, val)) ) out += sprintf (out, " (%s)", ind); return r; @@ -263,12 +263,12 @@ int sub_src (uint8_t *d, char *out, int type, int align, int size, int index) { } else if (type == D_WS && (ind = get_index (INDEX_WORK_REG, val)) ) { out += sprintf (out, "%s", ind); out += sprintf (out, " [%s]", align_source[align]); - } else if (type == D_REG && (ind = get_index (last_reg_index, val+last_reg_offset)) ) { - out += sprintf (out, "%04x=%s", val, ind); } else { out += sprintf (out, addrtypes [type], val); out += sprintf (out, " [%s]", align_source[align]); } + if (type == D_REG && (ind = get_index (last_reg_index, val+last_reg_offset)) ) + out += sprintf (out, " (%s)", ind); if ( (ind = get_index (index, val)) ) out += sprintf (out, " (%s)", ind); return r; -- cgit v1.2.3