aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dosutil/mdiskchk.c6
-rw-r--r--dosutil/mdiskchk.combin8246 -> 8106 bytes
-rw-r--r--memdisk/Makefile2
-rw-r--r--memdisk/compiler.h9
-rw-r--r--memdisk/eltorito.h1
-rw-r--r--memdisk/memdisk.h4
-rw-r--r--memdisk/mstructs.h11
-rw-r--r--memdisk/setup.c19
8 files changed, 24 insertions, 28 deletions
diff --git a/dosutil/mdiskchk.c b/dosutil/mdiskchk.c
index f7bde614..47bb08e5 100644
--- a/dosutil/mdiskchk.c
+++ b/dosutil/mdiskchk.c
@@ -31,10 +31,6 @@ typedef unsigned long uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
-/* OpenWatcom uses a packed structure prefix */
-#define MEMDISK_PACKED_PREFIX _Packed
-#define MEMDISK_PACKED_POSTFIX
-
/* Pull in MEMDISK common structures */
#include "../memdisk/mstructs.h"
@@ -277,7 +273,7 @@ static MDISKCHK_FUNC_DECL(show_safe_hooks)
struct patch_area far *patch_area;
/* Copy the MDI from the mBFT. Offset is a misnomer here */
- mbft = MK_FP(hook->mBFT.offset >> 4, 0); /* Always aligned */
+ mbft = MK_FP(hook->mbft >> 4, 0); /* Always aligned */
_fmemcpy((void far *)&m, &mbft->mdi, sizeof(struct mdi));
/* Adjust C/H/S since we actually know
* it directly for any MEMDISK with an mBFT
diff --git a/dosutil/mdiskchk.com b/dosutil/mdiskchk.com
index b18a187c..22ccfe5f 100644
--- a/dosutil/mdiskchk.com
+++ b/dosutil/mdiskchk.com
Binary files differ
diff --git a/memdisk/Makefile b/memdisk/Makefile
index 2e6330f9..d2f20c51 100644
--- a/memdisk/Makefile
+++ b/memdisk/Makefile
@@ -16,7 +16,7 @@ include $(topdir)/MCONFIG.embedded
-include $(topdir)/version.mk
INCLUDES = -I$(topdir)/com32/include
-CFLAGS += -DDATE='"$(DATE)"'
+CFLAGS += -D__MEMDISK__ -DDATE='"$(DATE)"'
LDFLAGS = $(GCCOPT) -g
NASM = nasm
NASMOPT = -O9999
diff --git a/memdisk/compiler.h b/memdisk/compiler.h
new file mode 100644
index 00000000..d1b03e06
--- /dev/null
+++ b/memdisk/compiler.h
@@ -0,0 +1,9 @@
+
+#ifdef __WATCOMC__
+# define MEMDISK_PACKED_PREFIX _Packed
+# define MEMDISK_PACKED_POSTFIX
+#else
+/* Assume GNU C for now */
+# define MEMDISK_PACKED_PREFIX
+# define MEMDISK_PACKED_POSTFIX __attribute__((packed))
+#endif
diff --git a/memdisk/eltorito.h b/memdisk/eltorito.h
index 27b570da..494c4a12 100644
--- a/memdisk/eltorito.h
+++ b/memdisk/eltorito.h
@@ -17,6 +17,7 @@
*/
#include <stdint.h>
+#include "compiler.h"
/* EDD-4 Bootable Optical Disc Drive Boot Volume Descriptor */
MEMDISK_PACKED_PREFIX
diff --git a/memdisk/memdisk.h b/memdisk/memdisk.h
index af40823a..b6b277a8 100644
--- a/memdisk/memdisk.h
+++ b/memdisk/memdisk.h
@@ -134,8 +134,4 @@ extern int check_zip(void *indata, uint32_t size, uint32_t * zbytes_p,
extern void *unzip(void *indata, uint32_t zbytes, uint32_t dbytes,
uint32_t orig_crc, void *target);
-/* Structure packing can be different for different compilers */
-#define MEMDISK_PACKED_PREFIX
-#define MEMDISK_PACKED_POSTFIX __attribute__ (( packed ))
-
#endif
diff --git a/memdisk/mstructs.h b/memdisk/mstructs.h
index e060aceb..c2e6352b 100644
--- a/memdisk/mstructs.h
+++ b/memdisk/mstructs.h
@@ -16,6 +16,7 @@
/* These structures are common to MEMDISK and MDISKCHK.COM */
#include <stdint.h>
+#include "compiler.h"
struct seg_off {
uint16_t offset;
@@ -38,10 +39,7 @@ struct safe_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 */
- union {
- uint32_t offset; /* Offset from hook to the mBFT; refilled */
- struct mBFT *ptr; /* by setup() with the physical address */
- } mBFT;
+ uint32_t mbft;
} MEMDISK_PACKED_POSTFIX;
struct memdisk_header {
@@ -106,10 +104,7 @@ struct mdi {
MEMDISK_PACKED_PREFIX
struct mBFT {
struct acpi_description_header acpi;
- union {
- struct safe_hook *ptr;
- uint32_t phys_addr;
- } safe_hook; /* "Safe hook" physical address */
+ uint32_t safe_hook; /* "Safe hook" physical address */
struct mdi mdi;
} MEMDISK_PACKED_POSTFIX;
diff --git a/memdisk/setup.c b/memdisk/setup.c
index ffaa2c66..20b48c47 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -718,6 +718,7 @@ void setup(const struct real_mode_args *rm_args_ptr)
char *memdisk_hook;
struct memdisk_header *hptr;
struct patch_area *pptr;
+ struct mBFT *mbft;
uint16_t driverseg;
uint32_t driverptr, driveraddr;
uint16_t dosmem_k;
@@ -1090,8 +1091,8 @@ void setup(const struct real_mode_args *rm_args_ptr)
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 =
- (struct mBFT *)(((const char *)hptr) + hptr->safe_hook.mBFT.offset);
+ mbft = (struct mBFT *)(((const char *)hptr) + hptr->safe_hook.mbft);
+ hptr->safe_hook.mbft = (size_t)mbft;
/* Update various BIOS magic data areas (gotta love this shit) */
@@ -1128,14 +1129,12 @@ void setup(const struct real_mode_args *rm_args_ptr)
}
/* Complete the mBFT */
- hptr->safe_hook.mBFT.ptr->acpi.signature[0] = 'm'; /* "mBFT" */
- hptr->safe_hook.mBFT.ptr->acpi.signature[1] = 'B';
- hptr->safe_hook.mBFT.ptr->acpi.signature[2] = 'F';
- hptr->safe_hook.mBFT.ptr->acpi.signature[3] = 'T';
- hptr->safe_hook.mBFT.ptr->safe_hook.ptr = &hptr->safe_hook;
- hptr->safe_hook.mBFT.ptr->acpi.checksum =
- -checksum_buf(hptr->safe_hook.mBFT.ptr,
- hptr->safe_hook.mBFT.ptr->acpi.length);
+ mbft->acpi.signature[0] = 'm'; /* "mBFT" */
+ mbft->acpi.signature[1] = 'B';
+ mbft->acpi.signature[2] = 'F';
+ mbft->acpi.signature[3] = 'T';
+ mbft->safe_hook = (size_t)&hptr->safe_hook;
+ mbft->acpi.checksum = -checksum_buf(mbft, mbft->acpi.length);
/* Install the interrupt handlers */
printf("old: int13 = %08x int15 = %08x int1e = %08x\n",