aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-04-23 21:10:32 +0200
committerErwan Velu <erwan.velu@free.fr>2009-04-23 21:10:32 +0200
commit75c9aef767d9ab556c92e6e50a0ca0b61b898916 (patch)
treef6148cadbdaa0f47e02d3e1b9c59c6ae1221e8cb
parent98bd2d140d31e5ce4b83589a546a70183a22b4e1 (diff)
parent6af3d0ea72a6f6852bda7519278a0c6fdd16d2b5 (diff)
downloadsyslinux.git-75c9aef767d9ab556c92e6e50a0ca0b61b898916.tar.gz
syslinux.git-75c9aef767d9ab556c92e6e50a0ca0b61b898916.tar.xz
syslinux.git-75c9aef767d9ab556c92e6e50a0ca0b61b898916.zip
Merge branch 'master' of git://git.kernel.org/pub/scm/boot/syslinux/syslinux into mainline
Conflicts: com32/hdt/hdt-cli-pci.c com32/hdt/hdt-cli-vesa.c com32/hdt/hdt-common.c com32/hdt/hdt-menu-dmi.c
-rw-r--r--com32/gdbstub/gdbstub.c4
-rw-r--r--com32/gdbstub/serial.c4
-rw-r--r--com32/gplinclude/cpuid.h2
-rw-r--r--com32/gpllib/dmi/dmi_base_board.c1
-rw-r--r--com32/gpllib/dmi/dmi_battery.c1
-rw-r--r--com32/gpllib/dmi/dmi_bios.c1
-rw-r--r--com32/gpllib/dmi/dmi_ipmi.c1
-rw-r--r--com32/gpllib/dmi/dmi_memory.c1
-rw-r--r--com32/gpllib/dmi/dmi_processor.c1
-rw-r--r--com32/hdt/hdt-cli-pci.c23
-rw-r--r--com32/include/com32.h6
-rw-r--r--com32/include/sys/cpu.h4
-rw-r--r--com32/include/sys/pci.h12
-rw-r--r--com32/include/syslinux/keyboard.h1
-rw-r--r--com32/lib/malloc.h1
-rw-r--r--com32/lib/memcpy.S2
-rw-r--r--com32/lib/memmove.S2
-rw-r--r--com32/lib/mempcpy.S2
-rw-r--r--com32/lib/memset.S2
-rw-r--r--com32/lib/setjmp.S2
-rw-r--r--com32/lib/sys/ansicon_write.c2
-rw-r--r--com32/lib/syslinux/memmap.c2
-rw-r--r--com32/menu/drain.c4
-rw-r--r--com32/menu/execute.c3
-rw-r--r--com32/rosh/rosh.c28
-rw-r--r--com32/samples/entrydump.c2
-rw-r--r--core/bcopy32.inc77
-rw-r--r--core/bcopyxx.inc23
-rw-r--r--core/bootsect.inc8
-rw-r--r--core/com32.inc2
-rw-r--r--core/comboot.inc6
-rw-r--r--core/config.inc2
-rw-r--r--core/conio.inc2
-rw-r--r--core/cpuinit.inc26
-rw-r--r--core/diskstart.inc681
-rw-r--r--core/dnsresolv.inc2
-rw-r--r--core/extlinux.asm645
-rw-r--r--core/highmem.inc2
-rw-r--r--core/isolinux.asm6
-rw-r--r--core/ldlinux.asm656
-rw-r--r--core/macros.inc29
-rw-r--r--core/parseconfig.inc2
-rw-r--r--core/ui.inc2
-rw-r--r--doc/comboot.txt5
-rw-r--r--memdisk/setup.c18
-rw-r--r--memdisk/start32.S2
-rw-r--r--modules/pxechain.asm20
47 files changed, 844 insertions, 1486 deletions
diff --git a/com32/gdbstub/gdbstub.c b/com32/gdbstub/gdbstub.c
index 3e9ff5e8..f235a349 100644
--- a/com32/gdbstub/gdbstub.c
+++ b/com32/gdbstub/gdbstub.c
@@ -152,12 +152,12 @@ static void gdbmach_commit_hwbp ( struct hwbp *bp ) {
/* Set/clear local enable bit */
dr7 &= ~( 0x3 << 2 * regnum );
- dr7 |= bp->enabled << 2 * regnum;
+ dr7 |= bp->enabled << 2 * regnum;
}
int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len, int enable ) {
struct hwbp *bp;
-
+
/* Check and convert breakpoint type to x86 type */
switch ( type ) {
case GDBMACH_WATCH:
diff --git a/com32/gdbstub/serial.c b/com32/gdbstub/serial.c
index 1c4d4b6f..2b9fc2ef 100644
--- a/com32/gdbstub/serial.c
+++ b/com32/gdbstub/serial.c
@@ -91,7 +91,7 @@ void serial_putc ( int ch ) {
int status;
for (;;) {
status = uart_readb(UART_BASE + UART_LSR);
- if (status & UART_LSR_THRE) {
+ if (status & UART_LSR_THRE) {
/* TX buffer emtpy */
uart_writeb(ch, UART_BASE + UART_TBR);
break;
@@ -165,7 +165,7 @@ void serial_init ( void ) {
goto out;
}
uart_writeb(lcs, UART_BASE + UART_LCR);
-
+
/* disable interrupts */
uart_writeb(0x0, UART_BASE + UART_IER);
diff --git a/com32/gplinclude/cpuid.h b/com32/gplinclude/cpuid.h
index 2473b41e..ca1c3142 100644
--- a/com32/gplinclude/cpuid.h
+++ b/com32/gplinclude/cpuid.h
@@ -1,5 +1,5 @@
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 2006-2009 Erwan Velu - All Rights Reserved
*
* Portions of this file taken from the Linux kernel,
diff --git a/com32/gpllib/dmi/dmi_base_board.c b/com32/gpllib/dmi/dmi_base_board.c
index f37feec9..2f19fda4 100644
--- a/com32/gpllib/dmi/dmi_base_board.c
+++ b/com32/gpllib/dmi/dmi_base_board.c
@@ -35,4 +35,3 @@ const char *base_board_features_strings[]={
"Board is replaceable",
"Board is hot swappable" /* 4 */
};
-
diff --git a/com32/gpllib/dmi/dmi_battery.c b/com32/gpllib/dmi/dmi_battery.c
index 567254a8..02b5e6df 100644
--- a/com32/gpllib/dmi/dmi_battery.c
+++ b/com32/gpllib/dmi/dmi_battery.c
@@ -70,4 +70,3 @@ void dmi_battery_maximum_error(uint8_t code, char *error)
else
sprintf(error,"%u%%", code);
}
-
diff --git a/com32/gpllib/dmi/dmi_bios.c b/com32/gpllib/dmi/dmi_bios.c
index 9458d492..1fea7524 100644
--- a/com32/gpllib/dmi/dmi_bios.c
+++ b/com32/gpllib/dmi/dmi_bios.c
@@ -77,4 +77,3 @@ const char *bios_charac_x2_strings[]={
"Function key-initiated network boot is supported",
"Targeted content distribution is supported" /* 2 */
};
-
diff --git a/com32/gpllib/dmi/dmi_ipmi.c b/com32/gpllib/dmi/dmi_ipmi.c
index 8ea5f798..8081375c 100644
--- a/com32/gpllib/dmi/dmi_ipmi.c
+++ b/com32/gpllib/dmi/dmi_ipmi.c
@@ -56,4 +56,3 @@ void dmi_ipmi_base_address(uint8_t type, const uint8_t *p, s_ipmi *ipmi)
ipmi->base_address = QWORD(p);
}
}
-
diff --git a/com32/gpllib/dmi/dmi_memory.c b/com32/gpllib/dmi/dmi_memory.c
index dc354df1..9067009a 100644
--- a/com32/gpllib/dmi/dmi_memory.c
+++ b/com32/gpllib/dmi/dmi_memory.c
@@ -169,4 +169,3 @@ void dmi_memory_device_speed(uint16_t code, char *speed)
else
sprintf(speed,"%u MHz", code);
}
-
diff --git a/com32/gpllib/dmi/dmi_processor.c b/com32/gpllib/dmi/dmi_processor.c
index f86f0095..321f6e65 100644
--- a/com32/gpllib/dmi/dmi_processor.c
+++ b/com32/gpllib/dmi/dmi_processor.c
@@ -430,4 +430,3 @@ const char *cpu_flags_strings[PROCESSOR_FLAGS_ELEMENTS]={
"IA64 (IA64 capabilities)", /* 30 */
"PBE (Pending break enabled)" /* 31 */
};
-
diff --git a/com32/hdt/hdt-cli-pci.c b/com32/hdt/hdt-cli-pci.c
index 39bc0fb9..2747b66b 100644
--- a/com32/hdt/hdt-cli-pci.c
+++ b/com32/hdt/hdt-cli-pci.c
@@ -200,6 +200,7 @@ static void show_pci_devices(int argc __unused, char **argv __unused,
pci_device->sub_vendor,
pci_device->sub_product);
+<<<<<<< HEAD:com32/hdt/hdt-cli-pci.c
more_printf(first_line);
more_printf(second_line);
more_printf("\n");
@@ -220,6 +221,28 @@ static void show_pci_devices(int argc __unused, char **argv __unused,
}
i++;
}
+=======
+ more_printf(first_line);
+ more_printf(second_line);
+ more_printf("\n");
+ } else if (nopciids == true) {
+ if (nomodulespcimap == true) {
+ more_printf("%02d: %04x:%04x [%04x:%04x] \n",
+ i, pci_device->vendor,
+ pci_device->product,
+ pci_device->sub_vendor,
+ pci_device->sub_product);
+ } else {
+ more_printf
+ ("%02d: %04x:%04x [%04x:%04x] Kmod:%s\n", i,
+ pci_device->vendor, pci_device->product,
+ pci_device->sub_vendor,
+ pci_device->sub_product, kernel_modules);
+ }
+ }
+ i++;
+ }
+>>>>>>> 6af3d0ea72a6f6852bda7519278a0c6fdd16d2b5:com32/hdt/hdt-cli-pci.c
}
diff --git a/com32/include/com32.h b/com32/include/com32.h
index 44cd5732..da2edfb1 100644
--- a/com32/include/com32.h
+++ b/com32/include/com32.h
@@ -1,5 +1,5 @@
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 2002-2009 H. Peter Anvin - All Rights Reserved
* Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
@@ -11,10 +11,10 @@
* sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following
* conditions:
- *
+ *
* The above copyright notice and this permission notice shall
* be included in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
diff --git a/com32/include/sys/cpu.h b/com32/include/sys/cpu.h
index dcc4abfa..fcae2da1 100644
--- a/com32/include/sys/cpu.h
+++ b/com32/include/sys/cpu.h
@@ -65,7 +65,7 @@ static inline __constfunc uint32_t cpuid_edx(uint32_t level)
static inline __constfunc bool cpu_has_eflag(uint32_t flag)
{
uint32_t f1, f2;
-
+
asm("pushfl\n\t"
"pushfl\n\t"
"popl %0\n\t"
@@ -78,7 +78,7 @@ static inline __constfunc bool cpu_has_eflag(uint32_t flag)
"popfl\n\t"
: "=&r" (f1), "=&r" (f2)
: "ir" (flag));
-
+
return ((f1^f2) & flag) != 0;
}
diff --git a/com32/include/sys/pci.h b/com32/include/sys/pci.h
index b44db62f..b6556ff0 100644
--- a/com32/include/sys/pci.h
+++ b/com32/include/sys/pci.h
@@ -4,13 +4,13 @@
#include <inttypes.h>
#include <sys/io.h>
-#define MAX_PCI_FUNC 8
-#define MAX_PCI_DEVICES 32
-#define MAX_PCI_BUSES 256
+#define MAX_PCI_FUNC 8
+#define MAX_PCI_DEVICES 32
+#define MAX_PCI_BUSES 256
#define LINUX_KERNEL_MODULE_SIZE 64
-#define PCI_VENDOR_NAME_SIZE 256
-#define PCI_PRODUCT_NAME_SIZE 256
-#define PCI_CLASS_NAME_SIZE 256
+#define PCI_VENDOR_NAME_SIZE 256
+#define PCI_PRODUCT_NAME_SIZE 256
+#define PCI_CLASS_NAME_SIZE 256
#define MAX_KERNEL_MODULES_PER_PCI_DEVICE 10
#define MAX_PCI_CLASSES 256
diff --git a/com32/include/syslinux/keyboard.h b/com32/include/syslinux/keyboard.h
index 8f21ad07..290cff32 100644
--- a/com32/include/syslinux/keyboard.h
+++ b/com32/include/syslinux/keyboard.h
@@ -50,4 +50,3 @@ syslinux_keyboard_map(void)
}
#endif /* _SYSLINUX_KEYBOARD_H */
-
diff --git a/com32/lib/malloc.h b/com32/lib/malloc.h
index 983a3c52..e70b8c9b 100644
--- a/com32/lib/malloc.h
+++ b/com32/lib/malloc.h
@@ -53,4 +53,3 @@ struct free_arena_header {
extern struct free_arena_header __malloc_head;
void __inject_free_block(struct free_arena_header *ah);
-
diff --git a/com32/lib/memcpy.S b/com32/lib/memcpy.S
index 5f2c4ec7..6b986a0d 100644
--- a/com32/lib/memcpy.S
+++ b/com32/lib/memcpy.S
@@ -80,7 +80,7 @@ memcpy:
popl %eax /* Return value */
popl %edi
popl %esi
-1:
+1:
ret
.size memcpy, .-memcpy
diff --git a/com32/lib/memmove.S b/com32/lib/memmove.S
index 90bbf3be..2fcb4b57 100644
--- a/com32/lib/memmove.S
+++ b/com32/lib/memmove.S
@@ -41,7 +41,7 @@ memmove:
pushl %esi
pushl %edi
pushl %eax /* Return value */
-
+
movl %eax,%edi
movl %edx,%esi
diff --git a/com32/lib/mempcpy.S b/com32/lib/mempcpy.S
index f6961f66..cad7b983 100644
--- a/com32/lib/mempcpy.S
+++ b/com32/lib/mempcpy.S
@@ -79,7 +79,7 @@ mempcpy:
movl %edi,%eax /* Return value */
popl %edi
popl %esi
-1:
+1:
ret
.size mempcpy, .-mempcpy
diff --git a/com32/lib/memset.S b/com32/lib/memset.S
index 4b2583c3..e641415d 100644
--- a/com32/lib/memset.S
+++ b/com32/lib/memset.S
@@ -47,7 +47,7 @@ memset:
movzwl %dx,%eax
shll $16,%edx
orl %edx,%eax
-
+
/* Initial alignment */
movl %edi,%edx
shrl $1,%edx
diff --git a/com32/lib/setjmp.S b/com32/lib/setjmp.S
index a368b78e..658df485 100644
--- a/com32/lib/setjmp.S
+++ b/com32/lib/setjmp.S
@@ -7,7 +7,7 @@
*
* The jmp_buf is assumed to contain the following, in order:
* %ebx
- * %esp
+ * %esp
* %ebp
* %esi
* %edi
diff --git a/com32/lib/sys/ansicon_write.c b/com32/lib/sys/ansicon_write.c
index 7bdc8cbd..3322ab24 100644
--- a/com32/lib/sys/ansicon_write.c
+++ b/com32/lib/sys/ansicon_write.c
@@ -242,7 +242,7 @@ ssize_t __ansicon_write(struct file_info *fp, const void *buf, size_t count)
void __ansicon_beep(void)
{
static com32sys_t ireg;
-
+
ireg.eax.w[0] = 0x0e07;
ireg.ebx.b[1] = BIOS_PAGE;
__intcall(0x10, &ireg, NULL);
diff --git a/com32/lib/syslinux/memmap.c b/com32/lib/syslinux/memmap.c
index 9fdda886..170168b0 100644
--- a/com32/lib/syslinux/memmap.c
+++ b/com32/lib/syslinux/memmap.c
@@ -51,8 +51,6 @@ static int syslinux_memory_map_callback(void *map, addr_t start,
struct syslinux_memmap *syslinux_memory_map(void)
{
struct syslinux_memmap *mmap;
- enum syslinux_memmap_types type;
- int rv;
mmap = syslinux_init_memmap();
if (!mmap)
diff --git a/com32/menu/drain.c b/com32/menu/drain.c
index 428d9709..ace04518 100644
--- a/com32/menu/drain.c
+++ b/com32/menu/drain.c
@@ -9,7 +9,7 @@ void drain_keyboard(void)
/* Prevent "ghost typing" and keyboard buffer snooping */
volatile char junk;
int rv;
-
+
do {
rv = read(0, (char *)&junk, 1);
} while (rv > 0);
@@ -23,5 +23,3 @@ void drain_keyboard(void)
memset((void *)0x41e, 0, 32); /* Clear the actual keyboard buffer */
sti();
}
-
-
diff --git a/com32/menu/execute.c b/com32/menu/execute.c
index ace0e571..d84958c5 100644
--- a/com32/menu/execute.c
+++ b/com32/menu/execute.c
@@ -1,5 +1,5 @@
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -67,4 +67,3 @@ void execute(const char *cmdline, enum kernel_type type)
/* If this returns, something went bad; return to menu */
}
-
diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index 5eaa47df..659df8a0 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -216,16 +216,16 @@ void rosh_print_tc(struct termios *tio)
*/
void rosh_console_raw()
{
-// struct termios itio, ntio;
-// tcgetattr(0, &itio);
-// rosh_print_tc(&itio);
+// struct termios itio, ntio;
+// tcgetattr(0, &itio);
+// rosh_print_tc(&itio);
/* ntio = itio;
ntio.c_lflag &= ~(ICANON|ECHO);
tcsetattr(0, TCSAFLUSH, &ntio);*/
console_ansi_raw(); /* Allows get_key to get just 1 key sequence
(w/o delay or display */
-// tcgetattr(0, &ntio);
-// rosh_print_tc(&ntio);
+// tcgetattr(0, &ntio);
+// rosh_print_tc(&ntio);
}
/*
@@ -233,9 +233,9 @@ void rosh_console_raw()
*/
void rosh_console_std()
{
-// struct termios itio, ntio;
+// struct termios itio, ntio;
console_ansi_std();
-// tcsetattr(0, TCSANOW, &itio);
+// tcsetattr(0, TCSANOW, &itio);
}
/*
@@ -247,11 +247,11 @@ int rosh_getkey()
int inc;
inc = KEY_NONE;
-// rosh_console_raw();
+// rosh_console_raw();
while (inc == KEY_NONE){
inc = get_key(stdin, 6000);
}
-// rosh_console_std();
+// rosh_console_std();
return inc;
} /* rosh_getkey */
@@ -361,7 +361,7 @@ void rosh_dir_arg(const char *ifilstr, const char *pwdstr)
char filestr2[ROSH_PATH_SZ + 1];
int fd2, file2pos;
#ifdef __COM32__
-// int inchar;
+// int inchar;
char ty;
#endif /* __COM32__ */
#endif /* DO_DEBUG */
@@ -431,7 +431,7 @@ printf("DIR:'%s' %8d %8d\n", d->dd_name, d->dd_fd, d->dd_sect);
}
printf("@%8d:%8d:%4d ", (int)de->d_ino, (int)de->d_size, de->d_mode);
#endif /* DO_DEBUG */
-// printf("%s\n", de->d_name);
+// printf("%s\n", de->d_name);
printf("'%s'\n", de->d_name);
#ifdef DO_DEBUG
// inchar = fgetc(stdin);
@@ -539,7 +539,7 @@ printf("--(%d/%d @%d)\n", bufcnt, buflen, bufpos);
bufpos = buflen; break;
case ' ':
numln = rows - 1;
-// default:
+// default:
}
}
/*tcgetattr(0, &tio);
@@ -758,7 +758,7 @@ int rosh_prompt(const char *icmdstr)
int rv;
char cmdstr[ROSH_CMD_SZ];
char pwdstr[ROSH_PATH_SZ + 1], ipwdstr[ROSH_PATH_SZ + 1];
-/* int numchar;
+/* int numchar;
*/ char do_exit;
char *c;
@@ -796,7 +796,7 @@ int main(int argc, char *argv[])
/* Initialization */
rv = 0;
console_ansi_std();
-// console_ansi_raw();
+// console_ansi_raw();
if (argc != 1) {
rv = rosh_argcat(cmdstr, argc, argv, 1);
} else {
diff --git a/com32/samples/entrydump.c b/com32/samples/entrydump.c
index b36a30d3..f0ddd5df 100644
--- a/com32/samples/entrydump.c
+++ b/com32/samples/entrydump.c
@@ -35,8 +35,6 @@ int main(void)
{
const union syslinux_derivative_info *di;
const struct stack_frame *sf;
- int i;
- const unsigned char *p;
openconsole(&dev_null_r, &dev_stdcon_w);
diff --git a/core/bcopy32.inc b/core/bcopy32.inc
index f058a6f7..c7155574 100644
--- a/core/bcopy32.inc
+++ b/core/bcopy32.inc
@@ -127,7 +127,7 @@ simple_pm_call:
bits 32
.in_pm:
- mov eax,PM_DS32
+ mov ax,PM_DS32
mov ss,eax
lea esp,[ebp-8*4-2*4] ; Flat mode stack
mov es,eax
@@ -137,7 +137,7 @@ simple_pm_call:
; machine running on Intel VT hardware -- it can't
; deal with a partial transition, for no good reason.
- mov al,PM_DS16_RM ; Real-mode-like segment
+ mov al,PM_DS16 ; Real-mode-like segment
mov fs,eax
mov gs,eax
mov al,PM_TSS ; Intel VT really doesn't want
@@ -151,7 +151,7 @@ simple_pm_call:
jmp PM_CS16:.exit
bits 16
.exit:
- mov eax,PM_DS16_RM ; "Real-mode-like" data segment
+ mov ax,PM_DS16 ; "Real-mode-like" data segment
mov es,eax
mov ds,eax
mov ss,eax
@@ -189,29 +189,22 @@ simple_pm_call:
;
; We typically toggle A20 twice for every 64K transferred.
;
-%define io_delay call _io_delay
%define IO_DELAY_PORT 80h ; Invalid port (we hope!)
-%define disable_wait 32 ; How long to wait for a disable
-
-; Note the skip of 2 here
-%define A20_DUNNO 0 ; A20 type unknown
-%define A20_NONE 2 ; A20 always on?
-%define A20_BIOS 4 ; A20 BIOS enable
-%define A20_KBC 6 ; A20 through KBC
-%define A20_FAST 8 ; A20 through port 92h
slow_out: out dx, al ; Fall through
-_io_delay: out IO_DELAY_PORT,al
+%macro io_delay 0
out IO_DELAY_PORT,al
- ret
+ out IO_DELAY_PORT,al
+%endmacro
section .data
- align 2
+ alignz 2
A20Ptr dw a20_dunno
section .bss
-A20Test resw 1 ; Counter for testing A20 status
+ alignb 4
+A20Test resd 1 ; Counter for testing A20 status
A20Tries resb 1 ; Times until giving up on A20
section .text
@@ -220,30 +213,21 @@ enable_a20:
mov byte [cs:A20Tries],255 ; Times to try to make this work
try_enable_a20:
-;
-; Flush the caches
-;
-%if DO_WBINVD
- call try_wbinvd
-%endif
-
-;
-; If the A20 type is known, jump straight to type
-;
- jmp word [cs:A20Ptr]
;
-; First, see if we are on a system with no A20 gate
+; First, see if we are on a system with no A20 gate, or the A20 gate
+; is already enabled for us...
;
-a20_dunno:
a20_none:
- mov word [cs:A20Ptr], a20_none
call a20_test
jnz a20_done
+ ; Otherwise, see if we had something memorized...
+ jmp word [cs:A20Ptr]
;
; Next, try the BIOS (INT 15h AX=2401h)
;
+a20_dunno:
a20_bios:
mov word [cs:A20Ptr], a20_bios
mov ax,2401h
@@ -337,20 +321,24 @@ a20_done: popad
; This routine tests if A20 is enabled (ZF = 0). This routine
; must not destroy any register contents.
;
+; The no-write early out avoids the io_delay in the (presumably common)
+; case of A20 already enabled (e.g. from a previous call.)
+;
a20_test:
push es
push cx
- push ax
- mov cx,0FFFFh ; HMA = segment 0FFFFh
+ push eax
+ mov cx,0FFFFh ; HMA = segment 0FFFFh
mov es,cx
- mov cx,32 ; Loop count
- mov ax,[cs:A20Test]
-.a20_wait: inc ax
- mov [cs:A20Test],ax
- io_delay ; Serialize, and fix delay
- cmp ax,[es:A20Test+10h]
- loopz .a20_wait
-.a20_done: pop ax
+ mov eax,[cs:A20Test]
+ mov cx,32 ; Loop count
+ jmp .test ; First iteration = early out
+.wait: add eax,0x430aea41 ; A large prime number
+ mov [cs:A20Test],eax
+ io_delay ; Serialize, and fix delay
+.test: cmp eax,[es:A20Test+10h]
+ loopz .wait
+.done: pop eax
pop cx
pop es
ret
@@ -381,15 +369,6 @@ empty_8042:
.done: ret
;
-; Execute a WBINVD instruction if possible on this CPU
-;
-%if DO_WBINVD
-try_wbinvd:
- wbinvd
- ret
-%endif
-
-;
; The 32-bit copy and shuffle code is "special", so it is in its own file
;
%include "bcopyxx.inc"
diff --git a/core/bcopyxx.inc b/core/bcopyxx.inc
index 60f81723..b237b005 100644
--- a/core/bcopyxx.inc
+++ b/core/bcopyxx.inc
@@ -43,7 +43,7 @@ bcopyxx_start equ $
;
; Clobbers ESI, EDI, ECX.
;
-
+
pm_bcopy:
push ebx
push edx
@@ -236,17 +236,20 @@ pm_shuffle:
jmp edi ; Protected mode entry
; We have a real-mode entry point, so we need to return
- ; to real mode...
+ ; to real mode...
pm_shuffle_real_mode:
call .here
.here: pop ebx
mov eax,edi
- add ebx,bcopy_gdt.CS16-.here
- mov [ebx+2],ax
+ add ebx,bcopy_gdt-.here
+ mov [ebx+PM_CS16+2],ax
+ mov [ebx+PM_DS16+2],ax
shr eax,16
- mov [ebx+4],al
- mov [ebx+7],ah
- mov eax,PM_DS16_RM
+ mov [ebx+PM_CS16+4],al
+ mov [ebx+PM_CS16+7],ah
+ mov [ebx+PM_DS16+4],al
+ mov [ebx+PM_DS16+7],ah
+ mov ax,PM_DS16
mov ds,eax
mov es,eax
mov fs,eax
@@ -268,7 +271,7 @@ bcopy_gdt:
dd bcopy_gdt ; pointer for LGDT instruction
dw 0
- ; TSS segment to keep Intel VT happy. Intel VT is
+ ; TSS segment to keep Intel VT happy. Intel VT is
; unhappy about anything that doesn't smell like a
; full-blown 32-bit OS.
desc TSS
@@ -278,7 +281,7 @@ bcopy_gdt:
desc CS16
dd 0000ffffh ; 10h Code segment, use16, readable,
dd 00009b00h ; present, dpl 0, cover 64K
- desc DS16_RM
+ desc DS16
dd 0000ffffh ; 18h Data segment, use16, read/write,
dd 00009300h ; present, dpl 0, cover 64K
desc CS32
@@ -287,7 +290,7 @@ bcopy_gdt:
desc DS32
dd 0000ffffh ; 28h Data segment, use32, read/write,
dd 00cf9300h ; present, dpl 0, cover all 4G
-
+
bcopy_gdt_size: equ $-bcopy_gdt
alignz 4
diff --git a/core/bootsect.inc b/core/bootsect.inc
index 373c649d..b107eb5c 100644
--- a/core/bootsect.inc
+++ b/core/bootsect.inc
@@ -25,7 +25,7 @@
; Load a boot sector
;
is_bootsector:
-%if IS_SYSLINUX || IS_MDSLINUX
+%if IS_SYSLINUX
; Transfer zero bytes
push word 0
jmp short load_bootsec
@@ -48,7 +48,7 @@ load_bootsec:
mov eax,7C00h ; Entry point
mov [trackbuf],eax ; Copy to this address
-%if IS_SYSLINUX || IS_MDSLINUX
+%if IS_SYSLINUX
xor ecx,ecx
pop cx
@@ -61,7 +61,7 @@ load_bootsec:
xor edx,edx
xor esi,esi
-%if IS_SYSLINUX || IS_MDSLINUX || IS_EXTLINUX
+%if IS_SYSLINUX || IS_EXTLINUX
; Restore original FDC table
mov eax,[OrigFDCTabPtr]
mov [fdctab],eax
@@ -172,7 +172,7 @@ replace_bootstrap:
mov si,__replacestub_lma
mov cx,__replacestub_dwords
rep movsd
-
+
xor ecx,ecx
pop cx ; ECX <- length of list
diff --git a/core/com32.inc b/core/com32.inc
index 3a762a6b..72327929 100644
--- a/core/com32.inc
+++ b/core/com32.inc
@@ -196,7 +196,7 @@ com32_enter_rm:
bits 16
.in_pm16:
- mov ax,PM_DS16_RM ; Real-mode-like segment
+ mov ax,PM_DS16 ; Real-mode-like segment
mov es,ax
mov ds,ax
mov ss,ax
diff --git a/core/comboot.inc b/core/comboot.inc
index c169414f..4db0b3e0 100644
--- a/core/comboot.inc
+++ b/core/comboot.inc
@@ -599,7 +599,7 @@ comapi_derinfo:
mov P_DL,al
mov P_FS,cs
mov P_SI,OrigESDI
-%if IS_SYSLINUX || IS_MDSLINUX || IS_EXTLINUX
+%if IS_SYSLINUX || IS_EXTLINUX
mov P_ES,cs
mov P_BX,PartInfo
%elif IS_ISOLINUX
@@ -645,7 +645,7 @@ comapi_cleanup:
sub bp,sp ; unload_pxe may move the stack around
call unload_pxe
add bp,sp ; restore frame pointer...
-%elif IS_SYSLINUX || IS_MDSLINUX || IS_EXTLINUX
+%elif IS_SYSLINUX || IS_EXTLINUX
; Restore original FDC table
mov eax,[OrigFDCTabPtr]
mov [fdctab],eax
@@ -850,7 +850,7 @@ comapi_userfont:
;
; INT 22h AX=0019h Read disk
;
-%if IS_SYSLINUX || IS_MDSLINUX || IS_ISOLINUX || IS_EXTLINUX
+%if IS_SYSLINUX || IS_ISOLINUX || IS_EXTLINUX
comapi_readdisk:
mov esi,P_ESI ; Enforce ESI == EDI == 0, these
or esi,P_EDI ; are reserved for future expansion
diff --git a/core/config.inc b/core/config.inc
index 782cc798..5a3d1c5a 100644
--- a/core/config.inc
+++ b/core/config.inc
@@ -26,8 +26,6 @@ DEFAULT_BAUD equ 9600 ; Default baud rate for serial port
BAUD_DIVISOR equ 115200 ; Serial port parameter
MAX_FKEYS equ 12 ; Number of F-key help files
-%assign DO_WBINVD 0 ; Should we use WBINVD or not?
-
;
; Local boot supported
;
diff --git a/core/conio.inc b/core/conio.inc
index aa3fd0ef..8f5a2922 100644
--- a/core/conio.inc
+++ b/core/conio.inc
@@ -34,7 +34,7 @@ loadkeys:
; Make sure we are at EOF now...
call getc
jnc .done ; We should be at EOF now!
-
+
; It was okay, we can now move it into the KbdMap
mov si,trackbuf
mov di,KbdMap
diff --git a/core/cpuinit.inc b/core/cpuinit.inc
index 400df407..4d8cc2e7 100644
--- a/core/cpuinit.inc
+++ b/core/cpuinit.inc
@@ -39,32 +39,6 @@ dosram_k equ (real_mode_seg+0x1000) >> 6 ; Minimum DOS memory (K)
enough_ram:
skip_checks:
-;
-; Check if we're 386 (as opposed to 486+); if so we need to blank out
-; the WBINVD instruction
-;
-; We check for 486 by setting EFLAGS.AC
-;
-%if DO_WBINVD
- pushfd ; Save the good flags
- pushfd
- pop eax
- mov ebx,eax
- xor eax,(1 << 18) ; AC bit
- push eax
- popfd
- pushfd
- pop eax
- popfd ; Restore the original flags
- xor eax,ebx
- jnz is_486
-;
-; 386 - Looks like we better blot out the WBINVD instruction
-;
- mov byte [try_wbinvd],0c3h ; Near RET
-is_486:
-%endif ; DO_WBINVD
-
section .data
err_noram db 'It appears your computer has less than '
asciidec dosram_k
diff --git a/core/diskstart.inc b/core/diskstart.inc
new file mode 100644
index 00000000..c3881eab
--- /dev/null
+++ b/core/diskstart.inc
@@ -0,0 +1,681 @@
+; -----------------------------------------------------------------------
+;
+; Copyright 1994-2009 H. Peter Anvin - All Rights Reserved
+; Copyright 2009 Intel Corporation; author: H. Peter Anvin
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License as published by
+; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+; Boston MA 02110-1301, USA; either version 2 of the License, or
+; (at your option) any later version; incorporated herein by reference.
+;
+; -----------------------------------------------------------------------
+
+;
+; diskstart.inc
+;
+; Common early-bootstrap code for harddisk-based Syslinux derivatives.
+;
+
+ ; Expanded superblock
+ section .bss
+ alignb 8
+SuperInfo resq 16 ; The first 16 bytes expanded 8 times
+
+ section .text
+;
+; Some of the things that have to be saved very early are saved
+; "close" to the initial stack pointer offset, in order to
+; reduce the code size...
+;
+StackBuf equ $-44-32 ; Start the stack here (grow down - 4K)
+PartInfo equ StackBuf ; Saved partition table entry
+FloppyTable equ PartInfo+16 ; Floppy info table (must follow PartInfo)
+OrigFDCTabPtr equ StackBuf-8 ; The 2nd high dword on the stack
+OrigESDI equ StackBuf-4 ; The high dword on the stack
+
+;
+; Primary entry point. Tempting as though it may be, we can't put the
+; initial "cli" here; the jmp opcode in the first byte is part of the
+; "magic number" (using the term very loosely) for the DOS superblock.
+;
+bootsec equ $
+_start: jmp short start ; 2 bytes
+ nop ; 1 byte
+;
+; "Superblock" follows -- it's in the boot sector, so it's already
+; loaded and ready for us
+;
+bsOemName db MY_NAME ; The SYS command sets this, so...
+ zb 8-($-bsOemName)
+
+;
+; These are the fields we actually care about. We end up expanding them
+; all to dword size early in the code, so generate labels for both
+; the expanded and unexpanded versions.
+;
+%macro superb 1
+bx %+ %1 equ SuperInfo+($-superblock)*8+4
+bs %+ %1 equ $
+ zb 1
+%endmacro
+%macro superw 1
+bx %+ %1 equ SuperInfo+($-superblock)*8
+bs %+ %1 equ $
+ zw 1
+%endmacro
+%macro superd 1
+bx %+ %1 equ $ ; no expansion for dwords
+bs %+ %1 equ $
+ zd 1
+%endmacro
+superblock equ $
+ superw BytesPerSec
+ superb SecPerClust
+ superw ResSectors
+ superb FATs
+ superw RootDirEnts
+ superw Sectors
+ superb Media
+ superw FATsecs
+ superw SecPerTrack
+ superw Heads
+superinfo_size equ ($-superblock)-1 ; How much to expand
+ superd Hidden
+ superd HugeSectors
+ ;
+ ; This is as far as FAT12/16 and FAT32 are consistent
+ ;
+ ; FAT12/16 need 26 more bytes,
+ ; FAT32 need 54 more bytes
+ ;
+superblock_len_fat16 equ $-superblock+26
+superblock_len_fat32 equ $-superblock+54
+ zb 54 ; Maximum needed size
+superblock_max equ $-superblock
+
+SecPerClust equ bxSecPerClust
+;
+; Note we don't check the constraints above now; we did that at install
+; time (we hope!)
+;
+start:
+ cli ; No interrupts yet, please
+ cld ; Copy upwards
+;
+; Set up the stack
+;
+ xor ax,ax
+ mov ss,ax
+ mov sp,StackBuf ; Just below BSS
+ push es ; Save initial ES:DI -> $PnP pointer
+ push di
+ mov es,ax
+;
+; DS:SI may contain a partition table entry. Preserve it for us.
+;
+ mov cx,8 ; Save partition info
+ mov di,PartInfo
+ rep movsw
+
+ mov ds,ax ; Now we can initialize DS...
+
+;
+; Now sautee the BIOS floppy info block to that it will support decent-
+; size transfers; the floppy block is 11 bytes and is stored in the
+; INT 1Eh vector (brilliant waste of resources, eh?)
+;
+; Of course, if BIOSes had been properly programmed, we wouldn't have
+; had to waste precious space with this code.
+;
+ mov bx,fdctab
+ lfs si,[bx] ; FS:SI -> original fdctab
+ push fs ; Save on stack in case we need to bail
+ push si
+
+ ; Save the old fdctab even if hard disk so the stack layout
+ ; is the same. The instructions above do not change the flags
+ mov [DriveNumber],dl ; Save drive number in DL
+ and dl,dl ; If floppy disk (00-7F), assume no
+ ; partition table
+ js harddisk
+
+floppy:
+ mov cl,6 ; 12 bytes (CX == 0)
+ ; es:di -> FloppyTable already
+ ; This should be safe to do now, interrupts are off...
+ mov [bx],di ; FloppyTable
+ mov [bx+2],ax ; Segment 0
+ fs rep movsw ; Faster to move words
+ mov cl,[bsSecPerTrack] ; Patch the sector count
+ mov [di-8],cl
+ ; AX == 0 here
+ int 13h ; Some BIOSes need this
+
+ jmp short not_harddisk
+;
+; The drive number and possibly partition information was passed to us
+; by the BIOS or previous boot loader (MBR). Current "best practice" is to
+; trust that rather than what the superblock contains.
+;
+; Would it be better to zero out bsHidden if we don't have a partition table?
+;
+; Note: di points to beyond the end of PartInfo
+;
+harddisk:
+ test byte [di-16],7Fh ; Sanity check: "active flag" should
+ jnz no_partition ; be 00 or 80
+ mov eax,[di-8] ; Partition offset (dword)
+ mov [bsHidden],eax
+no_partition:
+;
+; Get disk drive parameters (don't trust the superblock.) Don't do this for
+; floppy drives -- INT 13:08 on floppy drives will (may?) return info about
+; what the *drive* supports, not about the *media*. Fortunately floppy disks
+; tend to have a fixed, well-defined geometry which is stored in the superblock.
+;
+ ; DL == drive # still
+ mov ah,08h
+ int 13h
+ jc no_driveparm
+ and ah,ah
+ jnz no_driveparm
+ shr dx,8
+ inc dx ; Contains # of heads - 1
+ mov [bsHeads],dx
+ and cx,3fh
+ mov [bsSecPerTrack],cx
+no_driveparm:
+not_harddisk:
+;
+; Ready to enable interrupts, captain
+;
+ sti
+
+;
+; Do we have EBIOS (EDD)?
+;
+eddcheck:
+ mov bx,55AAh
+ mov ah,41h ; EDD existence query
+ mov dl,[DriveNumber]
+ int 13h
+ jc .noedd
+ cmp bx,0AA55h
+ jne .noedd
+ test cl,1 ; Extended disk access functionality set
+ jz .noedd
+ ;
+ ; We have EDD support...
+ ;
+ mov byte [getlinsec.jmp+1],(getlinsec_ebios-(getlinsec.jmp+2))
+.noedd:
+
+;
+; Load the first sector of LDLINUX.SYS; this used to be all proper
+; with parsing the superblock and root directory; it doesn't fit
+; together with EBIOS support, unfortunately.
+;
+ mov eax,[FirstSector] ; Sector start
+ mov bx,ldlinux_sys ; Where to load it
+ call getonesec
+
+ ; Some modicum of integrity checking
+ cmp dword [ldlinux_magic+4],LDLINUX_MAGIC^HEXDATE
+ jne kaboom
+
+ ; Go for it...
+ jmp ldlinux_ent
+
+;
+; getonesec: get one disk sector
+;
+getonesec:
+ mov bp,1 ; One sector
+ ; Fall through
+
+;
+; getlinsec: load a sequence of BP floppy sector given by the linear sector
+; number in EAX into the buffer at ES:BX. We try to optimize
+; by loading up to a whole track at a time, but the user
+; is responsible for not crossing a 64K boundary.
+; (Yes, BP is weird for a count, but it was available...)
+;
+; On return, BX points to the first byte after the transferred
+; block.
+;
+; This routine assumes CS == DS, and trashes most registers.
+;
+; Stylistic note: use "xchg" instead of "mov" when the source is a register
+; that is dead from that point; this saves space. However, please keep
+; the order to dst,src to keep things sane.
+;
+getlinsec:
+ add eax,[bsHidden] ; Add partition offset
+ xor edx,edx ; Zero-extend LBA (eventually allow 64 bits)
+
+.jmp: jmp strict short getlinsec_cbios
+
+;
+; getlinsec_ebios:
+;
+; getlinsec implementation for EBIOS (EDD)
+;
+getlinsec_ebios:
+.loop:
+ push bp ; Sectors left
+.retry2:
+ call maxtrans ; Enforce maximum transfer size
+ movzx edi,bp ; Sectors we are about to read
+ mov cx,retry_count
+.retry:
+
+ ; Form DAPA on stack
+ push edx
+ push eax
+ push es
+ push bx
+ push di
+ push word 16
+ mov si,sp
+ pushad
+ mov dl,[DriveNumber]
+ push ds
+ push ss
+ pop ds ; DS <- SS
+ mov ah,42h ; Extended Read
+ int 13h
+ pop ds
+ popad
+ lea sp,[si+16] ; Remove DAPA
+ jc .error
+ pop bp
+ add eax,edi ; Advance sector pointer
+ sub bp,di ; Sectors left
+ shl di,SECTOR_SHIFT ; 512-byte sectors
+ add bx,di ; Advance buffer pointer
+ and bp,bp
+ jnz .loop
+
+ ret
+
+.error:
+ ; Some systems seem to get "stuck" in an error state when
+ ; using EBIOS. Doesn't happen when using CBIOS, which is
+ ; good, since some other systems get timeout failures
+ ; waiting for the floppy disk to spin up.
+
+ pushad ; Try resetting the device
+ xor ax,ax
+ mov dl,[DriveNumber]
+ int 13h
+ popad
+ loop .retry ; CX-- and jump if not zero
+
+ ;shr word [MaxTransfer],1 ; Reduce the transfer size
+ ;jnz .retry2
+
+ ; Total failure. Try falling back to CBIOS.
+ mov byte [getlinsec.jmp+1],(getlinsec_cbios-(getlinsec.jmp+2))
+ ;mov byte [MaxTransfer],63 ; Max possibe CBIOS transfer
+
+ pop bp
+ ; ... fall through ...
+
+;
+; getlinsec_cbios:
+;
+; getlinsec implementation for legacy CBIOS
+;
+getlinsec_cbios:
+.loop:
+ push edx
+ push eax
+ push bp
+ push bx
+
+ movzx esi,word [bsSecPerTrack]
+ movzx edi,word [bsHeads]
+ ;
+ ; Dividing by sectors to get (track,sector): we may have
+ ; up to 2^18 tracks, so we need to use 32-bit arithmetric.
+ ;
+ div esi
+ xor cx,cx
+ xchg cx,dx ; CX <- sector index (0-based)
+ ; EDX <- 0
+ ; eax = track #
+ div edi ; Convert track to head/cyl
+
+ ; We should test this, but it doesn't fit...
+ ; cmp eax,1023
+ ; ja .error
+
+ ;
+ ; Now we have AX = cyl, DX = head, CX = sector (0-based),
+ ; BP = sectors to transfer, SI = bsSecPerTrack,
+ ; ES:BX = data target
+ ;
+
+ call maxtrans ; Enforce maximum transfer size
+
+ ; Must not cross track boundaries, so BP <= SI-CX
+ sub si,cx
+ cmp bp,si
+ jna .bp_ok
+ mov bp,si
+.bp_ok:
+
+ shl ah,6 ; Because IBM was STOOPID
+ ; and thought 8 bits were enough
+ ; then thought 10 bits were enough...
+ inc cx ; Sector numbers are 1-based, sigh
+ or cl,ah
+ mov ch,al
+ mov dh,dl
+ mov dl,[DriveNumber]
+ xchg ax,bp ; Sector to transfer count
+ mov ah,02h ; Read sectors
+ mov bp,retry_count
+.retry:
+ pushad
+ int 13h
+ popad
+ jc .error
+.resume:
+ movzx ecx,al ; ECX <- sectors transferred
+ shl ax,SECTOR_SHIFT ; Convert sectors in AL to bytes in AX
+ pop bx
+ add bx,ax
+ pop bp
+ pop eax
+ pop edx
+ add eax,ecx
+ sub bp,cx
+ jnz .loop
+ ret
+
+.error:
+ dec bp
+ jnz .retry
+
+ xchg ax,bp ; Sectors transferred <- 0
+ shr word [MaxTransfer],1
+ jnz .resume
+ ; Fall through to disk_error
+
+;
+; kaboom: write a message and bail out.
+;
+disk_error:
+kaboom:
+ xor si,si
+ mov ss,si
+ mov sp,StackBuf-4 ; Reset stack
+ mov ds,si ; Reset data segment
+ pop dword [fdctab] ; Restore FDC table
+.patch: ; When we have full code, intercept here
+ mov si,bailmsg
+
+ ; Write error message, this assumes screen page 0
+.loop: lodsb
+ and al,al
+ jz .done
+ mov ah,0Eh ; Write to screen as TTY
+ mov bx,0007h ; Attribute
+ int 10h
+ jmp short .loop
+.done:
+ cbw ; AH <- 0
+.again: int 16h ; Wait for keypress
+ ; NB: replaced by int 18h if
+ ; chosen at install time..
+ int 19h ; And try once more to boot...
+.norge: jmp short .norge ; If int 19h returned; this is the end
+
+;
+; Truncate BP to MaxTransfer
+;
+maxtrans:
+ cmp bp,[MaxTransfer]
+ jna .ok
+ mov bp,[MaxTransfer]
+.ok: ret
+
+;
+; Error message on failure
+;
+bailmsg: db 'Boot error', 0Dh, 0Ah, 0
+
+ ; This fails if the boot sector overflows
+ zb 1F8h-($-$$)
+
+FirstSector dd 0xDEADBEEF ; Location of sector 1
+MaxTransfer dw 0x007F ; Max transfer size
+
+; This field will be filled in 0xAA55 by the installer, but we abuse it
+; to house a pointer to the INT 16h instruction at
+; kaboom.again, which gets patched to INT 18h in RAID mode.
+bootsignature dw kaboom.again-bootsec
+
+;
+; ===========================================================================
+; End of boot sector
+; ===========================================================================
+; Start of LDLINUX.SYS
+; ===========================================================================
+
+ldlinux_sys:
+
+syslinux_banner db 0Dh, 0Ah
+ db MY_NAME, ' ', VERSION_STR, ' ', DATE_STR, ' ', 0
+ db 0Dh, 0Ah, 1Ah ; EOF if we "type" this in DOS
+
+ alignz 8
+ldlinux_magic dd LDLINUX_MAGIC
+ dd LDLINUX_MAGIC^HEXDATE
+
+;
+; This area is patched by the installer. It is found by looking for
+; LDLINUX_MAGIC, plus 8 bytes.
+;
+patch_area:
+LDLDwords dw 0 ; Total dwords starting at ldlinux_sys,
+ ; not including ADVs
+LDLSectors dw 0 ; Number of sectors - (bootsec+this sec)
+ ; but including any ADVs
+CheckSum dd 0 ; Checksum starting at ldlinux_sys
+ ; value = LDLINUX_MAGIC - [sum of dwords]
+%if IS_EXTLINUX
+CurrentDir dd 2 ; "Current" directory inode number
+%endif
+
+; Space for up to 64 sectors, the theoretical maximum
+SectorPtrs times 64 dd 0
+
+ldlinux_ent:
+;
+; Note that some BIOSes are buggy and run the boot sector at 07C0:0000
+; instead of 0000:7C00 and the like. We don't want to add anything
+; more to the boot sector, so it is written to not assume a fixed
+; value in CS, but we don't want to deal with that anymore from now
+; on.
+;
+ jmp 0:.next
+.next:
+
+;
+; Tell the user we got this far
+;
+ mov si,syslinux_banner
+ call writestr_early
+
+;
+; Tell the user if we're using EBIOS or CBIOS
+;
+print_bios:
+ mov si,cbios_name
+ cmp byte [getlinsec.jmp+1],(getlinsec_ebios-(getlinsec.jmp+2))
+ jne .cbios
+ mov si,ebios_name
+.cbios:
+ mov [BIOSName],si
+ call writestr_early
+
+ section .bss
+%define HAVE_BIOSNAME 1
+BIOSName resw 1
+
+ section .text
+;
+; Now we read the rest of LDLINUX.SYS. Don't bother loading the first
+; sector again, though.
+;
+load_rest:
+ mov si,SectorPtrs
+ mov bx,7C00h+2*SECTOR_SIZE ; Where we start loading
+ mov cx,[LDLSectors]
+
+.get_chunk:
+ jcxz .done
+ xor bp,bp
+ lodsd ; First sector of this chunk
+
+ mov edx,eax
+
+.make_chunk:
+ inc bp
+ dec cx
+ jz .chunk_ready
+ inc edx ; Next linear sector
+ cmp [si],edx ; Does it match
+ jnz .chunk_ready ; If not, this is it
+ add si,4 ; If so, add sector to chunk
+ jmp short .make_chunk
+
+.chunk_ready:
+ call getlinsecsr
+ shl bp,SECTOR_SHIFT
+ add bx,bp
+ jmp .get_chunk
+
+.done:
+
+;
+; All loaded up, verify that we got what we needed.
+; Note: the checksum field is embedded in the checksum region, so
+; by the time we get to the end it should all cancel out.
+;
+verify_checksum:
+ mov si,ldlinux_sys
+ mov cx,[LDLDwords]
+ mov edx,-LDLINUX_MAGIC
+.checksum:
+ lodsd
+ add edx,eax
+ loop .checksum
+
+ and edx,edx ; Should be zero
+ jz all_read ; We're cool, go for it!
+
+;
+; Uh-oh, something went bad...
+;
+ mov si,checksumerr_msg
+ call writestr_early
+ jmp kaboom
+
+;
+; -----------------------------------------------------------------------------
+; Subroutines that have to be in the first sector
+; -----------------------------------------------------------------------------
+
+;
+;
+; writestr_early: write a null-terminated string to the console
+; This assumes we're on page 0. This is only used for early
+; messages, so it should be OK.
+;
+writestr_early:
+ pushad
+.loop: lodsb
+ and al,al
+ jz .return
+ mov ah,0Eh ; Write to screen as TTY
+ mov bx,0007h ; Attribute
+ int 10h
+ jmp short .loop
+.return: popad
+ ret
+
+
+; getlinsecsr: save registers, call getlinsec, restore registers
+;
+getlinsecsr: pushad
+ call getlinsec
+ popad
+ ret
+
+;
+; Checksum error message
+;
+checksumerr_msg db ' Load error - ', 0 ; Boot failed appended
+
+;
+; BIOS type string
+;
+cbios_name db 'CBIOS', 0
+ebios_name db 'EBIOS', 0
+
+;
+; Debug routine
+;
+%ifdef debug
+safedumpregs:
+ cmp word [Debug_Magic],0D00Dh
+ jnz nc_return
+ jmp dumpregs
+%endif
+
+rl_checkpt equ $ ; Must be <= 8000h
+
+rl_checkpt_off equ ($-$$)
+%ifndef DEPEND
+%if rl_checkpt_off > 400h
+%error "Sector 1 overflow"
+%endif
+%endif
+
+; ----------------------------------------------------------------------------
+; End of code and data that have to be in the first sector
+; ----------------------------------------------------------------------------
+
+all_read:
+;
+; Let the user (and programmer!) know we got this far. This used to be
+; in Sector 1, but makes a lot more sense here.
+;
+ mov si,copyright_str
+ call writestr_early
+
+
+;
+; Insane hack to expand the DOS superblock to dwords
+;
+expand_super:
+ xor eax,eax
+ mov si,superblock
+ mov di,SuperInfo
+ mov cx,superinfo_size
+.loop:
+ lodsw
+ dec si
+ stosd ; Store expanded word
+ xor ah,ah
+ stosd ; Store expanded byte
+ loop .loop
+
+;
+; Fall through to the mainline code...
+;
+ section .text
diff --git a/core/dnsresolv.inc b/core/dnsresolv.inc
index 9b0eb0a0..c2c429cb 100644
--- a/core/dnsresolv.inc
+++ b/core/dnsresolv.inc
@@ -360,7 +360,7 @@ dns_resolv:
add si,ax
loop .parseanswer
-.badness:
+.badness:
; We got back no data from this server.
; Unfortunately, for a recursive, non-authoritative
; query there is no such thing as an NXDOMAIN reply,
diff --git a/core/extlinux.asm b/core/extlinux.asm
index a9e51d57..d54bad51 100644
--- a/core/extlinux.asm
+++ b/core/extlinux.asm
@@ -104,9 +104,7 @@ trackbuf resb trackbufsize ; Track buffer goes here
section .bss
SuperBlock resb 1024 ; ext2 superblock
-SuperInfo resq 16 ; DOS superblock expanded
ClustSize resd 1 ; Bytes/cluster ("block")
-SecPerClust resd 1 ; Sectors/cluster
ClustMask resd 1 ; Sectors/cluster - 1
PtrsPerBlock1 resd 1 ; Pointers/cluster
PtrsPerBlock2 resd 1 ; (Pointers/cluster)^2
@@ -117,649 +115,10 @@ ClustByteShift resb 1 ; Shift count for bytes/cluster
alignb open_file_t_size
Files resb MAX_OPEN*open_file_t_size
- section .text
-;
-; Some of the things that have to be saved very early are saved
-; "close" to the initial stack pointer offset, in order to
-; reduce the code size...
-;
-StackBuf equ $-44-32 ; Start the stack here (grow down - 4K)
-PartInfo equ StackBuf ; Saved partition table entry
-FloppyTable equ PartInfo+16 ; Floppy info table (must follow PartInfo)
-OrigFDCTabPtr equ StackBuf-8 ; The 2nd high dword on the stack
-OrigESDI equ StackBuf-4 ; The high dword on the stack
-
-;
-; Primary entry point. Tempting as though it may be, we can't put the
-; initial "cli" here; the jmp opcode in the first byte is part of the
-; "magic number" (using the term very loosely) for the DOS superblock.
-;
-bootsec equ $
-_start: jmp short start ; 2 bytes
- nop ; 1 byte
-;
-; "Superblock" follows -- it's in the boot sector, so it's already
-; loaded and ready for us
-;
-bsOemName db 'EXTLINUX' ; The SYS command sets this, so...
-;
-; These are the fields we actually care about. We end up expanding them
-; all to dword size early in the code, so generate labels for both
-; the expanded and unexpanded versions.
-;
-%macro superb 1
-bx %+ %1 equ SuperInfo+($-superblock)*8+4
-bs %+ %1 equ $
- zb 1
-%endmacro
-%macro superw 1
-bx %+ %1 equ SuperInfo+($-superblock)*8
-bs %+ %1 equ $
- zw 1
-%endmacro
-%macro superd 1
-bx %+ %1 equ $ ; no expansion for dwords
-bs %+ %1 equ $
- zd 1
-%endmacro
-superblock equ $
- superw BytesPerSec
- superb SecPerClust
- superw ResSectors
- superb FATs
- superw RootDirEnts
- superw Sectors
- superb Media
- superw FATsecs
- superw SecPerTrack
- superw Heads
-superinfo_size equ ($-superblock)-1 ; How much to expand
- superd Hidden
- superd HugeSectors
- ;
- ; This is as far as FAT12/16 and FAT32 are consistent
- ;
- zb 54 ; FAT12/16 need 26 more bytes,
- ; FAT32 need 54 more bytes
-superblock_len equ $-superblock
-
-;
-; Note we don't check the constraints above now; we did that at install
-; time (we hope!)
-;
-start:
- cli ; No interrupts yet, please
- cld ; Copy upwards
-;
-; Set up the stack
-;
- xor ax,ax
- mov ss,ax
- mov sp,StackBuf ; Just below BSS
- push es ; Save initial ES:DI -> $PnP pointer
- push di
- mov es,ax
-;
-; DS:SI may contain a partition table entry. Preserve it for us.
-;
- mov cx,8 ; Save partition info
- mov di,PartInfo
- rep movsw
-
- mov ds,ax ; Now we can initialize DS...
-
-;
-; Now sautee the BIOS floppy info block to that it will support decent-
-; size transfers; the floppy block is 11 bytes and is stored in the
-; INT 1Eh vector (brilliant waste of resources, eh?)
-;
-; Of course, if BIOSes had been properly programmed, we wouldn't have
-; had to waste precious space with this code.
-;
- mov bx,fdctab
- lfs si,[bx] ; FS:SI -> original fdctab
- push fs ; Save on stack in case we need to bail
- push si
-
- ; Save the old fdctab even if hard disk so the stack layout
- ; is the same. The instructions above do not change the flags
- mov [DriveNumber],dl ; Save drive number in DL
- and dl,dl ; If floppy disk (00-7F), assume no
- ; partition table
- js harddisk
-
-floppy:
- mov cl,6 ; 12 bytes (CX == 0)
- ; es:di -> FloppyTable already
- ; This should be safe to do now, interrupts are off...
- mov [bx],di ; FloppyTable
- mov [bx+2],ax ; Segment 0
- fs rep movsw ; Faster to move words
- mov cl,[bsSecPerTrack] ; Patch the sector count
- mov [di-8],cl
- ; AX == 0 here
- int 13h ; Some BIOSes need this
-
- jmp short not_harddisk
-;
-; The drive number and possibly partition information was passed to us
-; by the BIOS or previous boot loader (MBR). Current "best practice" is to
-; trust that rather than what the superblock contains.
-;
-; Would it be better to zero out bsHidden if we don't have a partition table?
-;
-; Note: di points to beyond the end of PartInfo
-;
-harddisk:
- test byte [di-16],7Fh ; Sanity check: "active flag" should
- jnz no_partition ; be 00 or 80
- mov eax,[di-8] ; Partition offset (dword)
- mov [bsHidden],eax
-no_partition:
-;
-; Get disk drive parameters (don't trust the superblock.) Don't do this for
-; floppy drives -- INT 13:08 on floppy drives will (may?) return info about
-; what the *drive* supports, not about the *media*. Fortunately floppy disks
-; tend to have a fixed, well-defined geometry which is stored in the superblock.
-;
- ; DL == drive # still
- mov ah,08h
- int 13h
- jc no_driveparm
- and ah,ah
- jnz no_driveparm
- shr dx,8
- inc dx ; Contains # of heads - 1
- mov [bsHeads],dx
- and cx,3fh
- mov [bsSecPerTrack],cx
-no_driveparm:
-not_harddisk:
-;
-; Ready to enable interrupts, captain
-;
- sti
-
-;
-; Do we have EBIOS (EDD)?
-;
-eddcheck:
- mov bx,55AAh
- mov ah,41h ; EDD existence query
- mov dl,[DriveNumber]
- int 13h
- jc .noedd
- cmp bx,0AA55h
- jne .noedd
- test cl,1 ; Extended disk access functionality set
- jz .noedd
- ;
- ; We have EDD support...
- ;
- mov byte [getlinsec.jmp+1],(getlinsec_ebios-(getlinsec.jmp+2))
-.noedd:
-
-;
-; Load the first sector of LDLINUX.SYS; this used to be all proper
-; with parsing the superblock and root directory; it doesn't fit
-; together with EBIOS support, unfortunately.
-;
- mov eax,[FirstSector] ; Sector start
- mov bx,ldlinux_sys ; Where to load it
- call getonesec
-
- ; Some modicum of integrity checking
- cmp dword [ldlinux_magic+4],LDLINUX_MAGIC^HEXDATE
- jne kaboom
-
- ; Go for it...
- jmp ldlinux_ent
-
-;
-; getonesec: get one disk sector
-;
-getonesec:
- mov bp,1 ; One sector
- ; Fall through
-
-;
-; getlinsec: load a sequence of BP floppy sector given by the linear sector
-; number in EAX into the buffer at ES:BX. We try to optimize
-; by loading up to a whole track at a time, but the user
-; is responsible for not crossing a 64K boundary.
-; (Yes, BP is weird for a count, but it was available...)
-;
-; On return, BX points to the first byte after the transferred
-; block.
-;
-; This routine assumes CS == DS, and trashes most registers.
-;
-; Stylistic note: use "xchg" instead of "mov" when the source is a register
-; that is dead from that point; this saves space. However, please keep
-; the order to dst,src to keep things sane.
-;
-getlinsec:
- add eax,[bsHidden] ; Add partition offset
- xor edx,edx ; Zero-extend LBA (eventually allow 64 bits)
-
-.jmp: jmp strict short getlinsec_cbios
-
-;
-; getlinsec_ebios:
-;
-; getlinsec implementation for EBIOS (EDD)
-;
-getlinsec_ebios:
-.loop:
- push bp ; Sectors left
-.retry2:
- call maxtrans ; Enforce maximum transfer size
- movzx edi,bp ; Sectors we are about to read
- mov cx,retry_count
-.retry:
-
- ; Form DAPA on stack
- push edx
- push eax
- push es
- push bx
- push di
- push word 16
- mov si,sp
- pushad
- mov dl,[DriveNumber]
- push ds
- push ss
- pop ds ; DS <- SS
- mov ah,42h ; Extended Read
- int 13h
- pop ds
- popad
- lea sp,[si+16] ; Remove DAPA
- jc .error
- pop bp
- add eax,edi ; Advance sector pointer
- sub bp,di ; Sectors left
- shl di,SECTOR_SHIFT ; 512-byte sectors
- add bx,di ; Advance buffer pointer
- and bp,bp
- jnz .loop
-
- ret
-
-.error:
- ; Some systems seem to get "stuck" in an error state when
- ; using EBIOS. Doesn't happen when using CBIOS, which is
- ; good, since some other systems get timeout failures
- ; waiting for the floppy disk to spin up.
-
- pushad ; Try resetting the device
- xor ax,ax
- mov dl,[DriveNumber]
- int 13h
- popad
- loop .retry ; CX-- and jump if not zero
-
- ;shr word [MaxTransfer],1 ; Reduce the transfer size
- ;jnz .retry2
-
- ; Total failure. Try falling back to CBIOS.
- mov byte [getlinsec.jmp+1],(getlinsec_cbios-(getlinsec.jmp+2))
- ;mov byte [MaxTransfer],63 ; Max possibe CBIOS transfer
-
- pop bp
- ; ... fall through ...
-
-;
-; getlinsec_cbios:
-;
-; getlinsec implementation for legacy CBIOS
-;
-getlinsec_cbios:
-.loop:
- push edx
- push eax
- push bp
- push bx
-
- movzx esi,word [bsSecPerTrack]
- movzx edi,word [bsHeads]
- ;
- ; Dividing by sectors to get (track,sector): we may have
- ; up to 2^18 tracks, so we need to use 32-bit arithmetric.
- ;
- div esi
- xor cx,cx
- xchg cx,dx ; CX <- sector index (0-based)
- ; EDX <- 0
- ; eax = track #
- div edi ; Convert track to head/cyl
-
- ; We should test this, but it doesn't fit...
- ; cmp eax,1023
- ; ja .error
-
- ;
- ; Now we have AX = cyl, DX = head, CX = sector (0-based),
- ; BP = sectors to transfer, SI = bsSecPerTrack,
- ; ES:BX = data target
- ;
-
- call maxtrans ; Enforce maximum transfer size
-
- ; Must not cross track boundaries, so BP <= SI-CX
- sub si,cx
- cmp bp,si
- jna .bp_ok
- mov bp,si
-.bp_ok:
-
- shl ah,6 ; Because IBM was STOOPID
- ; and thought 8 bits were enough
- ; then thought 10 bits were enough...
- inc cx ; Sector numbers are 1-based, sigh
- or cl,ah
- mov ch,al
- mov dh,dl
- mov dl,[DriveNumber]
- xchg ax,bp ; Sector to transfer count
- mov ah,02h ; Read sectors
- mov bp,retry_count
-.retry:
- pushad
- int 13h
- popad
- jc .error
-.resume:
- movzx ecx,al ; ECX <- sectors transferred
- shl ax,SECTOR_SHIFT ; Convert sectors in AL to bytes in AX
- pop bx
- add bx,ax
- pop bp
- pop eax
- pop edx
- add eax,ecx
- sub bp,cx
- jnz .loop
- ret
-
-.error:
- dec bp
- jnz .retry
-
- xchg ax,bp ; Sectors transferred <- 0
- shr word [MaxTransfer],1
- jnz .resume
- ; Fall through to disk_error
-
-;
-; kaboom: write a message and bail out.
-;
-disk_error:
-kaboom:
- xor si,si
- mov ss,si
- mov sp,StackBuf-4 ; Reset stack
- mov ds,si ; Reset data segment
- pop dword [fdctab] ; Restore FDC table
-.patch: ; When we have full code, intercept here
- mov si,bailmsg
-
- ; Write error message, this assumes screen page 0
-.loop: lodsb
- and al,al
- jz .done
- mov ah,0Eh ; Write to screen as TTY
- mov bx,0007h ; Attribute
- int 10h
- jmp short .loop
-.done:
- cbw ; AH <- 0
-.again: int 16h ; Wait for keypress
- ; NB: replaced by int 18h if
- ; chosen at install time..
- int 19h ; And try once more to boot...
-.norge: jmp short .norge ; If int 19h returned; this is the end
-
-;
-; Truncate BP to MaxTransfer
-;
-maxtrans:
- cmp bp,[MaxTransfer]
- jna .ok
- mov bp,[MaxTransfer]
-.ok: ret
-
-;
-; Error message on failure
-;
-bailmsg: db 'Boot error', 0Dh, 0Ah, 0
-
- ; This fails if the boot sector overflows
- zb 1F8h-($-$$)
-
-FirstSector dd 0xDEADBEEF ; Location of sector 1
-MaxTransfer dw 0x007F ; Max transfer size
-
-; This field will be filled in 0xAA55 by the installer, but we abuse it
-; to house a pointer to the INT 16h instruction at
-; kaboom.again, which gets patched to INT 18h in RAID mode.
-bootsignature dw kaboom.again-bootsec
-
-;
-; ===========================================================================
-; End of boot sector
-; ===========================================================================
-; Start of LDLINUX.SYS
-; ===========================================================================
-
-ldlinux_sys:
-
-syslinux_banner db 0Dh, 0Ah
- db 'EXTLINUX '
- db VERSION_STR, ' ', DATE_STR, ' ', 0
- db 0Dh, 0Ah, 1Ah ; EOF if we "type" this in DOS
-
- alignz 8
-ldlinux_magic dd LDLINUX_MAGIC
- dd LDLINUX_MAGIC^HEXDATE
-
-;
-; This area is patched by the installer. It is found by looking for
-; LDLINUX_MAGIC, plus 8 bytes.
-;
-patch_area:
-LDLDwords dw 0 ; Total dwords starting at ldlinux_sys,
- ; not including ADVs
-LDLSectors dw 0 ; Number of sectors, not including
- ; bootsec & this sec, but including the two ADVs
-CheckSum dd 0 ; Checksum starting at ldlinux_sys
- ; value = LDLINUX_MAGIC - [sum of dwords]
-CurrentDir dd 2 ; "Current" directory inode number
-
-; Space for up to 64 sectors, the theoretical maximum
-SectorPtrs times 64 dd 0
-
-ldlinux_ent:
-;
-; Note that some BIOSes are buggy and run the boot sector at 07C0:0000
-; instead of 0000:7C00 and the like. We don't want to add anything
-; more to the boot sector, so it is written to not assume a fixed
-; value in CS, but we don't want to deal with that anymore from now
-; on.
-;
- jmp 0:.next
-.next:
-
-;
-; Tell the user we got this far
-;
- mov si,syslinux_banner
- call writestr_early
-
-;
-; Tell the user if we're using EBIOS or CBIOS
-;
-print_bios:
- mov si,cbios_name
- cmp byte [getlinsec.jmp+1],(getlinsec_ebios-(getlinsec.jmp+2))
- jne .cbios
- mov si,ebios_name
-.cbios:
- mov [BIOSName],si
- call writestr_early
-
- section .bss
-%define HAVE_BIOSNAME 1
-BIOSName resw 1
-
- section .text
-;
-; Now we read the rest of LDLINUX.SYS. Don't bother loading the first
-; sector again, though.
-;
-load_rest:
- mov si,SectorPtrs
- mov bx,7C00h+2*SECTOR_SIZE ; Where we start loading
- mov cx,[LDLSectors]
-
-.get_chunk:
- jcxz .done
- xor bp,bp
- lodsd ; First sector of this chunk
-
- mov edx,eax
-
-.make_chunk:
- inc bp
- dec cx
- jz .chunk_ready
- inc edx ; Next linear sector
- cmp [si],edx ; Does it match
- jnz .chunk_ready ; If not, this is it
- add si,4 ; If so, add sector to chunk
- jmp short .make_chunk
-
-.chunk_ready:
- call getlinsecsr
- shl bp,SECTOR_SHIFT
- add bx,bp
- jmp .get_chunk
-
-.done:
-
;
-; All loaded up, verify that we got what we needed.
-; Note: the checksum field is embedded in the checksum region, so
-; by the time we get to the end it should all cancel out.
+; Common bootstrap code for disk-based derivatives
;
-verify_checksum:
- mov si,ldlinux_sys
- mov cx,[LDLDwords]
- mov edx,-LDLINUX_MAGIC
-.checksum:
- lodsd
- add edx,eax
- loop .checksum
-
- and edx,edx ; Should be zero
- jz all_read ; We're cool, go for it!
-
-;
-; Uh-oh, something went bad...
-;
- mov si,checksumerr_msg
- call writestr_early
- jmp kaboom
-
-;
-; -----------------------------------------------------------------------------
-; Subroutines that have to be in the first sector
-; -----------------------------------------------------------------------------
-
-;
-;
-; writestr_early: write a null-terminated string to the console
-; This assumes we're on page 0. This is only used for early
-; messages, so it should be OK.
-;
-writestr_early:
- pushad
-.loop: lodsb
- and al,al
- jz .return
- mov ah,0Eh ; Write to screen as TTY
- mov bx,0007h ; Attribute
- int 10h
- jmp short .loop
-.return: popad
- ret
-
-
-; getlinsecsr: save registers, call getlinsec, restore registers
-;
-getlinsecsr: pushad
- call getlinsec
- popad
- ret
-
-;
-; Checksum error message
-;
-checksumerr_msg db ' Load error - ', 0 ; Boot failed appended
-
-;
-; BIOS type string
-;
-cbios_name db 'CBIOS', 0
-ebios_name db 'EBIOS', 0
-
-;
-; Debug routine
-;
-%ifdef debug
-safedumpregs:
- cmp word [Debug_Magic],0D00Dh
- jnz nc_return
- jmp dumpregs
-%endif
-
-rl_checkpt equ $ ; Must be <= 8000h
-
-rl_checkpt_off equ ($-$$)
-%ifndef DEPEND
-%if rl_checkpt_off > 400h
-%error "Sector 1 overflow"
-%endif
-%endif
-
-; ----------------------------------------------------------------------------
-; End of code and data that have to be in the first sector
-; ----------------------------------------------------------------------------
-
-all_read:
-;
-; Let the user (and programmer!) know we got this far. This used to be
-; in Sector 1, but makes a lot more sense here.
-;
- mov si,copyright_str
- call writestr_early
-
-;
-; Insane hack to expand the DOS superblock to dwords
-;
-expand_super:
- xor eax,eax
- mov si,superblock
- mov di,SuperInfo
- mov cx,superinfo_size
-.loop:
- lodsw
- dec si
- stosd ; Store expanded word
- xor ah,ah
- stosd ; Store expanded byte
- loop .loop
+%include "diskstart.inc"
;
; Load the real (ext2) superblock; 1024 bytes long at offset 1024
diff --git a/core/highmem.inc b/core/highmem.inc
index 69652b7f..5ae3abea 100644
--- a/core/highmem.inc
+++ b/core/highmem.inc
@@ -71,7 +71,7 @@ get_e820:
;
test byte [E820Buf+20],1 ; AddressRangeEnabled
jz .not_ram
-.no_ext_attr:
+.no_ext_attr:
;
; Look for a memory block starting at <= 1 MB and continuing upward
;
diff --git a/core/isolinux.asm b/core/isolinux.asm
index 68c601be..c5545bad 100644
--- a/core/isolinux.asm
+++ b/core/isolinux.asm
@@ -232,7 +232,7 @@ bi_end:
; Custom entry point for the hybrid-mode disk.
; The following values will have been pushed onto the
; entry stack:
- ; - CBIOS Heads
+ ; - CBIOS Heads
; - CBIOS Sectors
; - EBIOS flag
; - DX (including drive number)
@@ -754,7 +754,7 @@ getlinsec: jmp word [cs:GetlinsecPtr]
getlinsec_ebios:
xor edx,edx
shld edx,eax,2
- shl eax,2 ; Convert to HDD sectors
+ shl eax,2 ; Convert to HDD sectors
shl bp,2
.loop:
@@ -824,7 +824,7 @@ getlinsec_ebios:
; getlinsec implementation for legacy CBIOS
;
getlinsec_cbios:
- shl eax,2 ; Convert to HDD sectors
+ shl eax,2 ; Convert to HDD sectors
shl bp,2
.loop:
diff --git a/core/ldlinux.asm b/core/ldlinux.asm
index 8a3ce82a..4da9c153 100644
--- a/core/ldlinux.asm
+++ b/core/ldlinux.asm
@@ -117,11 +117,7 @@ trackbuf resb trackbufsize ; Track buffer goes here
; ends at 2800h
section .bss
- alignb 8
-
- ; Expanded superblock
-SuperInfo equ $
- resq 16 ; The first 16 bytes expanded 8 times
+ alignb 4
FAT resd 1 ; Location of (first) FAT
RootDirArea resd 1 ; Location of root directory area
RootDir resd 1 ; Location of root directory proper
@@ -138,656 +134,10 @@ ClustByteShift resb 1 ; Shift count for bytes/cluster
alignb open_file_t_size
Files resb MAX_OPEN*open_file_t_size
- section .text
-;
-; Some of the things that have to be saved very early are saved
-; "close" to the initial stack pointer offset, in order to
-; reduce the code size...
-;
-StackBuf equ $-44-32 ; Start the stack here (grow down - 4K)
-PartInfo equ StackBuf ; Saved partition table entry
-FloppyTable equ PartInfo+16 ; Floppy info table (must follow PartInfo)
-OrigFDCTabPtr equ StackBuf-8 ; The 2nd high dword on the stack
-OrigESDI equ StackBuf-4 ; The high dword on the stack
-
-;
-; Primary entry point. Tempting as though it may be, we can't put the
-; initial "cli" here; the jmp opcode in the first byte is part of the
-; "magic number" (using the term very loosely) for the DOS superblock.
-;
-bootsec equ $
-_start: jmp short start ; 2 bytes
- nop ; 1 byte
-;
-; "Superblock" follows -- it's in the boot sector, so it's already
-; loaded and ready for us
-;
-bsOemName db 'SYSLINUX' ; The SYS command sets this, so...
-;
-; These are the fields we actually care about. We end up expanding them
-; all to dword size early in the code, so generate labels for both
-; the expanded and unexpanded versions.
-;
-%macro superb 1
-bx %+ %1 equ SuperInfo+($-superblock)*8+4
-bs %+ %1 equ $
- zb 1
-%endmacro
-%macro superw 1
-bx %+ %1 equ SuperInfo+($-superblock)*8
-bs %+ %1 equ $
- zw 1
-%endmacro
-%macro superd 1
-bx %+ %1 equ $ ; no expansion for dwords
-bs %+ %1 equ $
- zd 1
-%endmacro
-superblock equ $
- superw BytesPerSec
- superb SecPerClust
- superw ResSectors
- superb FATs
- superw RootDirEnts
- superw Sectors
- superb Media
- superw FATsecs
- superw SecPerTrack
- superw Heads
-superinfo_size equ ($-superblock)-1 ; How much to expand
- superd Hidden
- superd HugeSectors
- ;
- ; This is as far as FAT12/16 and FAT32 are consistent
- ;
- ; FAT12/16 need 26 more bytes,
- ; FAT32 need 54 more bytes
- ;
-superblock_len_fat16 equ $-superblock+26
-superblock_len_fat32 equ $-superblock+54
- zb 54 ; Maximum needed size
-superblock_max equ $-superblock
-
-SecPerClust equ bxSecPerClust
-;
-; Note we don't check the constraints above now; we did that at install
-; time (we hope!)
-;
-start:
- cli ; No interrupts yet, please
- cld ; Copy upwards
-;
-; Set up the stack
-;
- xor ax,ax
- mov ss,ax
- mov sp,StackBuf ; Just below BSS
- push es ; Save initial ES:DI -> $PnP pointer
- push di
- mov es,ax
-;
-; DS:SI may contain a partition table entry. Preserve it for us.
-;
- mov cx,8 ; Save partition info
- mov di,PartInfo
- rep movsw
-
- mov ds,ax ; Now we can initialize DS...
-
-;
-; Now sautee the BIOS floppy info block to that it will support decent-
-; size transfers; the floppy block is 11 bytes and is stored in the
-; INT 1Eh vector (brilliant waste of resources, eh?)
-;
-; Of course, if BIOSes had been properly programmed, we wouldn't have
-; had to waste precious space with this code.
-;
- mov bx,fdctab
- lfs si,[bx] ; FS:SI -> original fdctab
- push fs ; Save on stack in case we need to bail
- push si
-
- ; Save the old fdctab even if hard disk so the stack layout
- ; is the same. The instructions above do not change the flags
- mov [DriveNumber],dl ; Save drive number in DL
- and dl,dl ; If floppy disk (00-7F), assume no
- ; partition table
- js harddisk
-
-floppy:
- mov cl,6 ; 12 bytes (CX == 0)
- ; es:di -> FloppyTable already
- ; This should be safe to do now, interrupts are off...
- mov [bx],di ; FloppyTable
- mov [bx+2],ax ; Segment 0
- fs rep movsw ; Faster to move words
- mov cl,[bsSecPerTrack] ; Patch the sector count
- mov [di-8],cl
- ; AX == 0 here
- int 13h ; Some BIOSes need this
-
- jmp short not_harddisk
-;
-; The drive number and possibly partition information was passed to us
-; by the BIOS or previous boot loader (MBR). Current "best practice" is to
-; trust that rather than what the superblock contains.
-;
-; Would it be better to zero out bsHidden if we don't have a partition table?
-;
-; Note: di points to beyond the end of PartInfo
-;
-harddisk:
- test byte [di-16],7Fh ; Sanity check: "active flag" should
- jnz no_partition ; be 00 or 80
- mov eax,[di-8] ; Partition offset (dword)
- mov [bsHidden],eax
-no_partition:
-;
-; Get disk drive parameters (don't trust the superblock.) Don't do this for
-; floppy drives -- INT 13:08 on floppy drives will (may?) return info about
-; what the *drive* supports, not about the *media*. Fortunately floppy disks
-; tend to have a fixed, well-defined geometry which is stored in the superblock.
-;
- ; DL == drive # still
- mov ah,08h
- int 13h
- jc no_driveparm
- and ah,ah
- jnz no_driveparm
- shr dx,8
- inc dx ; Contains # of heads - 1
- mov [bsHeads],dx
- and cx,3fh
- mov [bsSecPerTrack],cx
-no_driveparm:
-not_harddisk:
-;
-; Ready to enable interrupts, captain
-;
- sti
-
-;
-; Do we have EBIOS (EDD)?
-;
-eddcheck:
- mov bx,55AAh
- mov ah,41h ; EDD existence query
- mov dl,[DriveNumber]
- int 13h
- jc .noedd
- cmp bx,0AA55h
- jne .noedd
- test cl,1 ; Extended disk access functionality set
- jz .noedd
- ;
- ; We have EDD support...
- ;
- mov byte [getlinsec.jmp+1],(getlinsec_ebios-(getlinsec.jmp+2))
-.noedd:
-
-;
-; Load the first sector of LDLINUX.SYS; this used to be all proper
-; with parsing the superblock and root directory; it doesn't fit
-; together with EBIOS support, unfortunately.
-;
- mov eax,[FirstSector] ; Sector start
- mov bx,ldlinux_sys ; Where to load it
- call getonesec
-
- ; Some modicum of integrity checking
- cmp dword [ldlinux_magic+4],LDLINUX_MAGIC^HEXDATE
- jne kaboom
-
- ; Go for it...
- jmp ldlinux_ent
-
-;
-; getonesec: get one disk sector
-;
-getonesec:
- mov bp,1 ; One sector
- ; Fall through
-
-;
-; getlinsec: load a sequence of BP floppy sector given by the linear sector
-; number in EAX into the buffer at ES:BX. We try to optimize
-; by loading up to a whole track at a time, but the user
-; is responsible for not crossing a 64K boundary.
-; (Yes, BP is weird for a count, but it was available...)
-;
-; On return, BX points to the first byte after the transferred
-; block.
-;
-; This routine assumes CS == DS, and trashes most registers.
-;
-; Stylistic note: use "xchg" instead of "mov" when the source is a register
-; that is dead from that point; this saves space. However, please keep
-; the order to dst,src to keep things sane.
-;
-getlinsec:
- add eax,[bsHidden] ; Add partition offset
- xor edx,edx ; Zero-extend LBA (eventually allow 64 bits)
-
-.jmp: jmp strict short getlinsec_cbios
-
-;
-; getlinsec_ebios:
-;
-; getlinsec implementation for EBIOS (EDD)
-;
-getlinsec_ebios:
-.loop:
- push bp ; Sectors left
-.retry2:
- call maxtrans ; Enforce maximum transfer size
- movzx edi,bp ; Sectors we are about to read
- mov cx,retry_count
-.retry:
-
- ; Form DAPA on stack
- push edx
- push eax
- push es
- push bx
- push di
- push word 16
- mov si,sp
- pushad
- mov dl,[DriveNumber]
- push ds
- push ss
- pop ds ; DS <- SS
- mov ah,42h ; Extended Read
- int 13h
- pop ds
- popad
- lea sp,[si+16] ; Remove DAPA
- jc .error
- pop bp
- add eax,edi ; Advance sector pointer
- sub bp,di ; Sectors left
- shl di,SECTOR_SHIFT ; 512-byte sectors
- add bx,di ; Advance buffer pointer
- and bp,bp
- jnz .loop
-
- ret
-
-.error:
- ; Some systems seem to get "stuck" in an error state when
- ; using EBIOS. Doesn't happen when using CBIOS, which is
- ; good, since some other systems get timeout failures
- ; waiting for the floppy disk to spin up.
-
- pushad ; Try resetting the device
- xor ax,ax
- mov dl,[DriveNumber]
- int 13h
- popad
- loop .retry ; CX-- and jump if not zero
-
- ;shr word [MaxTransfer],1 ; Reduce the transfer size
- ;jnz .retry2
-
- ; Total failure. Try falling back to CBIOS.
- mov byte [getlinsec.jmp+1],(getlinsec_cbios-(getlinsec.jmp+2))
- ;mov byte [MaxTransfer],63 ; Max possibe CBIOS transfer
-
- pop bp
- ; ... fall through ...
-
-;
-; getlinsec_cbios:
;
-; getlinsec implementation for legacy CBIOS
+; Common bootstrap code for disk-based derivatives
;
-getlinsec_cbios:
-.loop:
- push edx
- push eax
- push bp
- push bx
-
- movzx esi,word [bsSecPerTrack]
- movzx edi,word [bsHeads]
- ;
- ; Dividing by sectors to get (track,sector): we may have
- ; up to 2^18 tracks, so we need to use 32-bit arithmetric.
- ;
- div esi
- xor cx,cx
- xchg cx,dx ; CX <- sector index (0-based)
- ; EDX <- 0
- ; eax = track #
- div edi ; Convert track to head/cyl
-
- ; We should test this, but it doesn't fit...
- ; cmp eax,1023
- ; ja .error
-
- ;
- ; Now we have AX = cyl, DX = head, CX = sector (0-based),
- ; BP = sectors to transfer, SI = bsSecPerTrack,
- ; ES:BX = data target
- ;
-
- call maxtrans ; Enforce maximum transfer size
-
- ; Must not cross track boundaries, so BP <= SI-CX
- sub si,cx
- cmp bp,si
- jna .bp_ok
- mov bp,si
-.bp_ok:
-
- shl ah,6 ; Because IBM was STOOPID
- ; and thought 8 bits were enough
- ; then thought 10 bits were enough...
- inc cx ; Sector numbers are 1-based, sigh
- or cl,ah
- mov ch,al
- mov dh,dl
- mov dl,[DriveNumber]
- xchg ax,bp ; Sector to transfer count
- mov ah,02h ; Read sectors
- mov bp,retry_count
-.retry:
- pushad
- int 13h
- popad
- jc .error
-.resume:
- movzx ecx,al ; ECX <- sectors transferred
- shl ax,SECTOR_SHIFT ; Convert sectors in AL to bytes in AX
- pop bx
- add bx,ax
- pop bp
- pop eax
- pop edx
- add eax,ecx
- sub bp,cx
- jnz .loop
- ret
-
-.error:
- dec bp
- jnz .retry
-
- xchg ax,bp ; Sectors transferred <- 0
- shr word [MaxTransfer],1
- jnz .resume
- ; Fall through to disk_error
-
-;
-; kaboom: write a message and bail out.
-;
-disk_error:
-kaboom:
- xor si,si
- mov ss,si
- mov sp,StackBuf-4 ; Reset stack
- mov ds,si ; Reset data segment
- pop dword [fdctab] ; Restore FDC table
-.patch: ; When we have full code, intercept here
- mov si,bailmsg
-
- ; Write error message, this assumes screen page 0
-.loop: lodsb
- and al,al
- jz .done
- mov ah,0Eh ; Write to screen as TTY
- mov bx,0007h ; Attribute
- int 10h
- jmp short .loop
-.done:
- cbw ; AH <- 0
-.again: int 16h ; Wait for keypress
- ; NB: replaced by int 18h if
- ; chosen at install time..
- int 19h ; And try once more to boot...
-.norge: jmp short .norge ; If int 19h returned; this is the end
-
-;
-; Truncate BP to MaxTransfer
-;
-maxtrans:
- cmp bp,[MaxTransfer]
- jna .ok
- mov bp,[MaxTransfer]
-.ok: ret
-
-;
-; Error message on failure
-;
-bailmsg: db 'Boot error', 0Dh, 0Ah, 0
-
- ; This fails if the boot sector overflows
- zb 1F8h-($-$$)
-
-FirstSector dd 0xDEADBEEF ; Location of sector 1
-MaxTransfer dw 0x007F ; Max transfer size
-
-; This field will be filled in 0xAA55 by the installer, but we abuse it
-; to house a pointer to the INT 16h instruction at
-; kaboom.again, which gets patched to INT 18h in RAID mode.
-bootsignature dw kaboom.again-bootsec
-
-;
-; ===========================================================================
-; End of boot sector
-; ===========================================================================
-; Start of LDLINUX.SYS
-; ===========================================================================
-
-ldlinux_sys:
-
-syslinux_banner db 0Dh, 0Ah
-%if IS_MDSLINUX
- db 'MDSLINUX '
-%else
- db 'SYSLINUX '
-%endif
- db VERSION_STR, ' ', DATE_STR, ' ', 0
- db 0Dh, 0Ah, 1Ah ; EOF if we "type" this in DOS
-
- alignz 8
-ldlinux_magic dd LDLINUX_MAGIC
- dd LDLINUX_MAGIC^HEXDATE
-
-;
-; This area is patched by the installer. It is found by looking for
-; LDLINUX_MAGIC, plus 8 bytes.
-;
-patch_area:
-LDLDwords dw 0 ; Total dwords starting at ldlinux_sys
-LDLSectors dw 0 ; Number of sectors - (bootsec+this sec)
-CheckSum dd 0 ; Checksum starting at ldlinux_sys
- ; value = LDLINUX_MAGIC - [sum of dwords]
-
-; Space for up to 64 sectors, the theoretical maximum
-SectorPtrs times 64 dd 0
-
-ldlinux_ent:
-;
-; Note that some BIOSes are buggy and run the boot sector at 07C0:0000
-; instead of 0000:7C00 and the like. We don't want to add anything
-; more to the boot sector, so it is written to not assume a fixed
-; value in CS, but we don't want to deal with that anymore from now
-; on.
-;
- jmp 0:.next
-.next:
-
-;
-; Tell the user we got this far
-;
- mov si,syslinux_banner
- call writestr_early
-
-;
-; Tell the user if we're using EBIOS or CBIOS
-;
-print_bios:
- mov si,cbios_name
- cmp byte [getlinsec.jmp+1],(getlinsec_ebios-(getlinsec.jmp+2))
- jne .cbios
- mov si,ebios_name
-.cbios:
- mov [BIOSName],si
- call writestr_early
-
- section .bss
-%define HAVE_BIOSNAME 1
-BIOSName resw 1
-
- section .text
-;
-; Now we read the rest of LDLINUX.SYS. Don't bother loading the first
-; sector again, though.
-;
-load_rest:
- mov si,SectorPtrs
- mov bx,7C00h+2*SECTOR_SIZE ; Where we start loading
- mov cx,[LDLSectors]
-
-.get_chunk:
- jcxz .done
- xor bp,bp
- lodsd ; First sector of this chunk
-
- mov edx,eax
-
-.make_chunk:
- inc bp
- dec cx
- jz .chunk_ready
- inc edx ; Next linear sector
- cmp [si],edx ; Does it match
- jnz .chunk_ready ; If not, this is it
- add si,4 ; If so, add sector to chunk
- jmp short .make_chunk
-
-.chunk_ready:
- call getlinsecsr
- shl bp,SECTOR_SHIFT
- add bx,bp
- jmp .get_chunk
-
-.done:
-
-;
-; All loaded up, verify that we got what we needed.
-; Note: the checksum field is embedded in the checksum region, so
-; by the time we get to the end it should all cancel out.
-;
-verify_checksum:
- mov si,ldlinux_sys
- mov cx,[LDLDwords]
- mov edx,-LDLINUX_MAGIC
-.checksum:
- lodsd
- add edx,eax
- loop .checksum
-
- and edx,edx ; Should be zero
- jz all_read ; We're cool, go for it!
-
-;
-; Uh-oh, something went bad...
-;
- mov si,checksumerr_msg
- call writestr_early
- jmp kaboom
-
-;
-; -----------------------------------------------------------------------------
-; Subroutines that have to be in the first sector
-; -----------------------------------------------------------------------------
-
-;
-;
-; writestr_early: write a null-terminated string to the console
-; This assumes we're on page 0. This is only used for early
-; messages, so it should be OK.
-;
-writestr_early:
- pushad
-.loop: lodsb
- and al,al
- jz .return
- mov ah,0Eh ; Write to screen as TTY
- mov bx,0007h ; Attribute
- int 10h
- jmp short .loop
-.return: popad
- ret
-
-
-; getlinsecsr: save registers, call getlinsec, restore registers
-;
-getlinsecsr: pushad
- call getlinsec
- popad
- ret
-
-;
-; Checksum error message
-;
-checksumerr_msg db ' Load error - ', 0 ; Boot failed appended
-
-;
-; BIOS type string
-;
-cbios_name db 'CBIOS', 0
-ebios_name db 'EBIOS', 0
-
-;
-; Debug routine
-;
-%ifdef debug
-safedumpregs:
- cmp word [Debug_Magic],0D00Dh
- jnz nc_return
- jmp dumpregs
-%endif
-
-rl_checkpt equ $ ; Must be <= 8000h
-
-rl_checkpt_off equ ($-$$)
-%ifndef DEPEND
-%if rl_checkpt_off > 400h
-%error "Sector 1 overflow"
-%endif
-%endif
-
-; ----------------------------------------------------------------------------
-; End of code and data that have to be in the first sector
-; ----------------------------------------------------------------------------
-
-all_read:
-;
-; Let the user (and programmer!) know we got this far. This used to be
-; in Sector 1, but makes a lot more sense here.
-;
- mov si,copyright_str
- call writestr_early
-
-
-;
-; Insane hack to expand the superblock to dwords
-;
-expand_super:
- xor eax,eax
- mov si,superblock
- mov di,SuperInfo
- mov cx,superinfo_size
-.loop:
- lodsw
- dec si
- stosd ; Store expanded word
- xor ah,ah
- stosd ; Store expanded byte
- loop .loop
+%include "diskstart.inc"
;
; Compute some information about this filesystem.
diff --git a/core/macros.inc b/core/macros.inc
index f3727c24..1aa2b2ce 100644
--- a/core/macros.inc
+++ b/core/macros.inc
@@ -24,20 +24,25 @@
; Identify the module we're compiling; the "correct" should be defined
; in the module itself to 1
;
-%ifndef IS_SYSLINUX
-%define IS_SYSLINUX 0
+%ifdef IS_SYSLINUX
+ %define MY_NAME 'SYSLINUX'
+%else
+ %define IS_SYSLINUX 0
%endif
-%ifndef IS_MDSLINUX
-%define IS_MDSLINUX 0
+%ifdef IS_PXELINUX
+ %define MY_NAME 'PXELINUX'
+%else
+ %define IS_PXELINUX 0
%endif
-%ifndef IS_PXELINUX
-%define IS_PXELINUX 0
+%ifdef IS_ISOLINUX
+ %define MY_NAME 'ISOLINUX'
+%else
+ %define IS_ISOLINUX 0
%endif
-%ifndef IS_ISOLINUX
-%define IS_ISOLINUX 0
-%endif
-%ifndef IS_EXTLINUX
-%define IS_EXTLINUX 0
+%ifdef IS_EXTLINUX
+ %define MY_NAME 'EXTLINUX'
+%else
+ %define IS_EXTLINUX 0
%endif
;
@@ -72,7 +77,7 @@
%assign %$v %1
%if %$v == 0
db '0'
- %else
+ %else
%assign %$dcount 0
%assign %$n %$v
%assign %$d 1
diff --git a/core/parseconfig.inc b/core/parseconfig.inc
index 593687d0..962d1200 100644
--- a/core/parseconfig.inc
+++ b/core/parseconfig.inc
@@ -413,7 +413,7 @@ commit_vk:
; append statement
cmp byte [InitRD+NULLOFFSET],NULLFILE
je .noinitrd
-
+
mov si,str_initrd
mov cx,7 ; "initrd="
rep movsb
diff --git a/core/ui.inc b/core/ui.inc
index 4c6e04a0..aa86c569 100644
--- a/core/ui.inc
+++ b/core/ui.inc
@@ -678,7 +678,7 @@ is_bad_image:
call writestr
jmp enter_command
-%if IS_SYSLINUX || IS_MDSLINUX
+%if IS_SYSLINUX
; ok
%else
is_bss_sector equ is_bad_image
diff --git a/doc/comboot.txt b/doc/comboot.txt
index cf18b2b6..f5fefdaf 100644
--- a/doc/comboot.txt
+++ b/doc/comboot.txt
@@ -952,5 +952,6 @@ AX=0024h [3.80] Cleanup, shuffle and boot, raw version
and possibly other virtualization solutions.
In both mode 0 and mode 1, the data segments will be loaded
- with base-zero read/write segments. For mode 0, B=0 and the
- limits will be 64K, for mode 1, B=1 and the limits will be 4 GB.
+ with read/write data segments, matching the respective code
+ segment. For mode 0, B=0 and the limits will be 64K, for mode
+ 1, B=1 and the limits will be 4 GB.
diff --git a/memdisk/setup.c b/memdisk/setup.c
index ebc7a36a..61f9bfb5 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -491,7 +491,7 @@ const struct geometry *get_disk_image_geometry(uint32_t where, uint32_t size)
if ( !hd_geometry.h || !hd_geometry.s ) {
int h, s, max_h, max_s;
-
+
max_h = hd_geometry.h;
max_s = hd_geometry.s;
@@ -530,12 +530,12 @@ const struct geometry *get_disk_image_geometry(uint32_t where, uint32_t size)
unsigned int xsectors = sectors;
hd_geometry.driveno = 0; /* Assume floppy */
-
+
while (!ok) {
/* Assume it's a floppy drive, guess a geometry */
unsigned int type, track;
int c, h, s;
-
+
if (xsectors < 320*2) {
c = 40; h = 1; type = 1;
} else if (xsectors < 640*2) {
@@ -573,21 +573,21 @@ const struct geometry *get_disk_image_geometry(uint32_t where, uint32_t size)
/* Assume it is a hard disk image and scan for a partition table */
const struct ptab_entry *ptab = (const struct ptab_entry *)
((char *)where+hd_geometry.offset+(512-2-4*16));
-
+
hd_geometry.driveno = 0x80; /* Assume hard disk */
-
+
if (*(uint16_t *)((char *)where+512-2) == 0xaa55) {
for ( i = 0 ; i < 4 ; i++ ) {
if ( ptab[i].type && !(ptab[i].active & 0x7f) ) {
s = (ptab[i].start_s & 0x3f);
h = ptab[i].start_h + 1;
-
+
if ( max_h < h ) max_h = h;
if ( max_s < s ) max_s = s;
-
+
s = (ptab[i].end_s & 0x3f);
h = ptab[i].end_h + 1;
-
+
if ( max_h < h ) {
max_h = h;
hd_geometry.hsrc = "MBR";
@@ -606,7 +606,7 @@ const struct geometry *get_disk_image_geometry(uint32_t where, uint32_t size)
max_h = xsectors > 2097152 ? 255 : 64;
if (!max_s)
max_s = xsectors > 2097152 ? 63 : 32;
-
+
hd_geometry.h = max_h;
hd_geometry.s = max_s;
}
diff --git a/memdisk/start32.S b/memdisk/start32.S
index 6c88d462..593ffb3e 100644
--- a/memdisk/start32.S
+++ b/memdisk/start32.S
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------
- *
+ *
* Copyright 2003-2009 H. Peter Anvin - All Rights Reserved
* Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
diff --git a/modules/pxechain.asm b/modules/pxechain.asm
index b11d0ea9..c78fb2bf 100644
--- a/modules/pxechain.asm
+++ b/modules/pxechain.asm
@@ -40,37 +40,37 @@ pspCmdArg: resb 127
%ifdef DEBUG
%macro MARK 1.nolist
- mov ah,0x02
- mov dl,%1&0xff
- int 0x21
+ mov ah,0x02
+ mov dl,%1&0xff
+ int 0x21
%if (%1 >> 8) & 0xff
mov dl,(%1 >> 8) & 0xff
- int 0x21
+ int 0x21
%if (%1 >> 16) & 0xff
mov dl,(%1 >> 16) & 0xff
- int 0x21
+ int 0x21
%if (%1 >> 24) & 0xff
mov dl,(%1 >> 24) & 0xff
- int 0x21
+ int 0x21
%endif
%endif
%endif
mov dl,' '
- int 0x21
+ int 0x21
%endmacro
%macro SHOWD 1.nolist
mov al,%1
call print_dec
mov ah,0x02
mov dl,' '
- int 0x21
+ int 0x21
%endmacro
%macro SHOWX 1.nolist
mov bx,%1
call print_hex
mov ah,0x02
mov dl,' '
- int 0x21
+ int 0x21
%endmacro
%else
%macro MARK 1.nolist
@@ -453,7 +453,7 @@ print_dec:
; print_dotquad
;
-; Take an IP address (in network byte order) in EBX and print it
+; Take an IP address (in network byte order) in EBX and print it
; as a dotted quad.
; Destroys EAX, EBX, ECX, EDX
;