소스 검색

Don't trash the %ecx value returned by relocate(). This was causing

us to round down the size for the relocation copy to the nearest 64kB
(+0x10 bytes); this just happened to work on most machines because the
last 64kB of the image is all-zeroes anyway (it's the .bss).
tags/v0.9.3
Michael Brown 17 년 전
부모
커밋
2cfe0dee1f
1개의 변경된 파일8개의 추가작업 그리고 6개의 파일을 삭제
  1. 8
    6
      src/arch/i386/prefix/libprefix.S

+ 8
- 6
src/arch/i386/prefix/libprefix.S 파일 보기

@@ -277,7 +277,7 @@ gdt_end:
277 277
  * Sets limits on the data segments %ds and %es.
278 278
  *
279 279
  * Parameters:
280
- *   %cx : segment type (FLAT_DS for 4GB or REAL_DS for 64kB)
280
+ *   %dx : segment type (FLAT_DS for 4GB or REAL_DS for 64kB)
281 281
  ****************************************************************************
282 282
  */
283 283
 
@@ -309,8 +309,8 @@ set_real_mode_limits:
309 309
 	movl	%eax, %cr0
310 310
 
311 311
 	/* Set flat segment limits */
312
-	movw	%cx, %ds
313
-	movw	%cx, %es
312
+	movw	%dx, %ds
313
+	movw	%dx, %es
314 314
 
315 315
 	/* Switch back to real mode */
316 316
 	movl	%cr0, %eax
@@ -355,6 +355,7 @@ install:
355 355
 install_prealloc:
356 356
 	/* Save registers */
357 357
 	pushl	%esi
358
+	pushw	%dx
358 359
 	/* Install .text16 and .data16 */
359 360
 	movl	$_payload_offset, %esi
360 361
 	call	install_basemem
@@ -385,7 +386,7 @@ install_prealloc:
385 386
 	 * prior to reading the E820 memory map and relocating
386 387
 	 * properly.
387 388
 	 */
388
-	movw	$FLAT_DS, %cx
389
+	movw	$FLAT_DS, %dx
389 390
 	call	set_real_mode_limits
390 391
 	movl	$HIGHMEM_LOADPOINT, %edi
391 392
 	call	install_highmem
@@ -400,7 +401,7 @@ install_prealloc:
400 401
 	addw	$4, %sp
401 402
 
402 403
 	/* Move code to new location, set up new protected-mode GDT */
403
-	movw	$FLAT_DS, %cx
404
+	movw	$FLAT_DS, %dx
404 405
 	call	set_real_mode_limits
405 406
 	pushl	%edi
406 407
 	es rep addr32 movsb
@@ -408,7 +409,7 @@ install_prealloc:
408 409
 	lcall	*init_librm_vector
409 410
 
410 411
 	/* Restore real-mode segment limits */
411
-	movw	$REAL_DS, %cx
412
+	movw	$REAL_DS, %dx
412 413
 	call	set_real_mode_limits
413 414
 
414 415
 	/* Restore registers and interrupt status */
@@ -417,6 +418,7 @@ install_prealloc:
417 418
 	popw	%ds
418 419
 	popfw
419 420
 #endif
421
+	popw	%dx
420 422
 	popl	%esi
421 423
 	ret
422 424
 	.size install_prealloc, . - install_prealloc

Loading…
취소
저장