Clear 'big' bit of segment registers before returning to real mode.

This commit is contained in:
dsl 2003-02-25 11:17:36 +00:00
parent 990562bfef
commit 9474297c7f
3 changed files with 49 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: start_dos.S,v 1.7 2003/02/01 14:48:19 dsl Exp $ */
/* $NetBSD: start_dos.S,v 1.8 2003/02/25 11:17:36 dsl Exp $ */
/*
* startup for DOS .COM programs
@ -118,6 +118,11 @@ bootdataseg = . - gdt
bootrealseg = . - gdt
.word 0xffff, 0
.byte 0, 0x9e, 0x00, 0
/* limits (etc) for data segment in real mode */
bootrealdata = . - gdt
.word 0xffff, 0
.byte 0, 0x92, 0x00, 0
gdtlen = . - gdt
#ifdef __ELF__
@ -244,6 +249,16 @@ ENTRY(prot_to_real)
movl _C_LABEL(ourseg), %eax
movw %ax, xreal-2
/*
* Load the segment registers while still in protected mode.
* Otherwise the control bits don't get changed.
* The correct values are loaded later.
*/
movw $bootrealdata, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
# Change to use16 mode.
ljmp $bootrealseg, $x16

View File

@ -1,4 +1,4 @@
/* $NetBSD: start_pxe.S,v 1.3 2003/02/01 14:48:19 dsl Exp $ */
/* $NetBSD: start_pxe.S,v 1.4 2003/02/25 11:17:37 dsl Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -167,6 +167,11 @@ bootdataseg = . - gdt
bootrealseg = . - gdt
.word 0xffff, 0
.byte 0, 0x9e, 0x00, 0
/* limits (etc) for data segment in real mode */
bootrealdata = . - gdt
.word 0xffff, 0
.byte 0, 0x92, 0x00, 0
gdtlen = . - gdt
#ifdef __ELF__
@ -233,6 +238,16 @@ ENTRY(prot_to_real)
movl _C_LABEL(ourseg), %eax
movw %ax, xreal-2
/*
* Load the segment registers while still in protected mode.
* Otherwise the control bits don't get changed.
* The correct values are loaded later.
*/
movw $bootrealdata, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
# Change to use16 mode.
ljmp $bootrealseg, $x16

View File

@ -1,4 +1,4 @@
/* $NetBSD: start_rom.S,v 1.9 2003/02/01 14:48:19 dsl Exp $ */
/* $NetBSD: start_rom.S,v 1.10 2003/02/25 11:17:37 dsl Exp $ */
/*
* ROM startup
@ -235,6 +235,11 @@ bootdataseg = . - gdt
bootrealseg = . - gdt
.word 0xffff, 0
.byte 0, 0x9f, 0x0f, 0
/* limits (etc) for data segment in real mode */
bootrealdata = . - gdt
.word 0xffff, 0
.byte 0, 0x92, 0x00, 0
gdtlen = . - gdt
#ifdef __ELF__
@ -292,6 +297,17 @@ ENTRY(prot_to_real)
sub $reloc, %eax
movl %eax, 4(%esp)
sub $reloc, %esp /* Adjust stack pointer */
/*
* Load the segment registers while still in protected mode.
* Otherwise the control bits don't get changed.
* The correct values are loaded later.
*/
movw $bootrealdata, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
ljmp $bootrealseg, $1f /* jump to a 16 bit segment */
1:
.code16