Explorar el Código

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 hace 16 años
padre
commit
755cb8379d
Se han modificado 2 ficheros con 9 adiciones y 1 borrados
  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 Ver fichero

@@ -343,6 +343,11 @@ static int bzimage_exec ( struct image *image ) {
343 343
 	/* Prepare for exiting */
344 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 351
 	/* Jump to the kernel */
347 352
 	__asm__ __volatile__ ( REAL_CODE ( "movw %w0, %%ds\n\t"
348 353
 					   "movw %w0, %%es\n\t"
@@ -403,8 +408,9 @@ static int bzimage_load_header ( struct image *image,
403 408
 	/* Calculate load address and size of real-mode portion */
404 409
 	load_ctx->rm_kernel_seg = 0x1000; /* place RM kernel at 1000:0000 */
405 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 412
 		( ( bzhdr->setup_sects ? bzhdr->setup_sects : 4 ) + 1 ) << 9;
413
+	load_ctx->rm_memsz = BZI_ASSUMED_RM_SIZE;
408 414
 	if ( load_ctx->rm_filesz > image->len ) {
409 415
 		DBGC ( image, "bzImage %p too short for %zd byte of setup\n",
410 416
 		       image, load_ctx->rm_filesz );

+ 2
- 0
src/arch/i386/include/bzimage.h Ver fichero

@@ -117,6 +117,8 @@ struct bzimage_cmdline {
117 117
 /** bzImage command line present magic marker value */
118 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 123
 /** Amount of stack space to provide */
122 124
 #define BZI_STACK_SIZE 0x1000

Loading…
Cancelar
Guardar