WaxfordSqueers
March 26th, 2006, 06:36
I apologize for the length and rambling nature of the following post
but I feel both are necessary. I would appreciate helpful comments on how to proceed, or on my immediate problem of getting IDA to load a DOS file correctly.
I realize this is off-topic in most aspects but there is one angle I would like to pursue that is right up our alley. Modern hard drives use code in two places: one place is in the processor chip and the other is on the disk itself on a platter. This firmware, or microcode, is used to run the processor and to govern all aspects of reading/writing to disk as well has head positioning and the spindle motor.
One problem is that the drive has a diagnostic routine it goes through before making itself available to the motherboard BIOS. If it doesn't complete that diagnostic because of damaged firmware on the disk, it will sit there ticking and wont be recognized by the BIOS. Apparently damaged firmware is a major cause of hard drive failure, on some brands in particular.
I am an electronics technician and have repaired hard drives in the old days. I read this thread with some interest and horror: http://www.woodmann.com/forum/showthread.php?t=7301&highlight=hard+drive. My interest came from hearing that people have opened the head chamber and got the drive working again, There is a feeling out there akin to paranoia that opening the head chamber is the kiss of death. My horror came hearing about people tapping on the heads while the drive is spinning, etc. You just don't do that. If that head touches down, it's game over. It's only flying a few thou above the surface.
Anyway, I would like to reverse the firmware in the main processor to gain more control over the disk operation. Most hard drives have a 'safe mode' that can be entered by using an extra jumper on the master/slave select pins. In safe mode, the start up routines are apparently bypassed, although I haven't tried that yet. There is another jumper for 'factory mode' which needs some serious looking at.
BTW...access to the processor is governed by the ATA standards which are freely available. You can interrogate it and hopefully make it cough up it's firmware, then put it back in an amended form.
I have a piece of software put out by a computer company to correct issues in the firmware of an older 10 gig drive. I am theorizing that the software must address the disk processor to change it's firmware and all of that code should be available in this software. I need to reverse this software, which creates a floppy, and integrates a firmware binary into the floppy boot process somehow.
The program is a 16 bit DOS app, so I am reviewing DOS. I'm somewhat stymied right now because I'm using IDA and it does not create proper segments for the DOS app. In the DOS header, there is a double-word that specifies the initial CS:IP as 129C:0001. In IDA, it shows up as SEG 0:000229D0, and this seg is right at the end of the disassembly. It's easy to see that the correct address segment of 129C is pretty close to the 229D0 of IDA, but it's displaced by 20010 bytes.
I realize there's a difference between the CS:IP specified in the file header and the disassembly. IDA has flagged a lot of code as data, however, and I'd like to amend that. I'd like to also arrange the disassembly with it's proper segments. Is that possible and where is that information in a DOS file?
I've had a lot of frustration trying to manipulate the segments in IDA. It keeps asking for a base address but does not explain it very well. Given that the file is an exe file, it would presumably have more than one 64K segment. Then again, I'm confusing the DOS format with the format of the NE file which uses similar segmentation. Can someone shed some light on this?
I've never really understood the relocatability of segments in DOS and NE files. That's probably what's bugging me now but I've spent so much time trying to visualize the reasoning behind it and I still don't get it. I understand the offset clearly but it's the notion that the CS part can take on other values that stumps me. Obviously, IDA felt OK about relocating it to 0:000229D0 when the app itself specified 129C as it's base.
It seems to me I should load it into IDA without segments and create my own. If I enter 000129C0 as it's base, it will start yapping about a negative offset.
Before someone berates me for not doing a proper search, let me assure you that I've done a lifetime of research on hard drives alone in the past few weeks. I have been furiously translating Russian and Chinese text, and my head hurts. I have spent a good deal of time on this DOS problem, both on the net and in this forum. I read one article in the forum on this kind of segmentation but it didn't turn on a light. There seems to be pitifully little left on the net about DOS other than cursory outlines.
There was an article I read once in this forum by someone who was working with microcontrollers. It would be nice to converse with someone who understood the ins and outs of them vis-a-vis the firmware, with the reversing of it as an aim.
but I feel both are necessary. I would appreciate helpful comments on how to proceed, or on my immediate problem of getting IDA to load a DOS file correctly.
I realize this is off-topic in most aspects but there is one angle I would like to pursue that is right up our alley. Modern hard drives use code in two places: one place is in the processor chip and the other is on the disk itself on a platter. This firmware, or microcode, is used to run the processor and to govern all aspects of reading/writing to disk as well has head positioning and the spindle motor.
One problem is that the drive has a diagnostic routine it goes through before making itself available to the motherboard BIOS. If it doesn't complete that diagnostic because of damaged firmware on the disk, it will sit there ticking and wont be recognized by the BIOS. Apparently damaged firmware is a major cause of hard drive failure, on some brands in particular.
I am an electronics technician and have repaired hard drives in the old days. I read this thread with some interest and horror: http://www.woodmann.com/forum/showthread.php?t=7301&highlight=hard+drive. My interest came from hearing that people have opened the head chamber and got the drive working again, There is a feeling out there akin to paranoia that opening the head chamber is the kiss of death. My horror came hearing about people tapping on the heads while the drive is spinning, etc. You just don't do that. If that head touches down, it's game over. It's only flying a few thou above the surface.
Anyway, I would like to reverse the firmware in the main processor to gain more control over the disk operation. Most hard drives have a 'safe mode' that can be entered by using an extra jumper on the master/slave select pins. In safe mode, the start up routines are apparently bypassed, although I haven't tried that yet. There is another jumper for 'factory mode' which needs some serious looking at.
BTW...access to the processor is governed by the ATA standards which are freely available. You can interrogate it and hopefully make it cough up it's firmware, then put it back in an amended form.
I have a piece of software put out by a computer company to correct issues in the firmware of an older 10 gig drive. I am theorizing that the software must address the disk processor to change it's firmware and all of that code should be available in this software. I need to reverse this software, which creates a floppy, and integrates a firmware binary into the floppy boot process somehow.
The program is a 16 bit DOS app, so I am reviewing DOS. I'm somewhat stymied right now because I'm using IDA and it does not create proper segments for the DOS app. In the DOS header, there is a double-word that specifies the initial CS:IP as 129C:0001. In IDA, it shows up as SEG 0:000229D0, and this seg is right at the end of the disassembly. It's easy to see that the correct address segment of 129C is pretty close to the 229D0 of IDA, but it's displaced by 20010 bytes.
I realize there's a difference between the CS:IP specified in the file header and the disassembly. IDA has flagged a lot of code as data, however, and I'd like to amend that. I'd like to also arrange the disassembly with it's proper segments. Is that possible and where is that information in a DOS file?
I've had a lot of frustration trying to manipulate the segments in IDA. It keeps asking for a base address but does not explain it very well. Given that the file is an exe file, it would presumably have more than one 64K segment. Then again, I'm confusing the DOS format with the format of the NE file which uses similar segmentation. Can someone shed some light on this?
I've never really understood the relocatability of segments in DOS and NE files. That's probably what's bugging me now but I've spent so much time trying to visualize the reasoning behind it and I still don't get it. I understand the offset clearly but it's the notion that the CS part can take on other values that stumps me. Obviously, IDA felt OK about relocating it to 0:000229D0 when the app itself specified 129C as it's base.
It seems to me I should load it into IDA without segments and create my own. If I enter 000129C0 as it's base, it will start yapping about a negative offset.
Before someone berates me for not doing a proper search, let me assure you that I've done a lifetime of research on hard drives alone in the past few weeks. I have been furiously translating Russian and Chinese text, and my head hurts. I have spent a good deal of time on this DOS problem, both on the net and in this forum. I read one article in the forum on this kind of segmentation but it didn't turn on a light. There seems to be pitifully little left on the net about DOS other than cursory outlines.
There was an article I read once in this forum by someone who was working with microcontrollers. It would be nice to converse with someone who understood the ins and outs of them vis-a-vis the firmware, with the reversing of it as an aim.