Unusual Question

Polytropon freebsd at edvax.de
Fri Jul 14 07:47:30 UTC 2017


On Thu, 13 Jul 2017 23:11:41 -0700, Doug Hardie wrote:
> 
> > On 13 July 2017, at 21:44, David Christensen <dpchrist at holgerdanske.com> wrote:
> > If the machine has BIOS and the system drive isn't too large,
> > write an assembly program that fits into the MBR bootstrap code
> > area to wipe the rest of the drive, assemble the program, write
> > it into the MBR, and reboot.
> > 
> > 
> > Bonus: the program deletes the MBR when done wiping the rest of the drive.
> 
> Neat idea, but I have a number of these systems and they all use
> different disk drives.  That would be a lot of work writing drivers
> for each type.

If the machines have BIOS, you can use BIOS interrupt calls
which should be the same for all drives, comparable to the
biosdisk() DOS functions. Let's see if I can get the basics
together... you'd basically do something like this:

	biosdisk(0x03, 0x80, h, c, s, 1, (void *)crap);

0x03 is "write", 0x80 is 1st disk detected by BIOS; h, c, s
is the head / cylinder / sector address of where you want to
write to; 1 is the amount of blocks to write, and crap is a
pointer to a vector of unsigned char, for example 512 bytes,
the size of a block (addressed by h / c / s, where 0 / 0 / 1
is the starting location of the MBR), containing some random
crap (or NULs) you want to write.

The translation to assembly is left to the shocked reader. :-)

Sources:

http://www.digitalmars.com/rtl/bios.html#biosdisk

https://en.wikipedia.org/wiki/BIOS_interrupt_call

What terrible memories it recalls... ;-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list