From 8502d91fbd68a145dd92981c0599961bcdc44e0b Mon Sep 17 00:00:00 2001 From: Sebastian Herbszt Date: Sat, 19 Jul 2008 21:54:34 +0200 Subject: ethersel: use library functions Replace get_config() and execute() with syslinux_config_file() and syslinux_run_command(). - Sebastian --- com32/modules/ethersel.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/com32/modules/ethersel.c b/com32/modules/ethersel.c index 64c2ceb3..d200d627 100644 --- a/com32/modules/ethersel.c +++ b/com32/modules/ethersel.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include #ifdef DEBUG # define dprintf printf @@ -42,17 +44,6 @@ # define dprintf(...) ((void)0) #endif -static const char * -get_config(void) -{ - static com32sys_t r; - - r.eax.w[0] = 0x000E; - __intcall(0x22, &r, &r); - - return MK_PTR(r.es, r.ebx.w[0]); -} - static char * skipspace(char *p) { @@ -139,7 +130,7 @@ parse_config(const char *filename) struct match *m; if ( !filename ) - filename = get_config(); + filename = syslinux_config_file(); f = fopen(filename, "r"); if ( !f ) @@ -198,19 +189,6 @@ parse_config(const char *filename) return list; } -static void __attribute__((noreturn)) -execute(const char *cmdline) -{ - static com32sys_t ireg; - - strcpy(__com32.cs_bounce, cmdline); - ireg.eax.w[0] = 0x0003; /* Run command */ - ireg.ebx.w[0] = OFFS(__com32.cs_bounce); - ireg.es = SEG(__com32.cs_bounce); - __intcall(0x22, &ireg, NULL); - exit(255); /* Shouldn't return */ -} - int main(int argc, char *argv[]) { struct match *list, *match; @@ -225,7 +203,7 @@ int main(int argc, char *argv[]) match = find_pci_device(&pci_device_list,list); if ( match ) - execute(match->filename); + syslinux_run_command(match->filename); /* On error, return to the command line */ fputs("Error: no recognized network card found!\n", stderr); -- cgit v1.2.1 From f8d4f8a641d0b397c4e57beb8de8fd3812e07b18 Mon Sep 17 00:00:00 2001 From: Sebastian Herbszt Date: Sat, 19 Jul 2008 22:26:48 +0200 Subject: pci: resize pci_device arrays pci_bus->pci_device get's populated with functions so it should take up to MAX_PCI_DEVICES * MAX_PCI_FUNC elements. pci_device_list->pci_device get's populated with functions for every possible pci bus. Therefore it should take up to MAX_PCI_BUS * MAX_PCI_DEVICES * MAX_PCI_FUNC elements. Also adjust count variable types. - Sebastian --- com32/include/sys/pci.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/com32/include/sys/pci.h b/com32/include/sys/pci.h index 3b07ae7c..adb25632 100644 --- a/com32/include/sys/pci.h +++ b/com32/include/sys/pci.h @@ -29,18 +29,18 @@ struct pci_device { struct pci_bus { uint16_t id; - struct pci_device *pci_device[MAX_PCI_DEVICES]; - uint8_t pci_device_count; + struct pci_device *pci_device[MAX_PCI_DEVICES * MAX_PCI_FUNC]; + uint32_t pci_device_count; }; struct pci_device_list { - struct pci_device pci_device[MAX_PCI_DEVICES]; - uint8_t count; + struct pci_device pci_device[MAX_PCI_BUSES * MAX_PCI_DEVICES * MAX_PCI_FUNC]; + uint32_t count; }; struct pci_bus_list { struct pci_bus pci_bus[MAX_PCI_BUSES]; - uint8_t count; + uint32_t count; }; struct match { -- cgit v1.2.1 From c86aca6b49cb335fba1f9cf96f1ce5b7d18dba2f Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 21 Jul 2008 21:36:44 -0400 Subject: vesamenu: avoid strcmp() with NULL Avoid touching memory at address zero when going from a background to a non-background. --- com32/menu/background.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com32/menu/background.c b/com32/menu/background.c index 49839cdc..fa034418 100644 --- a/com32/menu/background.c +++ b/com32/menu/background.c @@ -18,7 +18,7 @@ const char *current_background = NULL; void set_background(const char *new_background) { - if (!current_background || + if (!current_background || !new_background || strcmp(current_background, new_background)) { draw_background(new_background); current_background = new_background; -- cgit v1.2.1 From eec9fe478cfcf9ba45455f68715cba4b57be7ea6 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Tue, 22 Jul 2008 13:46:07 +0400 Subject: Fix loading of *.lkrn images from gPXE Attempts to load *.lkrn images were failing with "Not enough memory to load specified image". These images have the su_ramdisk_max header field set to zero, and the code in core/runkernel.inc was limiting MyHighMemSize too early (before the load_high call used to load the main part of the kernel). Signed-off-by: Sergey Vlasov Signed-off-by: H. Peter Anvin --- core/runkernel.inc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/runkernel.inc b/core/runkernel.inc index 4d627787..c7af6cc7 100644 --- a/core/runkernel.inc +++ b/core/runkernel.inc @@ -216,13 +216,6 @@ new_kernel: mov al,[es:su_loadflags] mov [LoadFlags],al - ; Cap the ramdisk memory range if appropriate - mov eax,[RamdiskMax] - cmp eax,[MyHighMemSize] - ja .ok - mov [MyHighMemSize],eax -.ok: - any_kernel: ; @@ -291,6 +284,12 @@ high_load_done: ; if we tried to load initrd using an old kernel ; load_initrd: + ; Cap the ramdisk memory range if appropriate + mov eax,[RamdiskMax] + cmp eax,[MyHighMemSize] + ja .ok + mov [MyHighMemSize],eax +.ok: xor eax,eax cmp [InitRDPtr],ax jz .noinitrd -- cgit v1.2.1 From 2870b77cd5d04addc8e956ba21e91bde08e4db66 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Tue, 22 Jul 2008 13:46:08 +0400 Subject: Fix initrd overwriting the kernel for some kernel sizes The address in EDI returned by the load_high call used to load the kernel needs to be passed to parse_load_initrd, but the code which clears memory after setup sectors for 1.2.x kernels was corrupting low 16 bits of EDI. In most cases this corruption was not noticed, because with usual setup sizes DI was set to 0xf800, therefore the chance of getting the kernel size such that initrd would actually overwrite the kernel was about 3%. Signed-off-by: Sergey Vlasov Signed-off-by: H. Peter Anvin --- core/runkernel.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/runkernel.inc b/core/runkernel.inc index c7af6cc7..5748b0b7 100644 --- a/core/runkernel.inc +++ b/core/runkernel.inc @@ -270,6 +270,7 @@ high_load_done: ; if they see protected-mode kernel data after the setup sectors, so ; clear that memory. ; + push di mov di,[SetupSecs] shl di,9 xor eax,eax @@ -277,6 +278,7 @@ high_load_done: sub cx,di shr cx,2 rep stosd + pop di ; ; Now see if we have an initial RAMdisk; if so, do requisite computation -- cgit v1.2.1 From a8641f9842da20ad9c80ad28db8c10cdaaddfd55 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Tue, 22 Jul 2008 13:46:09 +0400 Subject: core/runkernel.inc: remove dead code Signed-off-by: Sergey Vlasov Signed-off-by: H. Peter Anvin --- core/runkernel.inc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/core/runkernel.inc b/core/runkernel.inc index 5748b0b7..143920d0 100644 --- a/core/runkernel.inc +++ b/core/runkernel.inc @@ -599,12 +599,6 @@ loadinitrd: mov si,crlf_msg jmp abort_load -no_high_mem: ; Error routine - mov si,err_nohighmem - jmp abort_load - - ret - section .data crlfloading_msg db CR, LF loading_msg db 'Loading ', 0 -- cgit v1.2.1