image_scan(), image_scan_2(), image_scan_ext()

Scans memory for a valid system image

Synopsis:

unsigned long image_scan (unsigned long start,
                          unsigned long end)
unsigned long image_scan_2 (unsigned long start,
                          unsigned long end, int docksum)
unsigned long image_scan_ext (unsigned long start,
                          unsigned long end)

Arguments:

start
The address in memory from which to start scanning
end
The address in memory at which to stop scanning
docksum
image_scan_2() only. Set to 1 (one) to authenticate the image, or 0 (zero) to not authenticate the image. Default is 1: authenticate the image.

Description:

The image_scan() function scans memory for valid system images. As it scans memory, image_scan():

The image_scan() function assumes that more than one bootable image may be present on the medium, and can compile a list of valid OS images in order to pick the most recent image and return this image's start address. In practice, however, because image_scan() scans only the range you specify with its start and end arguments, and you can specify a small range (e.g., 256 or 512 bytes) in the area on your media where the bootable image should be located, the function won't waste time looking for more than one image.

The image_scan_2() function assumes a single image, so it returns the start address of the first image it finds. It allows you to further reduce execution time by setting the docksum argument to 0 (zero) to skip image authentication.

Use the image_scan_ext() function for an x86 system with a BIOS. This function copies the startup code to memory from where it is stored using an industry-standard BIOS routine.

Note: Use the image_setup*() and image_start*() functions that correspond to the image_scan*() function you use; for example, if you use image_scan_2(), use image_setup_2() and image_start_2().

Returns:

≥0
Success: the start address of the (most recent) valid image found
-1
Failure