summaryrefslogtreecommitdiff
path: root/memdisk/setup.c
Commit message (Collapse)AuthorAgeFilesLines
* memdisk: add a sector_shift field to the MDI; fix memdiskfindH. Peter Anvin2010-06-221-10/+11
| | | | | | | Add a sector_shift field to the MDI rather than assuming 512-byte sectors. Fix memdiskfind to report size in bytes, not in sectors. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* memdisk: make mstructs.h includable from LinuxH. Peter Anvin2010-06-211-10/+9
| | | | | | Make mstructs.h includable from a Linux utility. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* memdisk: Force 32-bit mBFT "safe hook" pointer fieldShao Miller2010-06-111-1/+1
| | | | | | | | | | | | | | When mstructs.h is used by MDISKCHK.COM, pointers have a 16-bit size and thus the mBFT structure sizeof() is smaller under OpenWatcom. We now union this pointer member with a uint32_t to force the field to at least 32 bits. There is another pointer in this header file which is already unioned with a uint32_t, due to that field's dual-purpose. That field is fine under OpenWatcom. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
* memdisk: Move dpt_t into common structures headerShao Miller2010-06-111-33/+0
| | | | | | | This needs to be in here in order for the header file to be useful to any C file other than setup.c. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
* memdisk: Change patch area to include the entire MDIShao Miller2010-06-111-15/+17
| | | | | | | | | | | Previously, the patch area began after the beginning of the MDI, but continued past its end. This is difficult to express with C structures, so we've simply changed the patch area to include the entire MDI. So it now includes the MDI size and MEMDISK version info, which we simply make constant to avoid modifying. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
* memdisk: Use MEMDISK header to access "safe hook"Shao Miller2010-06-111-23/+13
| | | | | | | | | | | | | | | This commit moves the MEMDISK header structure into the common structures header file. It also adds the "safe hook" structure to the MEMDISK header structure, since that matches what's in the hook binaries. Thus, we access the "safe hook" via the header pointer, instead of separately. Tested against a DOS floppy image including an experimental MDISKCHK.COM and also gainst WinVBlock. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
* memdisk: Use real_addr_t for SEG:OFF fieldsShao Miller2010-06-111-17/+15
| | | | | | | | | | | | We used uint32_t in a few places where it's also handy to refer to those fields' segment and offset components. Now we can do so via the real_addr_t union type. Additionally, there are a couple of places where we now have pointer fields instead of uint32_t fields, because we know what kind of struct the field is pointing to. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
* memdisk: Move common structures into headersShao Miller2010-06-111-87/+11
| | | | | | | | | | | | | Since MDISKCHK.COM (and possibly COM32 modules) could make use of structures found in MEMDISK's setup.c, we move these into a new header file mstructs.h. Also, since the OpenWatcom compiler uses a structure packing prefix and GCC uses a structure packing postfix, we accomodate this with preprocessor definitions around those structures needing to be packed. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
* memdisk: Calculate mBFT checksum laterShao Miller2010-03-301-14/+15
| | | | | | | We were calculating the mBFT checksum too early; dpt_ptr could change after checksumming, so we now do it after that possibility. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
* memdisk: MBR not recognized correctlyBodo Stroesser2010-03-301-1/+1
| | | | | | | | | | | | | This fixes a small inaccuracy in memdisk: get_disk_image_geometry() does not use MBR data to detect disk geometry, since it checks MBR signature at wrong offset. This normally does not cause problems, because memdisk guesses a reasonable value, if no MBR is found. Signed-off-by: Bodo Stroesser <bstroesser at ts.fujitsu.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* memdisk: make "nopass" type-specific, add "nopassany"H. Peter Anvin2010-02-081-4/+11
| | | | | | | Make "nopass" specific to the current drive type. Add new option "nopassany", which also clobbers the drive counts of both types. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: Fix "might be used uninitialized" warningShao Miller2009-12-111-2/+2
| | | | | | | Impact: Initializing variables The checksum_buf function was providing an incorrect checksum on at least one build.
* memdisk: "safe hook" and mBFTShao Miller2009-12-071-1/+40
| | | | | | | | | | | | | | | | | | | | Two additions to MEMDISK to support OS drivers. The "safe hook" structure ("Safe Master Boot Record INT 13h Hook Routines") is a means for an OS driver to follow a chain of INT 13h hooks, examining the hooks' vendors and assuming responsibility for hook functionality along the way. For MEMDISK, we guarantee an additional field which holds the physical address for the mBFT. The mBFT is an ACPI table which an OS driver can scan for. The mBFT contains the official MEMDISK Info structure (MDI) which itself includes parameters the OS will want to know about. The mBFT points back at the "safe hook" structure's physical address so that an OS supporting both "safe hook" chain-walking as well as mBFT-scanning can know that both refer to the same MEMDISK instance. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: pptr->cd_pkt.sect_count is in virtual sectorsH. Peter Anvin2009-11-191-1/+1
| | | | | | | Per the El Torito spec, pptr->cd_pkt.sect_count are in virtual sectors, i.e. 512-byte sectors. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: Use boot_lba logic for booting an offset within the disk imageShao Miller2009-11-191-8/+9
| | | | | | | | | We have two fundamental quantities: the offset of the disk image itself and the LBA from which we boot. Keep them straight. This should make at least some no-emulation isos work correctly. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Merge branch 'memdisk-iso-SAFE' into memdisk-isoShao Miller2009-11-161-87/+188
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: memdisk/memdisk_chs.asm memdisk/memdisk_edd.asm memdisk/setup.c Resolved: Deleted memdisk/memdisk_chs.asm Deleted memdisk/memdisk_edd.asm Modified memdisk/setup.c
| * [memdisk] Add El Torito emulation for .ISO imagesShao Miller2009-08-031-11/+136
| | | | | | | | | | With this patch, users can now boot El Torito-bootable .ISO (CD/DVD) images. The user should specify "iso" on the kernel command-line.
| * [memdisk] Add installable INT 13h hooks for ISO-booting scenariosShao Miller2009-08-031-0/+6
| | | | | | | | | | | | | | As of this commit, these hooks do nothing special and are unused. They are intended to support the El Torito "No Emulation" (2048-byte sector size) and "Floppy Emulation"/"HDD Emulation" (512-byte sector size) modes for bootable optical disc drive media (CD/DVD).
| * [memdisk] Rename CHS and EDD hooks to describe their sector sizeShao Miller2009-08-031-10/+10
| | | | | | | | Suffixed with _512 to indicate a sector size of 512 bytes.
| * [memdisk] Add disk probing code to support a drive shifting limitShao Miller2009-08-031-0/+8
| | | | | | | | | | | | | | Our INT 13h hook will now only shift BIOS drive numbers up to a limit. This limit is found by probing for a contiguous range of BIOS drives. Anything above this range of contiguous drive numbers is not shifted, and will thus be available to callers at the same drive number.
| * [memdisk] Add drive shift limit logicShao Miller2009-08-031-0/+4
| | | | | | | | | | | | | | We will not shift drives greater than or equal to a maximum BIOS drive number. This is hard-coded to drive 0xFF for now. This addition is in support of future disk probing logic, which can decide what the drive shift limit should be.
| * [memdisk] Move BIOS Data Area access into its own fileShao Miller2009-08-031-71/+29
| | | | | | | | New file: bda.h
* | memdisk: make the stack size configurableH. Peter Anvin2009-08-171-7/+29
|/ | | | | | | Make it possible to configure the stack size on the command line, so that we can rule that out in case of problems. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: don't set CX:DX for INT 13h AH=15h for floppiesH. Peter Anvin2009-08-021-2/+2
| | | | | | | | | Win98SE DOS apparently hangs if INT 13h, AH=15h returns the capacity in CX:DX for floppies... *unless* EDD is enabled. Confused yet? This patch also adds some more tracing framework. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: correct the types for the EDD DPT, and write a real onesyslinux-3.83-pre5H. Peter Anvin2009-07-311-15/+30
| | | | | | | Fix the sizes of some of the fields in the EDD DPT. Write a real one to the best of our ability. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: don't write the EDD DPT unless we are in EDD mode...H. Peter Anvin2009-07-311-6/+8
| | | | | | | | | | Don't write the EDD DPT unless we're actually in EDD mode! Otherwise we end up corrupting memory beyond the defined code. This was the reason 5ca2764460883f5e9a5bd83db00f242ea1272e33 worked, by moving variables out of the corruption zone. Debugged-by: Shao Miller <Shao.Miller@yrdsb.edu.on.ca> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* [memdisk] Additional EDD Device Parameter Table fieldsShao Miller2009-07-311-0/+9
| | | | | | Some additional fields from the EDD-4 spec. draft for the Device Parameter Table have been added into the structure in setup.c and memdisk.inc. These were added in the hopes of resolving a FreeDOS MEMDISK bug on IBM ThinkPads.
* memdisk: additional cleanupsH. Peter Anvin2009-06-071-64/+13
| | | | | | | | | | | | Additional stylistic cleanups. Rename "syscall" to "intcall" (we can't call it __intcall without clashing with com32.h); use macros instead of copying variables to different places with only the type being different. Also, only change the rm/pm jump instructions when actually relocating the code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: minor cleanupsH. Peter Anvin2009-06-071-40/+36
| | | | | | | Minor cleanups to the source base; make die() also print an error message and move die() into conio.c. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: relocate real-mode code before bootingH. Peter Anvin2009-06-071-28/+86
| | | | | | | | | | Relocate the real-mode code before booting. This allows the target bootstrap to be loaded at an arbitrary address, not necessarily 0x7c00, and to be almost arbitrarily long. Add some initial infrastructure for other bootstrap addresses, too. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: move rm_args initialization to C code; export rm_sizeH. Peter Anvin2009-06-071-3/+7
| | | | | | | | Move the rm_args initialization (and the associated sti) to C code. Export the total size of the real-mode code to the protected-mode code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: remove hard-coded assumptions for a specific RM segmentH. Peter Anvin2009-06-071-4/+14
| | | | | | | | | | Remove some hard-coded assumptions about having an RM segment at a specific location. This should allow us to relocate the RM code once the PM code knows where DOS free memory ends. This in turn allows the PM code to load the boot sector almost anywhere it wants to go in low memory, as is required for 100% compliant El Torito support. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: don't hard-code 0:7C00 as the entry pointH. Peter Anvin2009-06-071-1/+5
| | | | | | Make it possible for the setup code to override SS:SP and CS:IP. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: pass in the address of the real-mode codeH. Peter Anvin2009-06-071-2/+3
| | | | | | | Pass in the address of the real-mode code instead of hard-coding it in two separate places. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Run Nindent on memdisk/setup.cH. Peter Anvin2009-05-291-869/+883
| | | | | | | | | Automatically reformat memdisk/setup.c using Nindent. Do this for all files except HDT, gPXE and externally maintained libraries (zlib, tinyjpeg, libpng). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Drop support for ACPI 3 E820 extended memory attributesH. Peter Anvin2009-05-211-4/+2
| | | | | | | | | | | | | | Drop all support for ACPI 3 E820 extended memory attributes. There are BIOSes in the field that report completely bogus information here, resulting in no memory at all being detected (we then fall back to E801 detection, but that is problematic in its own ways.) There is strong reasons to believe at this point that the extended memory attributes are not usable in their current form, so drop them and revert back to simple 20-byte support, including for MEMDISK spoofing. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Global whitespace cleanup.H. Peter Anvin2009-04-201-9/+9
| | | | Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* MEMDISK: traceability for the geometryH. Peter Anvin2009-04-141-8/+27
| | | | | | Print the source of the geometry determination. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* MEMDISK: fix MBR geometry extractionH. Peter Anvin2009-04-141-1/+1
| | | | | | | Fix the MBR geometry extraction; there was an off-by-2 error in the MBR signature offset. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Update copyright notices; add Intel notices where appropriateH. Peter Anvin2009-04-041-0/+1
| | | | | | | Update copyright notices. Per agreement with my new employer, Intel Corporation, add Intel copyright notices where appropriate. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Banner: "and contributors" is just too long; try "et al"H. Peter Anvin2009-03-311-1/+1
| | | | | | | | | Impact: aestetics Change "and contributors" to "et al" so that the message actually fits on one line. This is unfortunate, but what can you do... Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Add "and contributors" to the copyright bannerH. Peter Anvin2009-03-211-1/+1
| | | | | Clarify that there are nowadays more copyright holders than just myself.
* Merge branch 'master' into memdisk-cdH. Peter Anvin2009-03-161-94/+168
|\
| * memdisk: move the floppy disk geometry code in parallel with the MBR codeH. Peter Anvin2009-03-161-84/+81
| | | | | | | | | | Move the floppy disk geometry generation code into parallel with the MBR code, which pretty much mimics the previous behavior.
| * memdisk: don't key FAT vs MBR on the type of diskH. Peter Anvin2009-03-161-25/+29
| | | | | | | | | | | | | | | | We can't rely on the disk type to say if this is FAT vs MBR, since we haven't determined that yet. Thus, move the FAT test up before the MBR test; both are heuristic, but the FAT test has much less probability of false positives, and can be further tightened if needed.
| * memdisk: auto-detect large floppy geometry if it is FATH. Peter Anvin2009-03-161-40/+113
| | | | | | | | | | | | If a "large floppy" image is formatted with a FAT filesystem, we can use the headers in the FAT image to derive the geometry. This is nice and user-friendly, so do it that way.
* | memdisk-cd: Kill off Int13MaxFunc slot for installer handling EDD caseShao Miller2009-03-101-4/+0
| | | | | | | | | | | | The memdisk install code previously controlled EDD features by controlling how many INT 13 functions were available. Since we have EDD and non-EDD versions of the memdisk hooking code now, this is no longer needed.
* | memdisk varieties: Allow for multiple memdisk installable hooksShao Miller2009-03-081-12/+21
|/ | | | | | | | | | | | This patch "sets the stage" for the memdisk kernel to include different "installables": versions of the memdisk hooks. This patch splits the case of the EDD-compiled hook from the non-EDD-compiled hook. Both are available inside the kernel, and the kernel chooses which one to install based on the command-line. It's possible that other, slightly modified versions of the memdisk hook could be useful to have...
* MEMDISK: drop unnecessary newlineH. Peter Anvin2008-10-141-1/+1
| | | | | | Drop a newline we didn't need after all. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* MEMDISK: default to "safeint" modesyslinux-3.73-pre3H. Peter Anvin2008-10-141-18/+40
| | | | | | | | | | There is enough evidence that "safeint" is a decent compromise between The Right Thing[TM] and dealing with the reality of ultra-broken DOSen. Make it the default. Clean up some of the command-line parsing code and status printing. Signed-off-by: H. Peter Anvin <hpa@zytor.com>