Skip to content
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Showing with 74 additions and 15 deletions.
  1. +2 −2 rnn/demmt.c
  2. +1 −1 rnn/demmt.h
  3. +1 −1 rnn/demmt_objects.c
  4. +69 −11 rnn/demmt_pushbuf.c
  5. +1 −0 rnn/demmt_pushbuf.h
View
4 rnn/demmt.c
@@ -56,7 +56,7 @@ int invalid_pushbufs_visible = 1;
int decode_invalid_buffers = 1;
int find_ib_buffer = 0;
int quiet = 0;
-int disassembly_shaders = 1;
+int disassemble_shaders = 1;
const struct envy_colors *colors = NULL;
static void dump(struct buffer *buf)
@@ -1149,7 +1149,7 @@ int main(int argc, char *argv[])
else if (!strcmp(argv[i], "-q"))
quiet = 1;
else if (!strcmp(argv[i], "-a"))
- disassembly_shaders = 0;
+ disassemble_shaders = 0;
else if (!strcmp(argv[i], "-c"))
colors = &envy_def_colors;
else
View
2 rnn/demmt.h
@@ -6,7 +6,7 @@
#define MMT_DEBUG 0
extern int find_ib_buffer;
extern int quiet;
-extern int disassembly_shaders;
+extern int disassemble_shaders;
extern const struct envy_colors *colors;
#define mmt_debug(fmt, ...) do { if (MMT_DEBUG) fprintf(stderr, fmt, __VA_ARGS__); } while (0)
View
2 rnn/demmt_objects.c
@@ -65,7 +65,7 @@ static const struct disisa *isa_nvc0 = NULL;
void demmt_parse_command(uint32_t class_, int mthd, uint32_t data)
{
- if (!disassembly_shaders)
+ if (!disassemble_shaders)
return;
if (class_ == 0x9197) // NVC1_3D
View
80 rnn/demmt_pushbuf.c
@@ -119,7 +119,9 @@ static void decode_header(struct pushbuf_decode_state *state, uint32_t data, cha
state->size, state->subchan, (obj ? obj->handle : 0), state->addr,
(state->incr ? "increment" : "constant"));
else
- output[0] = 0;
+ sprintf(output, "size ?, subchannel %d (object handle 0x%x), offset 0x%04x, %s",
+ state->subchan, (obj ? obj->handle : 0), state->addr,
+ (state->incr ? "increment" : "constant"));
}
static void decode_method(struct pushbuf_decode_state *state, uint32_t data, char *output)
@@ -209,12 +211,13 @@ void pushbuf_decode(struct pushbuf_decode_state *state, uint32_t data, char *out
int type = (data & 0x30000) >> 16;
if (type != 0)
{
- state->incr = 0;//?
state->size = 0;
- sprintf(output, "SLI %d", type);
- //TODO: decode fully
- if (addr)
- *addr = state->addr;
+ if (type == 1)
+ sprintf(output, "SLI cond, mask: 0x%x", (data & 0xfff0) >> 4);
+ else if (type == 2)
+ sprintf(output, "SLI user mask store: 0x%x", (data & 0xfff0) >> 4);
+ else if (type == 3)
+ sprintf(output, "SLI cond from user mask");
return;
}
@@ -245,17 +248,72 @@ void pushbuf_decode(struct pushbuf_decode_state *state, uint32_t data, char *out
}
else
{
- if (data & 0x20000000)
+ if (state->long_command)
{
- sprintf(output, "# jump to 0x%x", data & 0x1fffffff);
- state->skip = 1;
+ state->size = data & 0xffffff;
+ state->long_command = 0;
+ sprintf(output, "size %d", state->size);
+ if (addr)
+ *addr = state->addr;
return;
}
- state->addr = data & 0x1fff;
+ int mode = (data & 0xe0000000) >> 29;
+ state->addr = data & 0x1ffc;
state->subchan = (data & 0xe000) >> 13;
state->size = (data & 0x1ffc0000) >> 18;
- state->incr = data & 0x40000000 ? 0 : state->size;
+
+ if (mode == 0)
+ {
+ if (data & 0x3)
+ mmt_log("bottom 2 bits are not 0 as supposed: %d\n", data & 3);
+ int type = (data & 0x30000) >> 16;
+ if (type == 0)
+ state->incr = state->size;
+ else if (type == 1)
+ {
+ state->size = 0;
+ sprintf(output, "SLI cond, mask: 0x%x", (data & 0xfff0) >> 4);
+ return;
+ }
+ else if (type == 2)
+ {
+ state->size = 0;
+ sprintf(output, "return");
+ return;
+ }
+ else if (type == 3)
+ {
+ state->incr = 0;
+ state->size = 0;
+ state->long_command = 1;
+ }
+ }
+ else if (mode == 1)
+ {
+ if (data & 0x3)
+ mmt_log("bottom 2 bits are not 0 as supposed: %d\n", data & 3);
+ sprintf(output, "jump (old) to 0x%x", data & 0x1ffffffc);
+ return;
+ }
+ else if (mode == 2)
+ {
+ if (data & 0x3)
+ mmt_log("bottom 2 bits are not 0 as supposed: %d\n", data & 3);
+ state->incr = 0;
+ }
+ else
+ {
+ int type = data & 0x3;
+ if (type == 1)
+ sprintf(output, "jump to 0x%x", data & 0xfffffffc);
+ else if (type == 2)
+ sprintf(output, "call 0x%x", data & 0xfffffffc);
+ else
+ sprintf(output, "unknown type %d", type);
+ state->size = 0;
+ return;
+ }
}
decode_header(state, data, output);
View
1 rnn/demmt_pushbuf.h
@@ -12,6 +12,7 @@ struct pushbuf_decode_state
int skip;
int pushbuf_invalid;
int next_command_offset;
+ int long_command;
};
struct ib_decode_state

No commit comments for this range

Something went wrong with that request. Please try again.