aboutsummaryrefslogtreecommitdiffstats
path: root/memdisk/mstructs.h
diff options
context:
space:
mode:
authorShao Miller <shao.miller@yrdsb.edu.on.ca>2010-03-09 14:45:12 -0500
committerShao Miller <shao.miller@yrdsb.edu.on.ca>2010-06-11 01:49:10 +0000
commit345a7cba6786de010359607e40f96f6fccbf40a5 (patch)
tree7f68723e1f48ebef5c5b45dd064f6d5298609b71 /memdisk/mstructs.h
parent2f4137d83abc2a63e982439b0506f6a630a91096 (diff)
downloadsyslinux-345a7cba6786de010359607e40f96f6fccbf40a5.tar.gz
syslinux-345a7cba6786de010359607e40f96f6fccbf40a5.tar.xz
syslinux-345a7cba6786de010359607e40f96f6fccbf40a5.zip
memdisk: Use real_addr_t for SEG:OFF fields
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>
Diffstat (limited to 'memdisk/mstructs.h')
-rw-r--r--memdisk/mstructs.h37
1 files changed, 26 insertions, 11 deletions
diff --git a/memdisk/mstructs.h b/memdisk/mstructs.h
index 635e47eb..d6b6265e 100644
--- a/memdisk/mstructs.h
+++ b/memdisk/mstructs.h
@@ -15,17 +15,30 @@
/* These structures are common to MEMDISK and MDISKCHK.COM */
+#include <stdint.h>
+
+struct seg_off {
+ uint16_t offset;
+ uint16_t segment;
+};
+
+typedef union {
+ struct seg_off seg_off;
+ uint32_t uint32;
+} real_addr_t;
+
MEMDISK_PACKED_PREFIX
struct safe_hook {
uint8_t jump[3]; /* Max. three bytes for jump */
uint8_t signature[8]; /* "$INT13SF" */
uint8_t vendor[8]; /* "MEMDISK " */
- uint32_t old_hook; /* SEG:OFF for previous INT 13h hook */
+ real_addr_t old_hook; /* SEG:OFF for previous INT 13h hook */
uint32_t flags; /* "Safe hook" flags */
/* The next field is a MEMDISK extension to the "safe hook" structure */
- uint32_t mBFT; /* Offset from hook to the mBFT; refilled
- * by setup() with the physical address
- */
+ union {
+ uint32_t offset; /* Offset from hook to the mBFT; refilled */
+ struct mBFT *ptr; /* by setup() with the physical address */
+ } mBFT;
} MEMDISK_PACKED_POSTFIX;
/* Requirement for struct acpi_description_header */
@@ -34,7 +47,10 @@ struct safe_hook {
MEMDISK_PACKED_PREFIX
struct mBFT {
struct acpi_description_header acpi;
- uint32_t safe_hook; /* "Safe hook" physical address */
+ struct safe_hook *safe_hook; /* "Safe hook" physical address */
+ /* An mBFT is 70 bytes in total */
+ uint8_t _pad[70 - (sizeof(struct acpi_description_header) +
+ sizeof(uint32_t))];
} MEMDISK_PACKED_POSTFIX;
MEMDISK_PACKED_PREFIX
@@ -47,7 +63,7 @@ struct edd_dpt {
uint32_t s; /* Physical sectors/track (count!) */
uint64_t sectors; /* Total sectors */
uint16_t bytespersec; /* Bytes/sector */
- uint16_t dpte_off, dpte_seg; /* DPTE pointer */
+ real_addr_t dpte; /* DPTE pointer */
uint16_t dpikey; /* Device Path Info magic */
uint8_t dpilen; /* Device Path Info length */
uint8_t res1; /* Reserved */
@@ -67,10 +83,10 @@ MEMDISK_PACKED_PREFIX
struct patch_area {
uint32_t diskbuf;
uint32_t disksize;
- uint16_t cmdline_off, cmdline_seg;
+ real_addr_t cmdline;
- uint32_t oldint13;
- uint32_t oldint15;
+ real_addr_t oldint13;
+ real_addr_t oldint15;
uint16_t olddosmem;
uint8_t bootloaderid;
@@ -107,6 +123,5 @@ struct patch_area {
dpt_t dpt;
struct edd_dpt edd_dpt;
- struct edd4_cd_pkt cd_pkt; /* Only really in a memdisk_iso_* hook */
+ struct edd4_cd_pkt cd_pkt; /* Only really in a memdisk_iso_* hook */
} MEMDISK_PACKED_POSTFIX;
-