Replies: 1 comment 4 replies
-
Thanks for chipping in on this architecture, Peter! I haven't had time to delve in to Keil's generated code very deeply. I've also worked out at least some of the details for a number of record types that Keil added to the OMF-51 object file format. Most of that work, though, is on a private lab network, and is only gradually being integrated into our Ghidra OMF-51 loader. In my own repo I've also got a branch for the changes to the 8051 language files to better handle the Silicon Labs CIP-51 core architecture. That has been moving a little more slowly than the loader. Whatever degree of familiarity you have with Keil generated code and/or Keil-specific addtions to OMF-51 may be helpful in both these areas. But we can discuss that elsewhere/else-when. |
Beta Was this translation helpful? Give feedback.
-
I'm doing some work on the 8051 support and I'm trying to get a good decompilation of Keils CCASE construct.
For those unaware, Keil will replace some switch statements with a call to CCASE, with a lookup table immediately following the call. This table contains an arbitary length list of 3 byte records with the format:
The table is terminated with a zeroed handler address, then a default handler address.
My first attempt was to create this call fixup:
Which produces output like this (from Keils _PRINTF implementation):
This is certainly better than nothing, it's now at least clear what's happening, but it would be nice to get the switch statement appearing properly.
After looking at the SwitchOverride script I then tried this script to create overrides:
And I get this:
Again, better - but now I need to get rid of the loop and have the values as cases rather than the address.
So I figured now would be a good point to take a step back and reach out for some advice. Am I going about this the right way? Is what I'm trying to do possible with the current state of Ghidra? Is this already a solved problem? Where should I go from here?
I'd be grateful for any feedback/advice.
Beta Was this translation helpful? Give feedback.
All reactions