Permalink
Browse files

demmt: hacky IB trick detection

Blob writes M2MF header, switches to another buffer for M2MF.DATA and then
switches back for next commands, so we incorrectly use those commands
as M2MF.DATA. Without proper IB detection there's not much we can do other
than hacks like this one.

IB support will come later.
  • Loading branch information...
1 parent edc77d8 commit fb901f3cba27c6e2c496892a9e4a893b8c113faa @mslusarz mslusarz committed Jul 4, 2014
Showing with 15 additions and 0 deletions.
  1. +4 −0 rnn/demmt.c
  2. +1 −0 rnn/demmt.h
  3. +10 −0 rnn/demmt_pushbuf.c
View
@@ -68,6 +68,7 @@ int chipset;
int guess_invalid_pushbuf = 1;
int invalid_pushbufs_visible = 1;
int decode_invalid_buffers = 1;
+int m2mf_hack_enabled = 0;
static void dump(int id)
{
@@ -804,6 +805,7 @@ static void usage()
" -i\t\tdo not guess invalid pushbufs\n"
" -d\t\thide invalid pushbufs\n"
" -e\t\tdo not decode invalid pushbufs\n"
+ " -b\t\tenable hacky IB trick detection, will be removed when proper IB support lands\n"
"\n");
exit(1);
}
@@ -833,6 +835,8 @@ int main(int argc, char *argv[])
invalid_pushbufs_visible = 0;
else if (!strcmp(argv[i], "-e"))
decode_invalid_buffers = 0;
+ else if (!strcmp(argv[i], "-b"))
+ m2mf_hack_enabled = 1;
else
usage();
}
View
@@ -11,5 +11,6 @@ extern struct rnndomain *domain;
extern struct rnndb *rnndb;
extern int chipset;
extern int guess_invalid_pushbuf;
+extern int m2mf_hack_enabled;
#endif
View
@@ -255,6 +255,16 @@ void pushbuf_decode(struct pushbuf_decode_state *state, uint32_t data, char *out
mmt_log("subchannel %d does not have bound object and first command does not bind it, marking this buffer invalid\n", state->subchan);
state->pushbuf_invalid = 1;
}
+
+ // XXX HACK
+ if (m2mf_hack_enabled &&
+ subchans[state->subchan] && subchans[state->subchan]->handle == 0x9039 &&
+ state->addr == 0x0304 && state->incr == 0)
+ {
+ mmt_log("IB trick detected, assuming next word after this one is NOT M2MF.DATA%s\n", "");
+ state->size = 0;
+ }
+ // XXX END HACK
}
else
{

0 comments on commit fb901f3

Please sign in to comment.