History log of /openbsd-current/sys/arch/i386/stand/libsa/diskprobe.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.49 04-Jun-2024 krw

Enable hibernate/resume to nvme(4) disks with 4096 byte sectors.

testing by florian@ mglocker@ mlarkin@

ok deraadt@ mglocker@ mlarkin@


Revision tags: OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.48 01-Sep-2022 krw

Stop setting d_bbsize and d_sbsize. Nobody has paid
any attention for some time.

ok otto@ as part of larger diff


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.47 09-Dec-2020 krw

Use daddr_t and not daddr32_t in boot media.

At a minimum, amd64/i386 should now boot from 4TB GPT formatted disks.

More daddr32_t terminations with extreme prejudice to follow.

Tested by various, in snaps for a few days.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.46 18-Jun-2018 krw

"a = 1; b = 100; c = a * b; if (c == 0) c = 100;"

is pretty silly. Nuke the if's.

ok millert@


Revision tags: OPENBSD_6_3_BASE
# 1.45 18-Dec-2017 fcambus

Add sizes for free() in libsa for amd64 and i386.

OK tom@, deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.44 21-Jul-2017 yasuoka

Check the hibernation signature for softraid disks and select valid bsd
for unhibernation. reported by Natasha Kerensikova. tested by Theo Buehler.

ok deraadt


# 1.43 22-Jun-2017 deraadt

Only print the magic '&' letter on a disk if the hibernate partition is
valid. This is an undocumented little debugging diagnostic, much like
the '*'.


# 1.42 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


Revision tags: OPENBSD_6_1_BASE
# 1.41 11-Sep-2016 jsing

Rename softraid boot files, which are currently in an MD location. This
will allow us to bring in a MI softraid.{c,h} in lib/libsa.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.40 02-Sep-2015 yasuoka

Bring the boot changes on amd64 to i386. alloca is deleted.
Also fix the boot from BIOS and bump the version.

input and ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.39 12-Jul-2014 tedu

revert more free fallout


# 1.38 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_5_BASE
# 1.37 05-Nov-2013 krw

Sigh. How many typos can be made in one diff. Fix DL_SETPSOFFSET() to
be DL_SETPOFFSET().


# 1.36 05-Nov-2013 krw

DL_SETDSIZE() and DL_SETPSIZE() are not the same thing. Use the latter
to set partition size. Fixes tree breakage found by Scott McEachern.


# 1.35 05-Nov-2013 krw

Replace direct references to p_size, p_offset and d_secperunit with
DL_[GET|SET]PSIZE(), DL_[GET|SET]POFFSET(), DL_[GET|SET]DSIZE() in
order to get|set correct value that includes the high bits of the
value.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.34 01-Nov-2012 jsing

Fix merge errors.

Found the hard way by deraadt@


# 1.33 31-Oct-2012 jsing

Bring softraid support to i386/stand/libsa.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.32 23-Apr-2010 jsing

Recycle unused disklabel fields in order to create a disklabel unique
identifier, allowing the disk to be identified without relying on the
device name.

ok deraadt@ krw@ beck@ marco@ todd@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.31 21-May-2009 krw

The only value that d_npartitions should have is MAXPARTITIONS.


Revision tags: OPENBSD_4_5_BASE
# 1.30 10-Dec-2008 krw

When booting from a CD on i386/amd64, assume the root filesystem
is on the CD rather than always asking for its location. Behaviour
pointed out at OpenCON by Stephan Rickauer.

Tested by Stephan. nick@ has no objections.

ok deraadt@


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.29 18-Jun-2007 krw

Calculate the disklabel checksum *after* filling in all the fields in
the disklabel.

ok deraadt@


Revision tags: OPENBSD_4_1_BASE
# 1.28 26-Sep-2006 krw

Zap D_REMOVABLE flag from disklabel. If you didn't already know that
floppies and cd's were removable, displaying that fact in disklabel
output was unlikely to help. And the display in disklabel was the only
use of D_REMOVABLE in the tree.

ok marco@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.27 23-Jun-2004 tom

Enter cdboot, a CD-specific second-stage bootrap.

Testing krw@ and todd@, thanks.

assistance, testing and ok weingart@


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.26 19-Mar-2004 tom

Enter pxeboot, derived from the NetBSD implementation. Initially
intended to support network installs using bsd.rd over TFTP.

Thanks to the many who tested, including Diana Eichert.

ok deraadt@


# 1.25 09-Mar-2004 tom

Spacing and KNF. Partly from Joris Vink <nimadeus at pandora dot be>.

ok henning@, deraadt@


# 1.24 16-Dec-2003 deraadt

a bit more shrinking. do not bother printing the drive bus interfaces,
saves more space.


# 1.23 23-Oct-2003 fgsch

- delay reading the disklabel for floppies until after we're sure it's
the boot device. this fixes a delay (sometimes very long) if the bios
correctly reports a floppy but it's unplugged.
- bump version.

