Browse Source

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 years ago
parent
commit
2cfe0dee1f
1 changed files with 8 additions and 6 deletions
  1. 8
    6
      src/arch/i386/prefix/libprefix.S

+ 8
- 6
src/arch/i386/prefix/libprefix.S View File

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

Loading…
Cancel
Save