Browse Source

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.
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
755cb8379d
2 changed files with 9 additions and 1 deletions
  1. 7
    1
      src/arch/i386/image/bzimage.c
  2. 2
    0
      src/arch/i386/include/bzimage.h

+ 7
- 1
src/arch/i386/image/bzimage.c View File

343
 	/* Prepare for exiting */
343
 	/* Prepare for exiting */
344
 	shutdown();
344
 	shutdown();
345
 
345
 
346
+	DBGC ( image, "bzImage %p jumping to RM kernel at %04x:0000 "
347
+	       "(stack %04x:%04x)\n", image,
348
+	       ( exec_ctx.rm_kernel_seg + 0x20 ),
349
+	       exec_ctx.rm_kernel_seg, exec_ctx.rm_heap );
350
+
346
 	/* Jump to the kernel */
351
 	/* Jump to the kernel */
347
 	__asm__ __volatile__ ( REAL_CODE ( "movw %w0, %%ds\n\t"
352
 	__asm__ __volatile__ ( REAL_CODE ( "movw %w0, %%ds\n\t"
348
 					   "movw %w0, %%es\n\t"
353
 					   "movw %w0, %%es\n\t"
403
 	/* Calculate load address and size of real-mode portion */
408
 	/* Calculate load address and size of real-mode portion */
404
 	load_ctx->rm_kernel_seg = 0x1000; /* place RM kernel at 1000:0000 */
409
 	load_ctx->rm_kernel_seg = 0x1000; /* place RM kernel at 1000:0000 */
405
 	load_ctx->rm_kernel = real_to_user ( load_ctx->rm_kernel_seg, 0 );
410
 	load_ctx->rm_kernel = real_to_user ( load_ctx->rm_kernel_seg, 0 );
406
-	load_ctx->rm_filesz = load_ctx->rm_memsz =
411
+	load_ctx->rm_filesz =
407
 		( ( bzhdr->setup_sects ? bzhdr->setup_sects : 4 ) + 1 ) << 9;
412
 		( ( bzhdr->setup_sects ? bzhdr->setup_sects : 4 ) + 1 ) << 9;
413
+	load_ctx->rm_memsz = BZI_ASSUMED_RM_SIZE;
408
 	if ( load_ctx->rm_filesz > image->len ) {
414
 	if ( load_ctx->rm_filesz > image->len ) {
409
 		DBGC ( image, "bzImage %p too short for %zd byte of setup\n",
415
 		DBGC ( image, "bzImage %p too short for %zd byte of setup\n",
410
 		       image, load_ctx->rm_filesz );
416
 		       image, load_ctx->rm_filesz );

+ 2
- 0
src/arch/i386/include/bzimage.h View File

117
 /** bzImage command line present magic marker value */
117
 /** bzImage command line present magic marker value */
118
 #define BZI_CMDLINE_MAGIC 0xa33f
118
 #define BZI_CMDLINE_MAGIC 0xa33f
119
 
119
 
120
+/** Assumed size of real-mode portion (including .bss) */
121
+#define BZI_ASSUMED_RM_SIZE 0x8000
120
 
122
 
121
 /** Amount of stack space to provide */
123
 /** Amount of stack space to provide */
122
 #define BZI_STACK_SIZE 0x1000
124
 #define BZI_STACK_SIZE 0x1000

Loading…
Cancel
Save