original idea from mdw@, tested by nick@, toby@ ok.


# 1.22 19-Sep-2003 fgsch

- some bios return a valid geometry for inexistent hd's so before
getting the geometry check the number of attached drives from
the bios area at 40:75.
- bump version.

from toby@. we want people to test this, specially those with ghost
drives showing up.


Revision tags: OPENBSD_3_4_BASE
# 1.21 11-Aug-2003 deraadt

ansification and knf and protos


# 1.20 04-Jun-2003 deraadt

fix some 3/4 for toby


# 1.19 31-May-2003 weingart

First lba support in /boot. Not complete lba boot support, but it's the
first step on the way there. Ok deraadt@, espie@, todd@, and others.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE SMP_BASE UBC_BASE kame_19991208
# 1.17 03-Oct-1999 ho

branches: 1.17.4; 1.17.14;
Add missing bzero().


# 1.16 20-May-1999 aaron

fix some typos; kwesterback@home.com


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.15 18-Apr-1998 deraadt

i386 bootblocks that work for 2.3. A tale too long to tell


# 1.14 24-Feb-1998 weingart

Changes/updates to /boot stuff. More to come.
Fixes many divide by zero and pointer bugs.


# 1.13 22-Dec-1997 mickey

fix debug drive printing


# 1.12 30-Nov-1997 mickey

big diskinfo changes from toby@


# 1.11 29-Oct-1997 niklas

Limit checksumming correctly at MAXBSIZE.
Don't involve floppies or bad block disks ever in uniqueness tests


Revision tags: OPENBSD_2_2_BASE
# 1.10 28-Oct-1997 deraadt

branches: 1.10.2;
attempt to number the bsd_dev units of each drive uniquely for scsi and ide.
hence ide 0, 1, 2, 3... scsi 0, 1, 2, 3... this makes the initial bsd_dev
values closer to the correct value they will have inside the kernel after
dkcsum has corrected them.
XXX if a drive has no label, it becomes known as an IDE drive, and scsi
drives after it get renumbered incorretcly. sorry.


# 1.9 26-Oct-1997 mickey

