summaryrefslogtreecommitdiff
path: root/memdisk/setup.c
diff options
context:
space:
mode:
authorhpa <hpa>2004-12-08 04:29:22 +0000
committerhpa <hpa>2004-12-08 04:29:22 +0000
commit1b142b7e70d7de4f76e418bb6788a144a5c31c30 (patch)
tree940c0e5d6cd19dc1d4868c1077bd9379e0c67f76 /memdisk/setup.c
parent6d0222e3e60a0161a82292ca8fb308039e862e04 (diff)
downloadsyslinux-1b142b7e70d7de4f76e418bb6788a144a5c31c30.tar.gz
Move all 16-bit code into one assembly file so we don't have to rely
on ld working properly
Diffstat (limited to 'memdisk/setup.c')
-rw-r--r--memdisk/setup.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/memdisk/setup.c b/memdisk/setup.c
index b3bcc9dd..d52e11cd 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -17,7 +17,6 @@
#include "version.h"
#include "memdisk.h"
-/* A pointer to this is stored in the header */
const char memdisk_version[] =
"MEMDISK " VERSION " " DATE;
const char copyright[] =
@@ -369,6 +368,8 @@ struct dosemu_header {
uint8_t pad[105];
} __attribute__((packed));
+#define FOUR(a,b,c,d) (((a) << 24)|((b) << 16)|((c) << 8)|(d))
+
const struct geometry *get_disk_image_geometry(uint32_t where, uint32_t size)
{
static struct geometry hd_geometry = { 0, 0, 0, 0, 0, 0, 0x80 };
@@ -400,7 +401,8 @@ const struct geometry *get_disk_image_geometry(uint32_t where, uint32_t size)
/* Do we have a DOSEMU header? */
memcpy(&dosemu, (char *)where+hd_geometry.offset, sizeof dosemu);
- if ( !__builtin_memcmp("DOSEMU", dosemu.magic, 7) ) {
+ if ( ((unsigned long *)dosemu.magic)[0] == FOUR('D','O','S','E') &&
+ (((unsigned long *)dosemu.magic)[1] & 0xffffff) == FOUR('M','U',0,0) ) {
/* Always a hard disk unless overruled by command-line options */
hd_geometry.driveno = 0x80;
hd_geometry.type = 0;