summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTom Cosgrove <tom@cvs.openbsd.org>2005-04-25 23:09:05 +0000
committerTom Cosgrove <tom@cvs.openbsd.org>2005-04-25 23:09:05 +0000
commit3cfb42c181cc35e4b2433664048bb940496c4870 (patch)
treee5536661f54ed3cd9801b1fb79fbf1da36df1fd4 /sys
parent29d8219ccaa4e8c0e0bda5a6c38968c8f2f4bd80 (diff)
[OpenBSD]
Make boot code use real mode with 64K segments instead of 1M segments. Improves stability with some disk controller cards. Also explicitly state operand size on some moves. Bump version on boot, cdboot and pxeboot accordingly. "just get them in" beck@ ok weingart@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/stand/boot/conf.c4
-rw-r--r--sys/arch/i386/stand/cdboot/conf.c4
-rw-r--r--sys/arch/i386/stand/libsa/gidt.S59
-rw-r--r--sys/arch/i386/stand/libsa/pxe_call.S10
-rw-r--r--sys/arch/i386/stand/pxeboot/conf.c4
5 files changed, 43 insertions, 38 deletions
diff --git a/sys/arch/i386/stand/boot/conf.c b/sys/arch/i386/stand/boot/conf.c
index 8fe3b541c12..83ee99bd8d5 100644
--- a/sys/arch/i386/stand/boot/conf.c
+++ b/sys/arch/i386/stand/boot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.28 2004/03/19 13:48:19 tom Exp $ */
+/* $OpenBSD: conf.c,v 1.29 2005/04/25 23:09:04 tom Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -43,7 +43,7 @@
#include <dev/cons.h>
#include "debug.h"
-const char version[] = "2.06";
+const char version[] = "2.07";
int debug = 1;
diff --git a/sys/arch/i386/stand/cdboot/conf.c b/sys/arch/i386/stand/cdboot/conf.c
index d51dd50e1e9..9e58b036577 100644
--- a/sys/arch/i386/stand/cdboot/conf.c
+++ b/sys/arch/i386/stand/cdboot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.1 2004/06/23 00:21:49 tom Exp $ */
+/* $OpenBSD: conf.c,v 1.2 2005/04/25 23:09:04 tom Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -43,7 +43,7 @@
#include <dev/cons.h>
#include "debug.h"
-const char version[] = "1.00";
+const char version[] = "1.01";
int debug = 1;
#undef _TEST
diff --git a/sys/arch/i386/stand/libsa/gidt.S b/sys/arch/i386/stand/libsa/gidt.S
index f4a51db396a..a1621b5d754 100644
--- a/sys/arch/i386/stand/libsa/gidt.S
+++ b/sys/arch/i386/stand/libsa/gidt.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: gidt.S,v 1.28 2004/03/19 13:48:18 tom Exp $ */
+/* $OpenBSD: gidt.S,v 1.29 2005/04/25 23:09:04 tom Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -69,8 +69,8 @@
1: \
.code16; \
movw $S16DATA, %ax; \
- mov %ax, %ds; \
- mov %ax, %es; \
+ movw %ax, %ds; \
+ movw %ax, %es; \
gidt_debug1; \
\
movl %cr0, %eax; /* disable pmmm */ \
@@ -80,19 +80,22 @@
/* reload real cs:ip */ \
data32 ljmp $(LINKADDR >> 4), $1f - LINKADDR; \
1: \
- xor %ax, %ax; /* setup: %ds, %es, %ss */ \
- mov %ax, %ds; \
- mov %ax, %es; \
- mov %ax, %ss; \
+ movw %cs, %ax; /* setup: %ds, %es, %ss = %cs */ \
+ movw %ax, %ds; \
+ movw %ax, %es; \
+ xorw %ax, %ax; \
+ movw %ax, %ss; \
\
gidt_debug2; \
\
- data32 addr32 lidt Idtr_real; /* load idtr for real mode */
+ data32 addr32 lidt (Idtr_real - LINKADDR); /* load idtr for real mode */
#define real2prot \
gidt_debug3; \
\
- data32 addr32 lgdt Gdtr; /* load the gdtr */ \
+ movw $LINKADDR >> 4, %ax; \
+ movw %ax, %ds; \
+ data32 addr32 lgdt (Gdtr - LINKADDR); /* load the gdtr */ \
\
movl %cr0, %eax; /* enable pmmm */ \
orl $CR0_PE, %eax; \
@@ -237,14 +240,14 @@ gdt:
.word (LINKADDR & 0xffff) # lobase
.byte (LINKADDR >> 16) & 0xff # midbase
.byte SDT_MEMERAC | 0 | 0x80 # RXAC, dpl = 0, present
- .byte 0xf | 0 | 0 | 0 # hilimit, xx, 16bit, byte granularity
+ .byte 0x0 | 0 | 0 | 0 # hilimit, xx, 16bit, byte granularity
.byte (LINKADDR >> 20) & 0xff # hibase
/* 0x20 : 16 bit data */
.word 0xFFFF # lolimit
.word (LINKADDR & 0xffff) # lobase
.byte (LINKADDR >> 16) & 0xff # midbase
.byte SDT_MEMRWA | 0 | 0x80 # RWA, dpl = 0, present
- .byte 0xf | 0 | 0 | 0 # hilimit, xx, 16bit, byte granularity
+ .byte 0x0 | 0 | 0 | 0 # hilimit, xx, 16bit, byte granularity
.byte (LINKADDR >> 20) & 0xff # hibase
.globl Gdtr
@@ -335,10 +338,10 @@ EMUh:
push %ds
- addr32 mov _C_LABEL(BIOS_regs)+(BIOSR_ES), %eax
- mov %ax, %es
- addr32 mov _C_LABEL(BIOS_regs)+(BIOSR_DS), %eax
- mov %ax, %ds
+ addr32 movw (_C_LABEL(BIOS_regs)+(BIOSR_ES) - LINKADDR), %ax
+ movw %ax, %es
+ addr32 movw (_C_LABEL(BIOS_regs)+(BIOSR_DS) - LINKADDR), %ax
+ movw %ax, %ds
# data32 movl $Leax, %eax
.byte 0x66, 0xb8
@@ -351,14 +354,14 @@ intno = . - 1
pop %ds
- addr32 mov %ebx, _C_LABEL(BIOS_regs)+(BIOSR_BX)
- mov %es, %bx
- addr32 mov %ebx, _C_LABEL(BIOS_regs)+(BIOSR_ES)
+ addr32 movw %bx, (_C_LABEL(BIOS_regs)+(BIOSR_BX) - LINKADDR)
+ movw %es, %bx
+ addr32 movw %bx, (_C_LABEL(BIOS_regs)+(BIOSR_ES) - LINKADDR)
movb %ah, %bh
lahf
xchgb %ah, %bh
- addr32 mov %eax, 2f
+ addr32 movl %eax, (2f - LINKADDR)
real2prot
@@ -367,9 +370,9 @@ intno = . - 1
2: .long 0x90909090
/* pass BIOS return values back to caller */
- mov %eax, 0xb*4(%esp)
- mov %ecx, 0xa*4(%esp)
- mov %edx, 0x9*4(%esp)
+ movl %eax, 0xb*4(%esp)
+ movl %ecx, 0xa*4(%esp)
+ movl %edx, 0x9*4(%esp)
movb %bh , 0xe*4(%esp)
/* clear NT flag in eflags */
@@ -381,12 +384,12 @@ intno = . - 1
popf
/* save registers into save area */
- mov %eax, _C_LABEL(BIOS_regs)+BIOSR_AX
- mov %ecx, _C_LABEL(BIOS_regs)+BIOSR_CX
- mov %edx, _C_LABEL(BIOS_regs)+BIOSR_DX
- mov %ebp, _C_LABEL(BIOS_regs)+BIOSR_BP
- mov %esi, _C_LABEL(BIOS_regs)+BIOSR_SI
- mov %edi, _C_LABEL(BIOS_regs)+BIOSR_DI
+ movl %eax, _C_LABEL(BIOS_regs)+BIOSR_AX
+ movl %ecx, _C_LABEL(BIOS_regs)+BIOSR_CX
+ movl %edx, _C_LABEL(BIOS_regs)+BIOSR_DX
+ movl %ebp, _C_LABEL(BIOS_regs)+BIOSR_BP
+ movl %esi, _C_LABEL(BIOS_regs)+BIOSR_SI
+ movl %edi, _C_LABEL(BIOS_regs)+BIOSR_DI
pop %gs
pop %fs
diff --git a/sys/arch/i386/stand/libsa/pxe_call.S b/sys/arch/i386/stand/libsa/pxe_call.S
index c9fb4ff1450..b7be49e59fa 100644
--- a/sys/arch/i386/stand/libsa/pxe_call.S
+++ b/sys/arch/i386/stand/libsa/pxe_call.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxe_call.S,v 1.2 2005/03/12 21:52:02 tom Exp $ */
+/* $OpenBSD: pxe_call.S,v 1.3 2005/04/25 23:09:04 tom Exp $ */
/* $NetBSD: pxe_call.S,v 1.2 2002/03/27 17:24:22 kanaoka Exp $ */
/*
@@ -142,11 +142,13 @@ p2r16:
data32 ljmp $(LINKADDR >> 4), $p2r16real - LINKADDR
p2r16real:
xorw %ax, %ax /* Reset segment registers: */
- movw %ax, %ds /* %ds: so we can get at Idtr_real */
movw %ax, %ss /* %ss: for our stack */
+ movw $LINKADDR >> 4, %ax /* We're linked to LINKADDR/16:0000 */
+ movw %ax, %ds /* %ds: so we can get at Idtr_real */
+
.extern Idtr_real
- data32 addr32 lidt Idtr_real; /* Set up IDT for real mode */
+ data32 addr32 lidt (Idtr_real - LINKADDR); /* Set up IDT for real mode */
movw %cs, %ax
movw %ax, %ds
@@ -174,7 +176,7 @@ real_to_prot:
movw $LINKADDR >> 4, %ax /* We're linked to LINKADDR/16:0000 */
movw %ax, %ds
- addr32 lgdt (Gdtr - LINKADDR) /* Reload the GDT */
+ data32 addr32 lgdt (Gdtr - LINKADDR) /* Reload the GDT */
movl %cr0, %eax /* Enable protected mode */
orl $CR0_PE, %eax
diff --git a/sys/arch/i386/stand/pxeboot/conf.c b/sys/arch/i386/stand/pxeboot/conf.c
index ebde7d92e27..fe51d014c5b 100644
--- a/sys/arch/i386/stand/pxeboot/conf.c
+++ b/sys/arch/i386/stand/pxeboot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.3 2005/03/13 22:07:23 tom Exp $ */
+/* $OpenBSD: conf.c,v 1.4 2005/04/25 23:09:04 tom Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -46,7 +46,7 @@
#include "pxeboot.h"
#include "pxe_net.h"
-const char version[] = "1.02";
+const char version[] = "1.03";
int debug = 1;
#undef _TEST