summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Hopf <mhopf@suse.de>2007-07-30 13:05:28 +0200
committerMatthias Hopf <mhopf@suse.de>2007-07-30 13:05:28 +0200
commited12eaf7ccb7e4d903b1b8b1ee98a6d0194647bf (patch)
tree71252a621ba1f8e80cce1f8d6f05fedb167ea708
parentb95462db32967033ff098fce5b53430b4b04a082 (diff)
Check for register sizes (32bit only ATM). Fix MM reg numbers.
-rw-r--r--.gitignore4
-rw-r--r--indices.c20
-rw-r--r--main.c8
3 files changed, 25 insertions, 7 deletions
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, "<addr ")) ) {
kind[0] = offset[0] = 0;
@@ -143,6 +146,14 @@ void index_load_registers (const char *file)
else
continue;
nr = strtol (offset, NULL, 0);
+ if (size != 32)
+ continue; /* TODO: 8-bit MM */
+ if (id == INDEX_REG_MM) {
+ if (! (nr & 3))
+ nr >>= 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;