diff options
author | hpa <hpa> | 2002-11-18 19:31:19 +0000 |
---|---|---|
committer | hpa <hpa> | 2002-11-18 19:31:19 +0000 |
commit | f3b2b7af08efd9872c973f47410b39de63490230 (patch) | |
tree | 33ad7e6cd7b2e28906936866fa577d18dc237fb0 /memdisk | |
parent | ff6ca4781bf1d9694537a070c85bde5b9e9b82a0 (diff) | |
download | syslinux-f3b2b7af08efd9872c973f47410b39de63490230.tar.gz |
Fix MEMDISK initalization bugs
Diffstat (limited to 'memdisk')
-rw-r--r-- | memdisk/msetup.c | 24 | ||||
-rw-r--r-- | memdisk/setup.c | 22 |
2 files changed, 32 insertions, 14 deletions
diff --git a/memdisk/msetup.c b/memdisk/msetup.c index f9ed0712..3c0b1c70 100644 --- a/memdisk/msetup.c +++ b/memdisk/msetup.c @@ -131,31 +131,35 @@ void get_mem(void) } } +#define PW(x) (1ULL << (x)) + void parse_mem(void) { struct e820range *ep; + dos_mem = low_mem = high_mem = 0; + /* Derive "dos mem", "high mem", and "low mem" from the range array */ for ( ep = ranges ; ep->type != -1 ; ep++ ) { if ( ep->type == 1 ) { /* Only look at memory ranges */ if ( ep->start == 0 ) { - if ( ep[1].start > 0x100000 ) - dos_mem = 0x100000; + if ( ep[1].start > PW(20) ) + dos_mem = PW(20); else dos_mem = ep[1].start; } - if ( ep->start <= 0x00100000 && ep[1].start > 0x00100000 ) { - if ( ep[1].start > 0x01000000 ) - low_mem = 0x01000000 - 0x00100000; + if ( ep->start <= PW(20) && ep[1].start > PW(20) ) { + if ( ep[1].start > PW(24) ) + low_mem = PW(24) - PW(20); else - low_mem = ep[1].start - 0x00100000; + low_mem = ep[1].start - PW(20); } - if ( ep->start <= 0x01000000 && ep[1].start > 0x01000000 ) { - if ( ep[1].start > 0x100000000 ) - high_mem = 0x100000000 - 0x01000000; + if ( ep->start <= PW(24) && ep[1].start > PW(24) ) { + if ( ep[1].start > PW(32) ) + high_mem = PW(32) - PW(24); else - high_mem = ep[1].start - 0x01000000; + high_mem = ep[1].start - PW(24); } } } diff --git a/memdisk/setup.c b/memdisk/setup.c index b96b4318..249d8479 100644 --- a/memdisk/setup.c +++ b/memdisk/setup.c @@ -572,6 +572,13 @@ uint32_t setup(void) insertrange(driveraddr, dos_mem-driveraddr, 2); parse_mem(); + printf("dos_mem = %#10x (%u K)\n" + "low_mem = %#10x (%u K)\n" + "high_mem = %#10x (%u K)\n", + dos_mem, dos_mem >> 10, + low_mem, low_mem >> 10, + high_mem, high_mem >> 10); + pptr->mem1mb = low_mem >> 10; pptr->mem16mb = high_mem >> 16; if ( low_mem == (15 << 20) ) { @@ -582,9 +589,8 @@ uint32_t setup(void) pptr->memint1588 = low_mem >> 10; } - printf("mem1mb = %5u (0x%04x)\n", pptr->mem1mb, pptr->mem1mb); - printf("mem16mb = %5u (0x%04x)\n", pptr->mem16mb, pptr->mem16mb); - printf("mem1588 = %5u (0x%04x)\n", pptr->memint1588, pptr->memint1588); + printf("1588: 0x%04x 15E801: 0x%04x 0x%04x\n", + pptr->memint1588, pptr->mem1mb, pptr->mem16mb); driverseg = driveraddr >> 4; driverptr = driverseg << 16; @@ -622,7 +628,7 @@ uint32_t setup(void) : "esi", "ebx", "ebp"); if ( cf ) { - printf("INT 13 08: Failure\n"); + printf("INT 13 08: Failure, assuming this is the only drive\n"); pptr->drivecnt = 1; } else { printf("INT 13 08: Success, count = %u, BPT = %04x:%04x\n", @@ -705,6 +711,14 @@ uint32_t setup(void) die(); } + if ( getcmditem("pause") != CMD_NOTFOUND ) { + puts("Press any key to boot... "); + asm volatile("pushal ; " + "xorw %ax,%ax ; " + "int $0x16 ; " + "popal"); + } + puts("Booting...\n"); /* On return the assembly code will jump to the boot vector */ |