; must be first in the binary
Pointers: dw Int13Start
dw Int15Start
- dw PatchArea
+ dw MemDisk_Info ; Portions are patched by installer
dw TotalSize
dw IretPtr
; Note that the above ends on a DWORD boundary.
; The MDI has always started at such a boundary.
+; Portions of the MDI are patched by the installer
MemDisk_Info equ $ ; Pointed to by installation check
MDI_Bytes dw MDI_Len ; Total bytes in MDI structure
MDI_Version db VERSION_MINOR, VERSION_MAJOR ; MEMDISK version
-PatchArea equ $ ; This gets filled in by the installer
-
DiskBuf dd 0 ; Linear address of high memory disk
DiskSize dd 0 ; Size of disk in blocks
CommandLine dw 0, 0 ; Far pointer to saved command line
%endif ; EDD
- ; End patch area
+; End patch area
+
alignb 4, db 0
Stack dd 0 ; Saved SS:ESP on invocation
dw 0
pptr = (struct patch_area *)(memdisk_hook + hptr->patch_offs);
dosmem_k = rdz_16(BIOS_BASEMEM);
- pptr->olddosmem = dosmem_k;
+ pptr->mdi.olddosmem = dosmem_k;
stddosmem = dosmem_k << 10;
/* If INT 15 E820 and INT 12 disagree, go with the most conservative */
if (stddosmem > dos_mem)
pptr->cylinders = geometry->c; /* Possible precision loss */
pptr->heads = geometry->h;
pptr->sectors = geometry->s;
- pptr->disksize = geometry->sectors;
- pptr->diskbuf = ramdisk_image + geometry->offset;
+ pptr->mdi.disksize = geometry->sectors;
+ pptr->mdi.diskbuf = ramdisk_image + geometry->offset;
pptr->statusptr = (geometry->driveno & 0x80) ? 0x474 : 0x441;
- pptr->bootloaderid = shdr->type_of_loader;
+ pptr->mdi.bootloaderid = shdr->type_of_loader;
pptr->configflags = CONFIG_SAFEINT; /* Default */
/* Set config flags */
pptr->edd_dpt.flags |= 0x0014;
}
- pptr->edd_dpt.devpath[0] = pptr->diskbuf;
+ pptr->edd_dpt.devpath[0] = pptr->mdi.diskbuf;
pptr->edd_dpt.chksum = -checksum_buf(&pptr->edd_dpt.dpikey, 73 - 30);
}
/* Anything beyond the end is for the stack */
pptr->mystack = (uint16_t) (stddosmem - driveraddr);
- pptr->oldint13.uint32 = rdz_32(BIOS_INT13);
- pptr->oldint15.uint32 = rdz_32(BIOS_INT15);
+ pptr->mdi.oldint13.uint32 = rdz_32(BIOS_INT13);
+ pptr->mdi.oldint15.uint32 = rdz_32(BIOS_INT15);
/* Adjust the E820 table: if there are null ranges (type 0)
at the end, change them to type end of list (-1).
bios_drives = 0;
pptr->drivecnt = 0;
no_bpt = 1;
- pptr->oldint13.uint32 = driverptr + hptr->iret_offs;
+ pptr->mdi.oldint13.uint32 = driverptr + hptr->iret_offs;
wrz_8(BIOS_EQUIP, rdz_8(BIOS_EQUIP) & ~0xc1);
wrz_8(BIOS_HD_COUNT, 0);
} else if (getcmditem("nopass") != CMD_NOTFOUND) {
pptr->driveshiftlimit);
/* Pointer to the command line */
- pptr->cmdline.seg_off.offset = bin_size + (nranges + 1) * sizeof(ranges[0]);
- pptr->cmdline.seg_off.segment = driverseg;
+ pptr->mdi.cmdline.seg_off.offset = bin_size + (nranges + 1) * sizeof(ranges[0]);
+ pptr->mdi.cmdline.seg_off.segment = driverseg;
/* Copy driver followed by E820 table followed by command line */
{
}
/* Note the previous INT 13h hook in the "safe hook" structure */
- hptr->safe_hook.old_hook.uint32 = pptr->oldint13.uint32;
+ hptr->safe_hook.old_hook.uint32 = pptr->mdi.oldint13.uint32;
/* Re-fill the "safe hook" mBFT field with the physical address */
hptr->safe_hook.mBFT.ptr =
if (getcmditem("dpt") != CMD_NOTFOUND ||
((nflop == 1 || no_bpt) && getcmditem("nodpt") == CMD_NOTFOUND)) {
/* Do install a replacement DPT into INT 1Eh */
- pptr->dpt_ptr = hptr->patch_offs + offsetof(struct patch_area, dpt);
+ pptr->mdi.dpt_ptr =
+ hptr->patch_offs + offsetof(struct patch_area, dpt);
}
}
wrz_32(BIOS_INT13, driverptr + hptr->int13_offs);
wrz_32(BIOS_INT15, driverptr + hptr->int15_offs);
- if (pptr->dpt_ptr)
- wrz_32(BIOS_INT1E, driverptr + pptr->dpt_ptr);
+ if (pptr->mdi.dpt_ptr)
+ wrz_32(BIOS_INT1E, driverptr + pptr->mdi.dpt_ptr);
printf("new: int13 = %08x int15 = %08x int1e = %08x\n",
rdz_32(BIOS_INT13), rdz_32(BIOS_INT15), rdz_32(BIOS_INT1E));
/* Reboot into the new "disk" */
puts("Loading boot sector... ");
- memcpy((void *)boot_base, (char *)pptr->diskbuf + geometry->boot_lba * 512,
+ memcpy((void *)boot_base,
+ (char *)pptr->mdi.diskbuf + geometry->boot_lba * 512,
boot_len);
if (getcmditem("pause") != CMD_NOTFOUND) {