aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MCONFIG.embedded1
-rw-r--r--com32/MCONFIG1
-rw-r--r--com32/gpllib/cpuid.c6
-rw-r--r--com32/include/com32.h7
-rw-r--r--com32/lib/sys/argv.c5
-rw-r--r--com32/lib/sys/entry.S2
-rw-r--r--com32/mboot/Makefile2
-rw-r--r--com32/mboot/mboot.c4
-rw-r--r--com32/mboot/mboot.h6
-rw-r--r--com32/mboot/syslinux.c45
-rw-r--r--core/cmdline.inc2
-rw-r--r--core/com32.inc15
-rw-r--r--core/isolinux.asm2
-rw-r--r--core/pxelinux.asm2
-rw-r--r--doc/comboot.txt8
15 files changed, 90 insertions, 18 deletions
diff --git a/MCONFIG.embedded b/MCONFIG.embedded
index 1369265c..9f5846d7 100644
--- a/MCONFIG.embedded
+++ b/MCONFIG.embedded
@@ -31,6 +31,7 @@ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
GCCOPT += $(call gcc_ok,-mpreferred-stack-boundary=2,)
+GCCOPT += $(call gcc_ok,-mincoming-stack-boundary=2,)
LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
diff --git a/com32/MCONFIG b/com32/MCONFIG
index 80f92f6c..0b774d4f 100644
--- a/com32/MCONFIG
+++ b/com32/MCONFIG
@@ -32,6 +32,7 @@ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
GCCOPT += $(call gcc_ok,-mpreferred-stack-boundary=2,)
+GCCOPT += $(call gcc_ok,-incoming-stack-boundary=2,)
com32 := $(topdir)/com32
RELOCS := $(com32)/tools/relocs
diff --git a/com32/gpllib/cpuid.c b/com32/gpllib/cpuid.c
index fa212045..f33e8958 100644
--- a/com32/gpllib/cpuid.c
+++ b/com32/gpllib/cpuid.c
@@ -232,8 +232,10 @@ void generic_identify(struct cpuinfo_x86 *c)
}
break;
case X86_VENDOR_INTEL:
- cpuid(0x4, &eax, &ebx, &ecx, &edx);
- c->x86_num_cores = ((eax & 0xfc000000) >> 26) + 1;
+ if (c->cpuid_level >= 0x00000004) {
+ cpuid(0x4, &eax, &ebx, &ecx, &edx);
+ c->x86_num_cores = ((eax & 0xfc000000) >> 26) + 1;
+ }
break;
default:
c->x86_num_cores = 1;
diff --git a/com32/include/com32.h b/com32/include/com32.h
index 252dab5a..6b142082 100644
--- a/com32/include/com32.h
+++ b/com32/include/com32.h
@@ -97,12 +97,13 @@ struct com32_pmapi;
extern struct com32_sys_args {
uint32_t cs_sysargs;
char *cs_cmdline;
- void __cdecl(*cs_intcall) (uint8_t, const com32sys_t *, com32sys_t *);
+ void __cdecl (*cs_intcall)(uint8_t, const com32sys_t *, com32sys_t *);
void *cs_bounce;
uint32_t cs_bounce_size;
- void __cdecl(*cs_farcall) (uint32_t, const com32sys_t *, com32sys_t *);
- int __cdecl(*cs_cfarcall) (uint32_t, const void *, uint32_t);
+ void __cdecl (*cs_farcall)(uint32_t, const com32sys_t *, com32sys_t *);
+ int __cdecl (*cs_cfarcall)(uint32_t, const void *, uint32_t);
uint32_t cs_memsize;
+ const char *cs_name;
const struct com32_pmapi *cs_pm;
} __com32;
diff --git a/com32/lib/sys/argv.c b/com32/lib/sys/argv.c
index 8e9aabdb..3ff869b7 100644
--- a/com32/lib/sys/argv.c
+++ b/com32/lib/sys/argv.c
@@ -37,13 +37,14 @@
#include <stddef.h>
#include <stdio.h>
#include <syslinux/align.h>
+#include <com32.h>
extern char _end[]; /* Symbol created by linker */
void *__mem_end = &_end; /* Global variable for use by malloc() */
int __parse_argv(char ***argv, const char *str)
{
- char argv0[] = "";
+ char dummy_argv0[] = "";
char *mem = __mem_end;
const char *p = str;
char *q = mem;
@@ -77,7 +78,7 @@ int __parse_argv(char ***argv, const char *str)
/* Now create argv */
arg = (char **)ALIGN_UP_FOR(q, char *);
*argv = arg;
- *arg++ = argv0; /* argv[0] */
+ *arg++ = __com32.cs_name ? __com32.cs_name : dummy_argv0; /* argv[0] */
q--; /* Point q to final null */
if (mem < q)
diff --git a/com32/lib/sys/entry.S b/com32/lib/sys/entry.S
index 629f336a..7bfde8b2 100644
--- a/com32/lib/sys/entry.S
+++ b/com32/lib/sys/entry.S
@@ -30,7 +30,7 @@
*/
/* Number of arguments in our version of the entry structure */
-#define COM32_ARGS 8
+#define COM32_ARGS 9
.section ".init","ax"
.globl _start
diff --git a/com32/mboot/Makefile b/com32/mboot/Makefile
index c1ac76fb..7e6c2e96 100644
--- a/com32/mboot/Makefile
+++ b/com32/mboot/Makefile
@@ -24,7 +24,7 @@ LNXLIBS = ../libutil/libutil_lnx.a
MODULES = mboot.c32
TESTFILES =
-OBJS = mboot.o map.o mem.o initvesa.o apm.o solaris.o
+OBJS = mboot.o map.o mem.o initvesa.o apm.o solaris.o syslinux.o
all: $(MODULES) $(TESTFILES)
diff --git a/com32/mboot/mboot.c b/com32/mboot/mboot.c
index a0b55628..16579e43 100644
--- a/com32/mboot/mboot.c
+++ b/com32/mboot/mboot.c
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -222,6 +222,8 @@ int main(int argc, char *argv[])
/* Add auxilliary information */
mboot_make_memmap();
mboot_apm();
+ mboot_syslinux_info();
+
if (opt.solaris)
mboot_solaris_dhcp_hack();
diff --git a/com32/mboot/mboot.h b/com32/mboot/mboot.h
index 993b31a8..761ac872 100644
--- a/com32/mboot/mboot.h
+++ b/com32/mboot/mboot.h
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -50,6 +50,7 @@
#include <syslinux/loadfile.h>
#include <syslinux/movebits.h>
#include <syslinux/bootpm.h>
+#include <syslinux/config.h>
#include "mb_header.h"
#include "mb_info.h"
@@ -92,6 +93,9 @@ void mboot_apm(void);
/* solaris.c */
void mboot_solaris_dhcp_hack(void);
+/* syslinux.c */
+void mboot_syslinux_info(void);
+
/* initvesa.c */
void set_graphics_mode(const struct multiboot_header *mbh,
struct multiboot_info *mbi);
diff --git a/com32/mboot/syslinux.c b/com32/mboot/syslinux.c
new file mode 100644
index 00000000..7de3853e
--- /dev/null
+++ b/com32/mboot/syslinux.c
@@ -0,0 +1,45 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2010 Intel Corporation; author: H. Peter Anvin
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * 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
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * syslinux.c
+ *
+ * Syslinux-specific information for the kernel
+ */
+
+#include <syslinux/config.h>
+#include "mboot.h"
+
+void mboot_syslinux_info(void)
+{
+ const struct syslinux_version *sv;
+
+ sv = syslinux_version();
+ mbinfo.boot_loader_name = map_string(sv->version_string);
+ if (mbinfo.boot_loader_name)
+ mbinfo.flags |= MB_INFO_BOOT_LOADER_NAME;
+}
diff --git a/core/cmdline.inc b/core/cmdline.inc
index 54d85f40..7fa53816 100644
--- a/core/cmdline.inc
+++ b/core/cmdline.inc
@@ -19,6 +19,8 @@
;; Not used by plain kernel due to BOOT_IMAGE= etc.
;;
+ section .text16
+
;
; Assumes DS == CS
;
diff --git a/core/com32.inc b/core/com32.inc
index 9a29c95c..111590c3 100644
--- a/core/com32.inc
+++ b/core/com32.inc
@@ -47,6 +47,10 @@ is_com32_image:
sub cx,si
fs rep movsb
+ mov si,KernelName
+ mov di,Com32Name
+ call strcpy
+
call comboot_setup_api ; Set up the COMBOOT-style API
mov edi,com32_entry ; Load address
@@ -85,6 +89,7 @@ com32_start:
; Set up the calling stack frame
push dword pm_api_vector
+ push dword Com32Name ; Module filename
push dword [HighMemSize] ; Memory managed by Syslinux
push dword core_cfarcall ; Cfarcall entry point
push dword core_farcall ; Farcall entry point
@@ -92,7 +97,7 @@ com32_start:
push dword core_real_mode ; Bounce buffer address
push dword core_intcall ; Intcall entry point
push dword command_line ; Command line pointer
- push dword 8 ; Argument count
+ push dword 9 ; Argument count
sti ; Interrupts OK now
call com32_entry ; Run the program...
; ... on return, fall through to com32_exit ...
@@ -123,7 +128,7 @@ not_com32r_msg db ': not a COM32R image', CR, LF, 0
__entry_esp:
dd 0 ; Dummy to avoid _exit issues
__com32:
- dd 8 ; Argument count
+ dd 9 ; Argument count
dd 0 ; No command line
dd core_intcall ; Intcall entry point
dd 0 ; Bounce buffer address
@@ -131,4 +136,10 @@ __com32:
dd core_farcall ; Farcall entry point
dd core_cfarcall ; Cfarcall entry point
HighMemSize dd 0 ; End of memory pointer (bytes)
+ dd 0 ; No module name
dd pm_api_vector ; Protected mode functions
+
+ section .uibss
+Com32Name resb FILENAME_MAX
+
+ section .text16
diff --git a/core/isolinux.asm b/core/isolinux.asm
index 7329f145..d1d5bf8d 100644
--- a/core/isolinux.asm
+++ b/core/isolinux.asm
@@ -1048,7 +1048,7 @@ writestr_early equ writestr
; Data that needs to be in the first sector
; -----------------------------------------------------------------------------
-syslinux_banner db CR, LF, 'ISOLINUX ', VERSION_STR, ' ', DATE_STR, ' ', 0
+syslinux_banner db CR, LF, MY_NAME, ' ', VERSION_STR, ' ', DATE_STR, ' ', 0
copyright_str db ' Copyright (C) 1994-'
asciidec YEAR
db ' H. Peter Anvin et al', CR, LF, 0
diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index 5ba3acde..3020cf26 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -501,7 +501,7 @@ copyright_str db ' Copyright (C) 1994-'
err_bootfailed db CR, LF, 'Boot failed: press a key to retry, or wait for reset...', CR, LF, 0
bailmsg equ err_bootfailed
localboot_msg db 'Booting from local disk...', CR, LF, 0
-syslinux_banner db CR, LF, 'PXELINUX ', VERSION_STR, ' ', DATE_STR, ' ', 0
+syslinux_banner db CR, LF, MY_NAME, ' ', VERSION_STR, ' ', DATE_STR, ' ', 0
;
; Config file keyword table
diff --git a/doc/comboot.txt b/doc/comboot.txt
index 8adff330..0f64097a 100644
--- a/doc/comboot.txt
+++ b/doc/comboot.txt
@@ -82,7 +82,7 @@ The following arguments are passed to the program on the stack:
Address Size Meaning
[ESP] dword Return (termination) address
- [ESP+4] dword Number of additional arguments (currently 7)
+ [ESP+4] dword Number of additional arguments (currently 8)
[ESP+8] dword Pointer to the command line arguments (null-terminated string)
[ESP+12] dword Pointer to INT call helper function
[ESP+16] dword Pointer to low memory bounce buffer
@@ -90,7 +90,8 @@ The following arguments are passed to the program on the stack:
[ESP+24] dword Pointer to FAR call helper function (new in 2.05)
[ESP+28] dword Pointer to CDECL helper function (new in 3.54)
[ESP+32] dword Amount of memory controlled by the Syslinux core (new in 3.74)
- [ESP+36] dword Pointer to protected-mode functions (new in 4.00)
+ [ESP+36] dword Pointer to the filename of the com32 module (new in 3.86)
+ [ESP+40] dword Pointer to protected-mode functions (new in 4.00)
The libcom32 startup code loads this into a structure named __com32,
defined in <com32.h>:
@@ -104,7 +105,8 @@ extern struct com32_sys_args {
void __cdecl(*cs_farcall)(uint32_t, const com32sys_t *, com32sys_t *);
int __cdecl(*cs_cfarcall)(uint32_t, const void *, uint32_t);
uint32_t cs_memsize;
- struct com32_pmapi *cs_pm;
+ const char *cs_name;
+ const struct com32_pmapi *cs_pm;
} __com32;
The intcall helper function can be used to issue BIOS or Syslinux API