summaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown2007-11-04 05:27:38 +0100
committerMichael Brown2007-11-04 05:27:38 +0100
commit755cb8379d9bd139af6d8fd9d67e8b764418c4ad (patch)
tree69ec6f18b10de949098541c8f7dd973c9c2bde7a /src/arch
parentAdd missing attribute(packed) to two structures. (diff)
downloadipxe-755cb8379d9bd139af6d8fd9d67e8b764418c4ad.tar.gz
ipxe-755cb8379d9bd139af6d8fd9d67e8b764418c4ad.tar.xz
ipxe-755cb8379d9bd139af6d8fd9d67e8b764418c4ad.zip
Allow space for the kernel's real-mode .bss. Previously we weren't
allowing any space for this, which makes it surprising that bzImage loading ever worked.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/image/bzimage.c8
-rw-r--r--src/arch/i386/include/bzimage.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/src/arch/i386/image/bzimage.c b/src/arch/i386/image/bzimage.c
index 439153e2..f0591681 100644
--- a/src/arch/i386/image/bzimage.c
+++ b/src/arch/i386/image/bzimage.c
@@ -343,6 +343,11 @@ static int bzimage_exec ( struct image *image ) {
/* Prepare for exiting */
shutdown();
+ DBGC ( image, "bzImage %p jumping to RM kernel at %04x:0000 "
+ "(stack %04x:%04x)\n", image,
+ ( exec_ctx.rm_kernel_seg + 0x20 ),
+ exec_ctx.rm_kernel_seg, exec_ctx.rm_heap );
+
/* Jump to the kernel */
__asm__ __volatile__ ( REAL_CODE ( "movw %w0, %%ds\n\t"
"movw %w0, %%es\n\t"
@@ -403,8 +408,9 @@ static int bzimage_load_header ( struct image *image,
/* Calculate load address and size of real-mode portion */
load_ctx->rm_kernel_seg = 0x1000; /* place RM kernel at 1000:0000 */
load_ctx->rm_kernel = real_to_user ( load_ctx->rm_kernel_seg, 0 );
- load_ctx->rm_filesz = load_ctx->rm_memsz =
+ load_ctx->rm_filesz =
( ( bzhdr->setup_sects ? bzhdr->setup_sects : 4 ) + 1 ) << 9;
+ load_ctx->rm_memsz = BZI_ASSUMED_RM_SIZE;
if ( load_ctx->rm_filesz > image->len ) {
DBGC ( image, "bzImage %p too short for %zd byte of setup\n",
image, load_ctx->rm_filesz );
diff --git a/src/arch/i386/include/bzimage.h b/src/arch/i386/include/bzimage.h
index f443fae7..609e8362 100644
--- a/src/arch/i386/include/bzimage.h
+++ b/src/arch/i386/include/bzimage.h
@@ -117,6 +117,8 @@ struct bzimage_cmdline {
/** bzImage command line present magic marker value */
#define BZI_CMDLINE_MAGIC 0xa33f
+/** Assumed size of real-mode portion (including .bss) */
+#define BZI_ASSUMED_RM_SIZE 0x8000
/** Amount of stack space to provide */
#define BZI_STACK_SIZE 0x1000