diff options
author | 2005-04-29 16:14:04 +0000 | |
---|---|---|
committer | 2005-04-29 16:14:04 +0000 | |
commit | 1bf9871817cc6023eca0b1fe0728cfcabe32ec42 (patch) | |
tree | b883983415b05ff9996174235c82b7612150a3d6 | |
parent | sync (diff) | |
download | wireguard-openbsd-1bf9871817cc6023eca0b1fe0728cfcabe32ec42.tar.xz wireguard-openbsd-1bf9871817cc6023eca0b1fe0728cfcabe32ec42.zip |
Make boot code use real mode with 64K segments instead of 1M segments,
to match i386 boot blocks. Improves stability with some disk controller
cards. Also expicitly state operand size on some moves.
Bump version on boot, cdboot and pxeboot accordingly.
-rw-r--r-- | sys/arch/amd64/stand/boot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/cdboot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/libsa/gidt.S | 59 | ||||
-rw-r--r-- | sys/arch/amd64/stand/libsa/pxe_call.S | 10 | ||||
-rw-r--r-- | sys/arch/amd64/stand/pxeboot/conf.c | 4 |
5 files changed, 43 insertions, 38 deletions
diff --git a/sys/arch/amd64/stand/boot/conf.c b/sys/arch/amd64/stand/boot/conf.c index 0496b88e656..4404b0b2c9c 100644 --- a/sys/arch/amd64/stand/boot/conf.c +++ b/sys/arch/amd64/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.2 2004/03/21 21:37:41 tom Exp $ */ +/* $OpenBSD: conf.c,v 1.3 2005/04/29 16:14:04 tom Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -42,7 +42,7 @@ #include <biosdev.h> #include <dev/cons.h> -const char version[] = "2.06"; +const char version[] = "2.07"; int debug = 1; diff --git a/sys/arch/amd64/stand/cdboot/conf.c b/sys/arch/amd64/stand/cdboot/conf.c index 29c69442bc8..85833ff1bc2 100644 --- a/sys/arch/amd64/stand/cdboot/conf.c +++ b/sys/arch/amd64/stand/cdboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.1 2004/08/21 18:53:38 tom Exp $ */ +/* $OpenBSD: conf.c,v 1.2 2005/04/29 16:14:04 tom Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -42,7 +42,7 @@ #include <biosdev.h> #include <dev/cons.h> -const char version[] = "1.00"; +const char version[] = "1.01"; int debug = 1; diff --git a/sys/arch/amd64/stand/libsa/gidt.S b/sys/arch/amd64/stand/libsa/gidt.S index fefd7890778..0290d9e9201 100644 --- a/sys/arch/amd64/stand/libsa/gidt.S +++ b/sys/arch/amd64/stand/libsa/gidt.S @@ -1,4 +1,4 @@ -/* $OpenBSD: gidt.S,v 1.2 2004/03/21 21:37:41 tom Exp $ */ +/* $OpenBSD: gidt.S,v 1.3 2005/04/29 16:14:04 tom Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -68,8 +68,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 */ \ @@ -79,19 +79,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; \ @@ -236,14 +239,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 @@ -333,10 +336,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 @@ -349,14 +352,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 @@ -365,9 +368,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 */ @@ -379,12 +382,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/amd64/stand/libsa/pxe_call.S b/sys/arch/amd64/stand/libsa/pxe_call.S index 25b13a52820..f2ae000e27b 100644 --- a/sys/arch/amd64/stand/libsa/pxe_call.S +++ b/sys/arch/amd64/stand/libsa/pxe_call.S @@ -1,4 +1,4 @@ -/* $OpenBSD: pxe_call.S,v 1.2 2005/03/13 22:14:54 tom Exp $ */ +/* $OpenBSD: pxe_call.S,v 1.3 2005/04/29 16:14: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/amd64/stand/pxeboot/conf.c b/sys/arch/amd64/stand/pxeboot/conf.c index 57d0cc441fb..92a9ee614f7 100644 --- a/sys/arch/amd64/stand/pxeboot/conf.c +++ b/sys/arch/amd64/stand/pxeboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.3 2005/03/13 22:31:49 tom Exp $ */ +/* $OpenBSD: conf.c,v 1.4 2005/04/29 16:14:04 tom Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -45,7 +45,7 @@ #include "pxeboot.h" #include "pxe_net.h" -const char version[] = "1.02"; +const char version[] = "1.03"; int debug = 0; #undef _TEST |