Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch detection #29

Open
williballenthin opened this issue Jan 2, 2019 · 4 comments
Open

switch detection #29

williballenthin opened this issue Jan 2, 2019 · 4 comments

Comments

@williballenthin
Copy link
Owner

samples:

  • cc688ff3a525bac5e1241d13fae8d97a:10001EA1
@williballenthin
Copy link
Owner Author

32-bit added in 3e378a4

@williballenthin
Copy link
Owner Author

williballenthin commented Jun 25, 2019

in mimi64, function 0x140056250 has a massive switch jmp at 0x1400562BF

image

@williballenthin
Copy link
Owner Author

some programs will place the jump tables contiguously, so need to be able to detect if the targets are already part of a prior jump table. if this is the case, then we need to remove the existing references.
likewise, we should stop reading a jump table when encountering entries that already have references.

for example, given the following:

  jtable_1:
    j1
    j2
    j3
    j4
  jtable_2:
    j5
    j6
    j7
    j8

the cases:

  1. consider that jtable_1 is already defined, and we want to now add jtable_2. need to remove the entries j5 - j8 from jtable_1 and add them to jtable_2.
  2. consider that jtable_2 is already defined and we want to now add jtable_1. need to add only up to j4 and not continue across j5 and above.

note: we could probably have these two cases happening at the same time (a sandwich). so, we probably want to find the end of the logical array first, then find any prior tables, and finally update/add the xrefs.

@williballenthin
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant