|
RomRaider
Documentation
Community
Developers
|
| Author |
Message |
|
fujiillin
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Fri Apr 03, 2009 8:29 pm |
|
 |
| Experienced |
 |
Joined: Wed Feb 13, 2008 3:00 am Posts: 153
|
I also check the 'perform final pass' button in there for doing the vbr stuff. My issue with adding a RAM section was some issue with virtual addressing, although it could just be operator failure  .
_________________ 06 Wrx Wagon 2.3 longrod in the works
|
|
| Top |
|
 |
|
nsfw
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Sat Apr 04, 2009 6:53 am |
|
 |
| Moderator |
Joined: Thu Nov 23, 2006 2:23 am Posts: 2565
|
EDIT: Attachment removed, better version here: viewtopic.php?f=32&t=6234-- I've attached a small executable that will convert ecu and logger definitions to an IDC file, which creates a bunch of names that will (I hope) make the code easier to follow. I'll post the source as soon as ".cs" becomes an allowed file extension. Save a backup of your project before you apply these names. I think this works correctly but I'd like to hear some confirmation of that from people who know enough to say for sure.  It supports tables and extended parameters. I'd like it to support standard parameters too but I need to know more about how those work. I get the impression that there's probably a contiguous array where the ECU copies all of the standard SSM parameters, but I don't know where that array starts in memory. If I'm right about how that works, and if someone can explain how to find the base of the array, I can teach this utility to generate names for standard parameters as well. You must have ecu_defs.xml, logger.xml, and logger.dtd in the current directory when you run this. Usage: XmlToIdc.exe <ecu-id> Where <ecu-id> is your ECU identifier, e.g. A2WC510N You'll want to redirect stdout to a file. So, for example: Code: XmlToIdc.exe A2WC510N > Definition.idc Notice the function name at the top of the .idc file. Import the file into IDA (File, "IDC file..."), then invoke that function (File, "IDC command...").
_________________ 2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!
Last edited by nsfw on Sun Jun 20, 2010 8:10 am, edited 1 time in total.
|
|
| Top |
|
 |
|
merchgod
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Sat Apr 04, 2009 11:34 am |
|
 |
| RomRaider Donator |
 |
Joined: Thu Mar 30, 2006 2:38 am Posts: 5336
|
|
let me know the rom id that are you running and I'll tell you the address of the SSM look-up table.
|
|
| Top |
|
 |
|
fujiillin
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Sat Apr 04, 2009 11:57 am |
|
 |
| Experienced |
 |
Joined: Wed Feb 13, 2008 3:00 am Posts: 153
|
|
Great work!! Just got it running after installing .NET and it's working great!
One exception, when opening the A8DH201X, the rom inherits all tables from a A8DH200X, but the program didn't pick up on it, and the tables are blank. I can run it for the 200X to find them, but I thought you would want to know.
This will really make things much easier for patching.
Merch, how can one find the SSM base address for a particular rom? I'm working on a few 32bit roms, don't want to bug you every time I start a new one. If that doesn't bother you, a8dh201x a2zje11j a2zj710j.
_________________ 06 Wrx Wagon 2.3 longrod in the works
|
|
| Top |
|
 |
|
merchgod
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Sat Apr 04, 2009 12:15 pm |
|
 |
| RomRaider Donator |
 |
Joined: Thu Mar 30, 2006 2:38 am Posts: 5336
|
|
find the ecu id and go to the xref of the start of the id. Then search for the address to the function. The first byte of the ecu id would be index position 0x1 in the SSM look up table.
For example, A8DH200X/201X, 0x56264 would be the SSM base address. Find the index position in the logger defs of a particular parameter (address node). So, for example, ECT is 0x8, so 0x56264+(0x8*0x4) = 0x56284.
|
|
| Top |
|
 |
|
fujiillin
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Sat Apr 04, 2009 12:24 pm |
|
 |
| Experienced |
 |
Joined: Wed Feb 13, 2008 3:00 am Posts: 153
|
|
Found it, thanks!
_________________ 06 Wrx Wagon 2.3 longrod in the works
|
|
| Top |
|
 |
|
nsfw
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Sat Apr 04, 2009 5:08 pm |
|
 |
| Moderator |
Joined: Thu Nov 23, 2006 2:23 am Posts: 2565
|
|
Thanks for the details merchgod, that's what I needed to know. I'll add the SSM vector address as a parameter to the utility, and then it'll generate names for standard parameters as well.
Thanks for the bug report, fujilin. My car inherits from 32bitbase, so I never ran into that. If it's sufficient to run the utility again with the 2nd ROM id, I'll just leave it as-is. I will see if I can print out the base id though so it will be easier to know when it needs to be re-run.
_________________ 2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!
|
|
| Top |
|
 |
|
nsfw
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Sat Apr 04, 2009 7:42 pm |
|
 |
| Moderator |
Joined: Thu Nov 23, 2006 2:23 am Posts: 2565
|
|
Merchgod, I'm having trouble following your description of how to find the SSM vector base. I'm looking at the A2WC510N image.
The ecuid string is in memory at address 0xC0000. There are three xrefs... One xref (off_48bc8) goes to an item in a list of about a dozen ".data.l" pointers in between two functions (I gather that sections like these are basically values used in the code above.) The other two xrefs are just a few bytes apart, 0x83350 and 0x8335C, which are floating in a sea of .data.l stuff.
The first xref seems the most promising, but as far as I can tell it's only used in a routine that copies the ID to a location near the end of RAM. What am I overlooking?
I should add that I looked at the A8DH200X image too, and other than both having the literal in the same place (0xC0000) they seem pretty different. But I don't see how to find the SSM base in that image either (without copying it from your post earlier - but that's cheating).
_________________ 2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!
|
|
| Top |
|
 |
|
merchgod
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Sat Apr 04, 2009 11:15 pm |
|
 |
| RomRaider Donator |
 |
Joined: Thu Mar 30, 2006 2:38 am Posts: 5336
|
|
You are mixing up the cal id with the ecu id. The cal id (rom id) would be A2WC510N while the ECU ID would be 2F12785206
|
|
| Top |
|
 |
|
fujiillin
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Sat Apr 04, 2009 11:16 pm |
|
 |
| Experienced |
 |
Joined: Wed Feb 13, 2008 3:00 am Posts: 153
|
|
Yep, I found it by doing a binary pattern search for the ssm ecu id. Ex: on the a8dh201x, the id is listed as 431258410600. A search for 43125841 gives the location 0xCFB8C. Follow the first xref to 0x4E63C, which is used in sub_4E4A4. Follow the xref on that sub back to 0x56268 and you have the SSM address for the ecu id.
_________________ 06 Wrx Wagon 2.3 longrod in the works
|
|
| Top |
|
 |
|
fujiillin
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Sun Apr 05, 2009 2:55 pm |
|
 |
| Experienced |
 |
Joined: Wed Feb 13, 2008 3:00 am Posts: 153
|
Here's a batch file for running the program: Code: @ECHO off :input set /P INPUT=Type ROM CALID **ENTER IN UPPERCASE** : %=% if "%INPUT%"=="" goto input echo Your input was: %INPUT% set QUE= set /P QUE=Press n to change: %=% if "%QUE%"=="n" goto input XmltoIdc.exe %INPUT% > %INPUT%.idc echo Output saved as %INPUT%.idc, Check file for proper table inheritance. set RUN= set /P RUN=Press y to run again: %=% if "%RUN%"=="y" goto input
Regarding the SSM stuff. I take it there's no way to determine the base address with the defs, so maybe just add it as an input option to the XmltoIdc.exe?
You do not have the required permissions to view the files attached to this post.
_________________ 06 Wrx Wagon 2.3 longrod in the works
|
|
| Top |
|
 |
|
nsfw
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Mon Apr 06, 2009 7:49 am |
|
 |
| Moderator |
Joined: Thu Nov 23, 2006 2:23 am Posts: 2565
|
|
Thanks, guys. I found the ecu id in memory at CD7A0, xref'd to 48E84, used in sub_48CAA, which xrefs to 4ECD4, which seems to be the base of the SSM array.
I was assuming there would be an array of values in memory at that address, but apparently it's more like an array of function pointers. So the SSM code interprets the SSM parameter ID as an offset into this pointer array, then invokes the appropriate subroutine, and it's the subroutine that copies the desired data (or a pointer to it?) into a register before RTSing. I think I found the code that does array indexing and the subroutine call, but what puzzles me is that many of the entries in the SSM array have the same value (addresses of the same subroutine).
In other words, it looks like the names for the "(base + (4 * parameter_id))" addresses would be "GetParameterFoo" rather than "ParameterFoo."
Am I reading the code correctly?
_________________ 2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!
|
|
| Top |
|
 |
|
tinywrex
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Mon Apr 06, 2009 9:05 am |
|
 |
| Newbie |
Joined: Sun Feb 12, 2006 7:10 am Posts: 90
|
NSFW wrote: Thanks, guys. I found the ecu id in memory at CD7A0, xref'd to 48E84, used in sub_48CAA, which xrefs to 4ECD4, which seems to be the base of the SSM array.
I was assuming there would be an array of values in memory at that address, but apparently it's more like an array of function pointers. So the SSM code interprets the SSM parameter ID as an offset into this pointer array, then invokes the appropriate subroutine, and it's the subroutine that copies the desired data (or a pointer to it?) into a register before RTSing. I think I found the code that does array indexing and the subroutine call, but what puzzles me is that many of the entries in the SSM array have the same value (addresses of the same subroutine).
In other words, it looks like the names for the "(base + (4 * parameter_id))" addresses would be "GetParameterFoo" rather than "ParameterFoo."
Am I reading the code correctly? spot on. Why are you puzzled by the usage of the same subroutine pointer It will be used to return a value for the UNsupported parameters 
|
|
| Top |
|
 |
|
merchgod
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Mon Apr 06, 2009 12:56 pm |
|
 |
| RomRaider Donator |
 |
Joined: Thu Mar 30, 2006 2:38 am Posts: 5336
|
NSFW wrote: Thanks, guys. I found the ecu id in memory at CD7A0, xref'd to 48E84, used in sub_48CAA, which xrefs to 4ECD4, which seems to be the base of the SSM array.
I was assuming there would be an array of values in memory at that address, but apparently it's more like an array of function pointers. So the SSM code interprets the SSM parameter ID as an offset into this pointer array, then invokes the appropriate subroutine, and it's the subroutine that copies the desired data (or a pointer to it?) into a register before RTSing. I think I found the code that does array indexing and the subroutine call, but what puzzles me is that many of the entries in the SSM array have the same value (addresses of the same subroutine).
In other words, it looks like the names for the "(base + (4 * parameter_id))" addresses would be "GetParameterFoo" rather than "ParameterFoo."
Am I reading the code correctly? Remember, that the ECU performs a narrowing conversion on most of the SSM parameters (most are 1-byte, some are 2-byte like MAF and RPM). That is why it is a series of functions. Also, some are calculations based on two variables -> ex. manifold relative pressure (MAP - atmos. pressure) and IPW1 (ipw1 + latency). Not every parameter is supported by every ECU and some index positions are saved for future use which is why you'll see the same function repeated (returns 0xFF for example). The ECU init is used by the SSM tool to determine which parameters are supported by the connected ECU (RR does the same thing).
|
|
| Top |
|
 |
|
nsfw
|
Post subject: Re: 32-bit Disassembly in IDA Posted: Mon Apr 06, 2009 3:59 pm |
|
 |
| Moderator |
Joined: Thu Nov 23, 2006 2:23 am Posts: 2565
|
|
Thanks guys, this makes sense now.
_________________ 2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!
|
|
| Top |
|
 |
Who is online |
Users browsing this forum: No registered users and 11 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|