smaller, faster, better (;


# 1.8 26-Oct-1997 niklas

Max out checksumming at MAXBSIZE


# 1.7 25-Oct-1997 weingart

Fix disk probe. Get rid of EDD check, it goes haywire on
some machines. Thinkpad 760ED is one of them. IBM/MS
extention, and IBM does not support it. Nice.
Add some more debug statements for BIOS_DEBUG.
Init EDD flags to "not supported" for now.

Change 'machine memory' back to display the type of each
range it displays.

Testing by todd@ (thanks).


# 1.6 24-Oct-1997 mickey

checksumming stuff from niklas


# 1.5 24-Oct-1997 weingart

Fix hang on disk probe.


# 1.4 23-Oct-1997 weingart

Better BIOS diskprobe. Cleanup and re-org by mickey.
Fix bug in BIOS memprobe. Cleanup and re-org by mickey.
Do checksum of HD devices.


# 1.3 22-Oct-1997 mickey

newer, better stuff; some parts by toby@


# 1.2 18-Oct-1997 weingart

Copy in bios_diskinfo array from /boot space.
Add length field for checksum to same.
Start of making /boot deduce bsd dev_t for
all BIOS drives.


# 1.1 17-Oct-1997 weingart

Cleanup, make it all compile.
Move APM stuff to apmprobe.c


# 1.48 01-Sep-2022 krw

Stop setting d_bbsize and d_sbsize. Nobody has paid
any attention for some time.

ok otto@ as part of larger diff


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.47 09-Dec-2020 krw

Use daddr_t and not daddr32_t in boot media.

At a minimum, amd64/i386 should now boot from 4TB GPT formatted disks.

More daddr32_t terminations with extreme prejudice to follow.

Tested by various, in snaps for a few days.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.46 18-Jun-2018 krw

"a = 1; b = 100; c = a * b; if (c == 0) c = 100;"

is pretty silly. Nuke the if's.

ok millert@


Revision tags: OPENBSD_6_3_BASE
# 1.45 18-Dec-2017 fcambus

Add sizes for free() in libsa for amd64 and i386.

OK tom@, deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.44 21-Jul-2017 yasuoka

Check the hibernation signature for softraid disks and select valid bsd
for unhibernation. reported by Natasha Kerensikova. tested by Theo Buehler.

ok deraadt


# 1.43 22-Jun-2017 deraadt

Only print the magic '&' letter on a disk if the hibernate partition is
valid. This is an undocumented little debugging diagnostic, much like
the '*'.


# 1.42 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


Revision tags: OPENBSD_6_1_BASE
# 1.41 11-Sep-2016 jsing

Rename softraid boot files, which are currently in an MD location. This
will allow us to bring in a MI softraid.{c,h} in lib/libsa.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.40 02-Sep-2015 yasuoka

Bring the boot changes on amd64 to i386. alloca is deleted.
Also fix the boot from BIOS and bump the version.

input and ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.39 12-Jul-2014 tedu

revert more free fallout


# 1.38 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_5_BASE
# 1.37 05-Nov-2013 krw

Sigh. How many typos can be made in one diff. Fix DL_SETPSOFFSET() to
be DL_SETPOFFSET().


# 1.36 05-Nov-2013 krw

DL_SETDSIZE() and DL_SETPSIZE() are not the same thing. Use the latter
to set partition size. Fixes tree breakage found by Scott McEachern.


# 1.35 05-Nov-2013 krw

Replace direct references to p_size, p_offset and d_secperunit with
DL_[GET|SET]PSIZE(), DL_[GET|SET]POFFSET(), DL_[GET|SET]DSIZE() in
order to get|set correct value that includes the high bits of the
value.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.34 01-Nov-2012 jsing

Fix merge errors.

Found the hard way by deraadt@


# 1.33 31-Oct-2012 jsing

Bring softraid support to i386/stand/libsa.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.32 23-Apr-2010 jsing

Recycle unused disklabel fields in order to create a disklabel unique
identifier, allowing the disk to be identified without relying on the
device name.

ok deraadt@ krw@ beck@ marco@ todd@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.31 21-May-2009 krw

The only value that d_npartitions should have is MAXPARTITIONS.


Revision tags: OPENBSD_4_5_BASE
# 1.30 10-Dec-2008 krw

When booting from a CD on i386/amd64, assume the root filesystem
is on the CD rather than always asking for its location. Behaviour
pointed out at OpenCON by Stephan Rickauer.

Tested by Stephan. nick@ has no objections.

ok deraadt@


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.29 18-Jun-2007 krw

Calculate the disklabel checksum *after* filling in all the fields in
the disklabel.

ok deraadt@


Revision tags: OPENBSD_4_1_BASE
# 1.28 26-Sep-2006 krw

Zap D_REMOVABLE flag from disklabel. If you didn't already know that
floppies and cd's were removable, displaying that fact in disklabel
output was unlikely to help. And the display in disklabel was the only
use of D_REMOVABLE in the tree.

ok marco@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.27 23-Jun-2004 tom

Enter cdboot, a CD-specific second-stage bootrap.

Testing krw@ and todd@, thanks.

assistance, testing and ok weingart@


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.26 19-Mar-2004 tom

Enter pxeboot, derived from the NetBSD implementation. Initially
intended to support network installs using bsd.rd over TFTP.

Thanks to the many who tested, including Diana Eichert.

ok deraadt@


# 1.25 09-Mar-2004 tom

Spacing and KNF. Partly from Joris Vink <nimadeus at pandora dot be>.

ok henning@, deraadt@


# 1.24 16-Dec-2003 deraadt

a bit more shrinking. do not bother printing the drive bus interfaces,
saves more space.


# 1.23 23-Oct-2003 fgsch

- delay reading the disklabel for floppies until after we're sure it's
the boot device. this fixes a delay (sometimes very long) if the bios
correctly reports a floppy but it's unplugged.
- bump version.

original idea from mdw@, tested by nick@, toby@ ok.


# 1.22 19-Sep-2003 fgsch

- some bios return a valid geometry for inexistent hd's so before
getting the geometry check the number of attached drives from
the bios area at 40:75.
- bump version.

from toby@. we want people to test this, specially those with ghost
drives showing up.


Revision tags: OPENBSD_3_4_BASE
# 1.21 11-Aug-2003 deraadt

ansification and knf and protos


# 1.20 04-Jun-2003 deraadt

fix some 3/4 for toby


# 1.19 31-May-2003 weingart

First lba support in /boot. Not complete lba boot support, but it's the
first step on the way there. Ok deraadt@, espie@, todd@, and others.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE SMP_BASE UBC_BASE kame_19991208
# 1.17 03-Oct-1999 ho

branches: 1.17.4; 1.17.14;
Add missing bzero().


# 1.16 20-May-1999 aaron

fix some typos; kwesterback@home.com


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.15 18-Apr-1998 deraadt

i386 bootblocks that work for 2.3. A tale too long to tell


# 1.14 24-Feb-1998 weingart

Changes/updates to /boot stuff. More to come.
Fixes many divide by zero and pointer bugs.


# 1.13 22-Dec-1997 mickey

fix debug drive printing


# 1.12 30-Nov-1997 mickey

big diskinfo changes from toby@


# 1.11 29-Oct-1997 niklas

Limit checksumming correctly at MAXBSIZE.
Don't involve floppies or bad block disks ever in uniqueness tests


Revision tags: OPENBSD_2_2_BASE
# 1.10 28-Oct-1997 deraadt

branches: 1.10.2;
attempt to number the bsd_dev units of each drive uniquely for scsi and ide.
hence ide 0, 1, 2, 3... scsi 0, 1, 2, 3... this makes the initial bsd_dev
values closer to the correct value they will have inside the kernel after
dkcsum has corrected them.
XXX if a drive has no label, it becomes known as an IDE drive, and scsi
drives after it get renumbered incorretcly. sorry.


# 1.9 26-Oct-1997 mickey

smaller, faster, better (;


# 1.8 26-Oct-1997 niklas

Max out checksumming at MAXBSIZE


# 1.7 25-Oct-1997 weingart

Fix disk probe. Get rid of EDD check, it goes haywire on
some machines. Thinkpad 760ED is one of them. IBM/MS
extention, and IBM does not support it. Nice.
Add some more debug statements for BIOS_DEBUG.
Init EDD flags to "not supported" for now.

Change 'machine memory' back to display the type of each
range it displays.

Testing by todd@ (thanks).


# 1.6 24-Oct-1997 mickey

checksumming stuff from niklas


# 1.5 24-Oct-1997 weingart

Fix hang on disk probe.


# 1.4 23-Oct-1997 weingart

Better BIOS diskprobe. Cleanup and re-org by mickey.
Fix bug in BIOS memprobe. Cleanup and re-org by mickey.
Do checksum of HD devices.


# 1.3 22-Oct-1997 mickey

newer, better stuff; some parts by toby@


# 1.2 18-Oct-1997 weingart

Copy in bios_diskinfo array from /boot space.
Add length field for checksum to same.
Start of making /boot deduce bsd dev_t for
all BIOS drives.


# 1.1 17-Oct-1997 weingart

Cleanup, make it all compile.
Move APM stuff to apmprobe.c


# 1.47 09-Dec-2020 krw

Use daddr_t and not daddr32_t in boot media.

At a minimum, amd64/i386 should now boot from 4TB GPT formatted disks.

More daddr32_t terminations with extreme prejudice to follow.

Tested by various, in snaps for a few days.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.46 18-Jun-2018 krw

"a = 1; b = 100; c = a * b; if (c == 0) c = 100;"

is pretty silly. Nuke the if's.

ok millert@


Revision tags: OPENBSD_6_3_BASE
# 1.45 18-Dec-2017 fcambus

Add sizes for free() in libsa for amd64 and i386.

OK tom@, deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.44 21-Jul-2017 yasuoka

Check the hibernation signature for softraid disks and select valid bsd
for unhibernation. reported by Natasha Kerensikova. tested by Theo Buehler.

ok deraadt


# 1.43 22-Jun-2017 deraadt

Only print the magic '&' letter on a disk if the hibernate partition is
valid. This is an undocumented little debugging diagnostic, much like
the '*'.


# 1.42 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


Revision tags: OPENBSD_6_1_BASE
# 1.41 11-Sep-2016 jsing

Rename softraid boot files, which are currently in an MD location. This
will allow us to bring in a MI softraid.{c,h} in lib/libsa.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.40 02-Sep-2015 yasuoka

Bring the boot changes on amd64 to i386. alloca is deleted.
Also fix the boot from BIOS and bump the version.

input and ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.39 12-Jul-2014 tedu

revert more free fallout


# 1.38 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_5_BASE
# 1.37 05-Nov-2013 krw

Sigh. How many typos can be made in one diff. Fix DL_SETPSOFFSET() to
be DL_SETPOFFSET().


# 1.36 05-Nov-2013 krw

DL_SETDSIZE() and DL_SETPSIZE() are not the same thing. Use the latter
to set partition size. Fixes tree breakage found by Scott McEachern.


# 1.35 05-Nov-2013 krw

Replace direct references to p_size, p_offset and d_secperunit with
DL_[GET|SET]PSIZE(), DL_[GET|SET]POFFSET(), DL_[GET|SET]DSIZE() in
order to get|set correct value that includes the high bits of the
value.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.34 01-Nov-2012 jsing

Fix merge errors.

Found the hard way by deraadt@


# 1.33 31-Oct-2012 jsing

Bring softraid support to i386/stand/libsa.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.32 23-Apr-2010 jsing

Recycle unused disklabel fields in order to create a disklabel unique
identifier, allowing the disk to be identified without relying on the
device name.

ok deraadt@ krw@ beck@ marco@ todd@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.31 21-May-2009 krw

The only value that d_npartitions should have is MAXPARTITIONS.


Revision tags: OPENBSD_4_5_BASE
# 1.30 10-Dec-2008 krw

When booting from a CD on i386/amd64, assume the root filesystem
is on the CD rather than always asking for its location. Behaviour
pointed out at OpenCON by Stephan Rickauer.

Tested by Stephan. nick@ has no objections.

ok deraadt@


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.29 18-Jun-2007 krw

Calculate the disklabel checksum *after* filling in all the fields in
the disklabel.

ok deraadt@


Revision tags: OPENBSD_4_1_BASE
# 1.28 26-Sep-2006 krw

Zap D_REMOVABLE flag from disklabel. If you didn't already know that
floppies and cd's were removable, displaying that fact in disklabel
output was unlikely to help. And the display in disklabel was the only
use of D_REMOVABLE in the tree.

ok marco@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.27 23-Jun-2004 tom

Enter cdboot, a CD-specific second-stage bootrap.

Testing krw@ and todd@, thanks.

assistance, testing and ok weingart@


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.26 19-Mar-2004 tom

Enter pxeboot, derived from the NetBSD implementation. Initially
intended to support network installs using bsd.rd over TFTP.

Thanks to the many who tested, including Diana Eichert.

ok deraadt@


# 1.25 09-Mar-2004 tom

Spacing and KNF. Partly from Joris Vink <nimadeus at pandora dot be>.

ok henning@, deraadt@


# 1.24 16-Dec-2003 deraadt

a bit more shrinking. do not bother printing the drive bus interfaces,
saves more space.


# 1.23 23-Oct-2003 fgsch

- delay reading the disklabel for floppies until after we're sure it's
the boot device. this fixes a delay (sometimes very long) if the bios
correctly reports a floppy but it's unplugged.
- bump version.

original idea from mdw@, tested by nick@, toby@ ok.


# 1.22 19-Sep-2003 fgsch

- some bios return a valid geometry for inexistent hd's so before
getting the geometry check the number of attached drives from
the bios area at 40:75.
- bump version.

from toby@. we want people to test this, specially those with ghost
drives showing up.


Revision tags: OPENBSD_3_4_BASE
# 1.21 11-Aug-2003 deraadt

ansification and knf and protos


# 1.20 04-Jun-2003 deraadt

fix some 3/4 for toby


# 1.19 31-May-2003 weingart

First lba support in /boot. Not complete lba boot support, but it's the
first step on the way there. Ok deraadt@, espie@, todd@, and others.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE SMP_BASE UBC_BASE kame_19991208
# 1.17 03-Oct-1999 ho

branches: 1.17.4; 1.17.14;
Add missing bzero().


# 1.16 20-May-1999 aaron

fix some typos; kwesterback@home.com


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.15 18-Apr-1998 deraadt

i386 bootblocks that work for 2.3. A tale too long to tell


# 1.14 24-Feb-1998 weingart

Changes/updates to /boot stuff. More to come.
Fixes many divide by zero and pointer bugs.


# 1.13 22-Dec-1997 mickey

fix debug drive printing


# 1.12 30-Nov-1997 mickey

big diskinfo changes from toby@


# 1.11 29-Oct-1997 niklas

Limit checksumming correctly at MAXBSIZE.
Don't involve floppies or bad block disks ever in uniqueness tests


Revision tags: OPENBSD_2_2_BASE
# 1.10 28-Oct-1997 deraadt

branches: 1.10.2;
attempt to number the bsd_dev units of each drive uniquely for scsi and ide.
hence ide 0, 1, 2, 3... scsi 0, 1, 2, 3... this makes the initial bsd_dev
values closer to the correct value they will have inside the kernel after
dkcsum has corrected them.
XXX if a drive has no label, it becomes known as an IDE drive, and scsi
drives after it get renumbered incorretcly. sorry.


# 1.9 26-Oct-1997 mickey

smaller, faster, better (;


# 1.8 26-Oct-1997 niklas

Max out checksumming at MAXBSIZE


# 1.7 25-Oct-1997 weingart

Fix disk probe. Get rid of EDD check, it goes haywire on
some machines. Thinkpad 760ED is one of them. IBM/MS
extention, and IBM does not support it. Nice.
Add some more debug statements for BIOS_DEBUG.
Init EDD flags to "not supported" for now.

Change 'machine memory' back to display the type of each
range it displays.

Testing by todd@ (thanks).


# 1.6 24-Oct-1997 mickey

checksumming stuff from niklas


# 1.5 24-Oct-1997 weingart

Fix hang on disk probe.


# 1.4 23-Oct-1997 weingart

Better BIOS diskprobe. Cleanup and re-org by mickey.
Fix bug in BIOS memprobe. Cleanup and re-org by mickey.
Do checksum of HD devices.


# 1.3 22-Oct-1997 mickey

newer, better stuff; some parts by toby@


# 1.2 18-Oct-1997 weingart

Copy in bios_diskinfo array from /boot space.
Add length field for checksum to same.
Start of making /boot deduce bsd dev_t for
all BIOS drives.


# 1.1 17-Oct-1997 weingart

Cleanup, make it all compile.
Move APM stuff to apmprobe.c


# 1.46 18-Jun-2018 krw

"a = 1; b = 100; c = a * b; if (c == 0) c = 100;"

is pretty silly. Nuke the if's.

ok millert@


Revision tags: OPENBSD_6_3_BASE
# 1.45 18-Dec-2017 fcambus

Add sizes for free() in libsa for amd64 and i386.

OK tom@, deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.44 21-Jul-2017 yasuoka

Check the hibernation signature for softraid disks and select valid bsd
for unhibernation. reported by Natasha Kerensikova. tested by Theo Buehler.

ok deraadt


# 1.43 22-Jun-2017 deraadt

Only print the magic '&' letter on a disk if the hibernate partition is
valid. This is an undocumented little debugging diagnostic, much like
the '*'.


# 1.42 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


Revision tags: OPENBSD_6_1_BASE
# 1.41 11-Sep-2016 jsing

Rename softraid boot files, which are currently in an MD location. This
will allow us to bring in a MI softraid.{c,h} in lib/libsa.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.40 02-Sep-2015 yasuoka

Bring the boot changes on amd64 to i386. alloca is deleted.
Also fix the boot from BIOS and bump the version.

input and ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.39 12-Jul-2014 tedu

revert more free fallout


# 1.38 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_5_BASE
# 1.37 05-Nov-2013 krw

Sigh. How many typos can be made in one diff. Fix DL_SETPSOFFSET() to
be DL_SETPOFFSET().


# 1.36 05-Nov-2013 krw

DL_SETDSIZE() and DL_SETPSIZE() are not the same thing. Use the latter
to set partition size. Fixes tree breakage found by Scott McEachern.


# 1.35 05-Nov-2013 krw

Replace direct references to p_size, p_offset and d_secperunit with
DL_[GET|SET]PSIZE(), DL_[GET|SET]POFFSET(), DL_[GET|SET]DSIZE() in
order to get|set correct value that includes the high bits of the
value.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.34 01-Nov-2012 jsing

Fix merge errors.

Found the hard way by deraadt@


# 1.33 31-Oct-2012 jsing

Bring softraid support to i386/stand/libsa.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.32 23-Apr-2010 jsing

Recycle unused disklabel fields in order to create a disklabel unique
identifier, allowing the disk to be identified without relying on the
device name.

ok deraadt@ krw@ beck@ marco@ todd@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.31 21-May-2009 krw

The only value that d_npartitions should have is MAXPARTITIONS.


Revision tags: OPENBSD_4_5_BASE
# 1.30 10-Dec-2008 krw

When booting from a CD on i386/amd64, assume the root filesystem
is on the CD rather than always asking for its location. Behaviour
pointed out at OpenCON by Stephan Rickauer.

Tested by Stephan. nick@ has no objections.

ok deraadt@


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.29 18-Jun-2007 krw

Calculate the disklabel checksum *after* filling in all the fields in
the disklabel.

ok deraadt@


Revision tags: OPENBSD_4_1_BASE
# 1.28 26-Sep-2006 krw

Zap D_REMOVABLE flag from disklabel. If you didn't already know that
floppies and cd's were removable, displaying that fact in disklabel
output was unlikely to help. And the display in disklabel was the only
use of D_REMOVABLE in the tree.

ok marco@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.27 23-Jun-2004 tom

Enter cdboot, a CD-specific second-stage bootrap.

Testing krw@ and todd@, thanks.

assistance, testing and ok weingart@


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.26 19-Mar-2004 tom

Enter pxeboot, derived from the NetBSD implementation. Initially
intended to support network installs using bsd.rd over TFTP.

Thanks to the many who tested, including Diana Eichert.

ok deraadt@


# 1.25 09-Mar-2004 tom

Spacing and KNF. Partly from Joris Vink <nimadeus at pandora dot be>.

ok henning@, deraadt@


# 1.24 16-Dec-2003 deraadt

a bit more shrinking. do not bother printing the drive bus interfaces,
saves more space.


# 1.23 23-Oct-2003 fgsch

- delay reading the disklabel for floppies until after we're sure it's
the boot device. this fixes a delay (sometimes very long) if the bios
correctly reports a floppy but it's unplugged.
- bump version.

original idea from mdw@, tested by nick@, toby@ ok.


# 1.22 19-Sep-2003 fgsch

- some bios return a valid geometry for inexistent hd's so before
getting the geometry check the number of attached drives from
the bios area at 40:75.
- bump version.

from toby@. we want people to test this, specially those with ghost
drives showing up.


Revision tags: OPENBSD_3_4_BASE
# 1.21 11-Aug-2003 deraadt

ansification and knf and protos


# 1.20 04-Jun-2003 deraadt

fix some 3/4 for toby


# 1.19 31-May-2003 weingart

First lba support in /boot. Not complete lba boot support, but it's the
first step on the way there. Ok deraadt@, espie@, todd@, and others.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE SMP_BASE UBC_BASE kame_19991208
# 1.17 03-Oct-1999 ho

branches: 1.17.4; 1.17.14;
Add missing bzero().


# 1.16 20-May-1999 aaron

fix some typos; kwesterback@home.com


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.15 18-Apr-1998 deraadt

i386 bootblocks that work for 2.3. A tale too long to tell


# 1.14 24-Feb-1998 weingart

Changes/updates to /boot stuff. More to come.
Fixes many divide by zero and pointer bugs.


# 1.13 22-Dec-1997 mickey

fix debug drive printing


# 1.12 30-Nov-1997 mickey

big diskinfo changes from toby@


# 1.11 29-Oct-1997 niklas

Limit checksumming correctly at MAXBSIZE.
Don't involve floppies or bad block disks ever in uniqueness tests


Revision tags: OPENBSD_2_2_BASE
# 1.10 28-Oct-1997 deraadt

branches: 1.10.2;
attempt to number the bsd_dev units of each drive uniquely for scsi and ide.
hence ide 0, 1, 2, 3... scsi 0, 1, 2, 3... this makes the initial bsd_dev
values closer to the correct value they will have inside the kernel after
dkcsum has corrected them.
XXX if a drive has no label, it becomes known as an IDE drive, and scsi
drives after it get renumbered incorretcly. sorry.


# 1.9 26-Oct-1997 mickey

smaller, faster, better (;


# 1.8 26-Oct-1997 niklas

Max out checksumming at MAXBSIZE


# 1.7 25-Oct-1997 weingart

Fix disk probe. Get rid of EDD check, it goes haywire on
some machines. Thinkpad 760ED is one of them. IBM/MS
extention, and IBM does not support it. Nice.
Add some more debug statements for BIOS_DEBUG.
Init EDD flags to "not supported" for now.

Change 'machine memory' back to display the type of each
range it displays.

Testing by todd@ (thanks).


# 1.6 24-Oct-1997 mickey

checksumming stuff from niklas


# 1.5 24-Oct-1997 weingart

Fix hang on disk probe.


# 1.4 23-Oct-1997 weingart

Better BIOS diskprobe. Cleanup and re-org by mickey.
Fix bug in BIOS memprobe. Cleanup and re-org by mickey.
Do checksum of HD devices.


# 1.3 22-Oct-1997 mickey

newer, better stuff; some parts by toby@


# 1.2 18-Oct-1997 weingart

Copy in bios_diskinfo array from /boot space.
Add length field for checksum to same.
Start of making /boot deduce bsd dev_t for
all BIOS drives.


# 1.1 17-Oct-1997 weingart

Cleanup, make it all compile.
Move APM stuff to apmprobe.c


# 1.45 18-Dec-2017 fcambus

Add sizes for free() in libsa for amd64 and i386.

OK tom@, deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.44 21-Jul-2017 yasuoka

Check the hibernation signature for softraid disks and select valid bsd
for unhibernation. reported by Natasha Kerensikova. tested by Theo Buehler.

ok deraadt


# 1.43 22-Jun-2017 deraadt

Only print the magic '&' letter on a disk if the hibernate partition is
valid. This is an undocumented little debugging diagnostic, much like
the '*'.


# 1.42 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


Revision tags: OPENBSD_6_1_BASE
# 1.41 11-Sep-2016 jsing

Rename softraid boot files, which are currently in an MD location. This
will allow us to bring in a MI softraid.{c,h} in lib/libsa.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.40 02-Sep-2015 yasuoka

Bring the boot changes on amd64 to i386. alloca is deleted.
Also fix the boot from BIOS and bump the version.

input and ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.39 12-Jul-2014 tedu

revert more free fallout


# 1.38 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_5_BASE
# 1.37 05-Nov-2013 krw

Sigh. How many typos can be made in one diff. Fix DL_SETPSOFFSET() to
be DL_SETPOFFSET().


# 1.36 05-Nov-2013 krw

DL_SETDSIZE() and DL_SETPSIZE() are not the same thing. Use the latter
to set partition size. Fixes tree breakage found by Scott McEachern.


# 1.35 05-Nov-2013 krw

Replace direct references to p_size, p_offset and d_secperunit with
DL_[GET|SET]PSIZE(), DL_[GET|SET]POFFSET(), DL_[GET|SET]DSIZE() in
order to get|set correct value that includes the high bits of the
value.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.34 01-Nov-2012 jsing

Fix merge errors.

Found the hard way by deraadt@


# 1.33 31-Oct-2012 jsing

Bring softraid support to i386/stand/libsa.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.32 23-Apr-2010 jsing

Recycle unused disklabel fields in order to create a disklabel unique
identifier, allowing the disk to be identified without relying on the
device name.

ok deraadt@ krw@ beck@ marco@ todd@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.31 21-May-2009 krw

The only value that d_npartitions should have is MAXPARTITIONS.


Revision tags: OPENBSD_4_5_BASE
# 1.30 10-Dec-2008 krw

When booting from a CD on i386/amd64, assume the root filesystem
is on the CD rather than always asking for its location. Behaviour
pointed out at OpenCON by Stephan Rickauer.

Tested by Stephan. nick@ has no objections.

ok deraadt@


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.29 18-Jun-2007 krw

Calculate the disklabel checksum *after* filling in all the fields in
the disklabel.

ok deraadt@


Revision tags: OPENBSD_4_1_BASE
# 1.28 26-Sep-2006 krw

Zap D_REMOVABLE flag from disklabel. If you didn't already know that
floppies and cd's were removable, displaying that fact in disklabel
output was unlikely to help. And the display in disklabel was the only
use of D_REMOVABLE in the tree.

ok marco@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.27 23-Jun-2004 tom

Enter cdboot, a CD-specific second-stage bootrap.

Testing krw@ and todd@, thanks.

assistance, testing and ok weingart@


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.26 19-Mar-2004 tom

Enter pxeboot, derived from the NetBSD implementation. Initially
intended to support network installs using bsd.rd over TFTP.

Thanks to the many who tested, including Diana Eichert.

ok deraadt@


# 1.25 09-Mar-2004 tom

Spacing and KNF. Partly from Joris Vink <nimadeus at pandora dot be>.

ok henning@, deraadt@


# 1.24 16-Dec-2003 deraadt

a bit more shrinking. do not bother printing the drive bus interfaces,
saves more space.


# 1.23 23-Oct-2003 fgsch

- delay reading the disklabel for floppies until after we're sure it's
the boot device. this fixes a delay (sometimes very long) if the bios
correctly reports a floppy but it's unplugged.
- bump version.

original idea from mdw@, tested by nick@, toby@ ok.


# 1.22 19-Sep-2003 fgsch

- some bios return a valid geometry for inexistent hd's so before
getting the geometry check the number of attached drives from
the bios area at 40:75.
- bump version.

from toby@. we want people to test this, specially those with ghost
drives showing up.


Revision tags: OPENBSD_3_4_BASE
# 1.21 11-Aug-2003 deraadt

ansification and knf and protos


# 1.20 04-Jun-2003 deraadt

fix some 3/4 for toby


# 1.19 31-May-2003 weingart

First lba support in /boot. Not complete lba boot support, but it's the
first step on the way there. Ok deraadt@, espie@, todd@, and others.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE SMP_BASE UBC_BASE kame_19991208
# 1.17 03-Oct-1999 ho

branches: 1.17.4; 1.17.14;
Add missing bzero().


# 1.16 20-May-1999 aaron

fix some typos; kwesterback@home.com


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.15 18-Apr-1998 deraadt

i386 bootblocks that work for 2.3. A tale too long to tell


# 1.14 24-Feb-1998 weingart

Changes/updates to /boot stuff. More to come.
Fixes many divide by zero and pointer bugs.


# 1.13 22-Dec-1997 mickey

fix debug drive printing


# 1.12 30-Nov-1997 mickey

big diskinfo changes from toby@


# 1.11 29-Oct-1997 niklas

Limit checksumming correctly at MAXBSIZE.
Don't involve floppies or bad block disks ever in uniqueness tests


Revision tags: OPENBSD_2_2_BASE
# 1.10 28-Oct-1997 deraadt

branches: 1.10.2;
attempt to number the bsd_dev units of each drive uniquely for scsi and ide.
hence ide 0, 1, 2, 3... scsi 0, 1, 2, 3... this makes the initial bsd_dev
values closer to the correct value they will have inside the kernel after
dkcsum has corrected them.
XXX if a drive has no label, it becomes known as an IDE drive, and scsi
drives after it get renumbered incorretcly. sorry.


# 1.9 26-Oct-1997 mickey

smaller, faster, better (;


# 1.8 26-Oct-1997 niklas

Max out checksumming at MAXBSIZE


# 1.7 25-Oct-1997 weingart

Fix disk probe. Get rid of EDD check, it goes haywire on
some machines. Thinkpad 760ED is one of them. IBM/MS
extention, and IBM does not support it. Nice.
Add some more debug statements for BIOS_DEBUG.
Init EDD flags to "not supported" for now.

Change 'machine memory' back to display the type of each
range it displays.

Testing by todd@ (thanks).


# 1.6 24-Oct-1997 mickey

checksumming stuff from niklas


# 1.5 24-Oct-1997 weingart

Fix hang on disk probe.


# 1.4 23-Oct-1997 weingart

Better BIOS diskprobe. Cleanup and re-org by mickey.
Fix bug in BIOS memprobe. Cleanup and re-org by mickey.
Do checksum of HD devices.


# 1.3 22-Oct-1997 mickey

newer, better stuff; some parts by toby@


# 1.2 18-Oct-1997 weingart

Copy in bios_diskinfo array from /boot space.
Add length field for checksum to same.
Start of making /boot deduce bsd dev_t for
all BIOS drives.


# 1.1 17-Oct-1997 weingart

Cleanup, make it all compile.
Move APM stuff to apmprobe.c