diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-04-11 22:48:49 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-04-11 22:48:49 +0000 |
commit | b2ae9c1408e33a32b375a2d119aca3d4346e55e5 (patch) | |
tree | 701d9211e04c5d72758456899868438ebe631a66 /sys/arch | |
parent | 36a87c82c58863d4ba925cda01067417297430ae (diff) |
Well, the changes make do not work
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/stand/biosboot/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/i386/stand/biosboot/biosboot.S | 116 |
2 files changed, 65 insertions, 55 deletions
diff --git a/sys/arch/i386/stand/biosboot/Makefile b/sys/arch/i386/stand/biosboot/Makefile index 0dd1fd90b4a..27e7b5caa07 100644 --- a/sys/arch/i386/stand/biosboot/Makefile +++ b/sys/arch/i386/stand/biosboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.13 1998/04/03 19:09:16 deraadt Exp $ +# $OpenBSD: Makefile,v 1.14 1998/04/11 22:48:47 deraadt Exp $ PROG= biosboot SRCS= biosboot.S @@ -23,5 +23,5 @@ ${PROG}: $(OBJS) $(DPADD) .include <bsd.prog.mk> CPPFLAGS+=-DLOADADDR=$(LOADADDR) -DBOOTMAGIC=$(BOOTMAGIC) -DBOOTREL=$(BOOTREL) -CPPFLAGS+=${DEBUGFLAGS} -DBEMBR +CPPFLAGS+=${DEBUGFLAGS} -DBEMBR -DDEBUG #AFLAGS+=-Wa,-a diff --git a/sys/arch/i386/stand/biosboot/biosboot.S b/sys/arch/i386/stand/biosboot/biosboot.S index cc998793057..05ce765b10f 100644 --- a/sys/arch/i386/stand/biosboot/biosboot.S +++ b/sys/arch/i386/stand/biosboot/biosboot.S @@ -1,7 +1,7 @@ -/* $OpenBSD: biosboot.S,v 1.24 1998/04/03 19:09:18 deraadt Exp $ */ +/* $OpenBSD: biosboot.S,v 1.25 1998/04/11 22:48:48 deraadt Exp $ */ /* - * Copyright (c) 1997 Michael Shalayeff, Tobias Weingartner + * Copyright (c) 1997 Michael Shalayeff * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,28 +39,31 @@ #define addr32 .byte 0x67 #define data32 .byte 0x66 -#define BLKCNT 14 /* Max without colliding with the partition table */ +#define BLKCNT 12 /* Max without colliding with the partition table */ #define BOOTSEG 0x07c0 /* boot loaded here */ #define BOOTSTACK 0xfffc /* stack starts here */ #define ZMAGIC 0x0b01 /* ZMAGIC */ - -/* Clobbers %al - maybe more */ -#define putc(c) \ - movb $c, %al; \ +#ifdef DEBUG +#define DBGMSG(msg) \ + movb $msg, %al; \ .byte 0xe8; \ .word Lchr - . - 2 - -/* Clobbers %esi - maybe more */ +#define GO_RELOC 'R' /* running relocated code */ +#define REAL2PROT 'P' /* switch to protected mode */ +#else /* !DEBUG */ +#define DBGMSG(msg) /* */ +#endif /* !DEBUG */ #define puts(s) \ - data32; \ + data32; \ movl $s, %esi; \ + /* call Lmessage */; \ .byte 0xe8; \ .word Lmessage - . - 2 - .text + .globl start start: jmp 1f @@ -93,31 +96,46 @@ ebpb: .long 16 /* hidden sectors */ /* boot code */ . = start + 0x3e -1: - /* Fix up %cs just in case */ - data32 - ljmp $BOOTSEG, $1f - -load_msg: - .asciz "reading boot" - -1: - /* set up stack (%ss:%esp) */ +1: /* set up stack (%ss:%esp) */ cli /* disable interrupts w/o stack */ - xorl %ax, %ax + # movw $(BOOTREL >> 4), %ax + .byte 0xb8 + .word BOOTREL >> 4 movl %ax, %ss + movl %ax, %es /* relocate there */ data32 movl $BOOTSTACK, %esp sti /* we have stack, do ints */ - /* Set up other segment regs */ - # movw $BOOTSEG, %ax + # movw $BOOTSEG, %ax /* we are here */ .byte 0xb8 .word BOOTSEG movl %ax, %ds + xorl %si, %si + xorl %di, %di + # movw $0x100, %cx /* 512 bytes to move */ + .byte 0xb9 + .word 0x100 + cld + rep; movsl + + /* jump to relocated code */ + data32 + ljmp $(BOOTREL >> 4), $2f +1: .asciz "loading /boot" + +2: DBGMSG(GO_RELOC) + + nop + /* set up %ds */ + pushl %cs + popl %ds + + /* set up %es, (where we will load /boot to) */ + # movw $(LOADADDR >> 4), %ax + .byte 0xb8 + .word LOADADDR >> 4 movl %ax, %es - movl %ax, %fs - movl %ax, %gs #ifdef SERIAL # Initialize the serial port to 9600 baud, 8N1. @@ -131,19 +149,7 @@ load_msg: int $0x14 popl %dx #endif - -#ifdef DEBUG - putc('R') -#endif - - /* Print pretty message */ - puts(load_msg) - - /* set up %es, (where we will load /boot to) */ - # movw $(LOADADDR >> 4), %ax - .byte 0xb8 - .word LOADADDR >> 4 - movl %ax, %es + puts(1b) data32 xorl %ebx, %ebx /* put it at %es:0 */ @@ -173,7 +179,10 @@ load_msg: 2: .asciz "\r\nRead error\r\n" 3: /* read next block */ - putc('.') /* show progress indicator */ + movb $'.', %al + # call Lchr /* show progress indicator */ + .byte 0xe8 + .word Lchr - . - 2 popl %ax movzbl %al, %ax @@ -199,16 +208,17 @@ halt: hlt 1: .ascii "Bad magic" 2: .asciz "\r\n" - -3: /* At this point we could try to use the entry point in - * the image we just loaded. But if we do that, we also - * have to potentially support loading that image where it - * is supposed to go. Screw it, just assume that the image - * is sane. - */ -#ifdef DEBUG - putc('P') +3: +#if notdef + data32;es;lodsl /* text size */ + data32;es;lodsl /* data size */ + data32;es;lodsl /* bss size */ + data32;es;lodsl /* syms size */ #endif + data32 + addl 16(%esi), %edi /* entry */ + + DBGMSG(REAL2PROT) /* change to protected mode */ /* guarantee that interrupts are disabled when in prot mode */ @@ -230,11 +240,11 @@ halt: * reload CS register */ data32 - ljmp $8, $(BOOTSEG << 4) + 1f + ljmp $8, $1f+BOOTREL 1: /* * 32bit mode - * set up %ds, %ss, %es, etc + * set up %ds, %ss, %es */ movw $0x10, %eax movl %ax, %ds @@ -322,7 +332,7 @@ Lchr: .byte 0xf | 0 | 0x40 | 0x80 # hilimit, xx, 32bit, 4k granularity .byte 0 # hibase Gdtr: .word . - 1b - .long (BOOTSEG << 4) + 1b + .long BOOTREL + 1b .globl _block_table, _block_count _block_count: @@ -331,7 +341,7 @@ _block_table: .word 0 /* cylinder/sector */ .byte 0 /* head */ .byte 0 /* nsect */ - . = _block_table + BLKCNT*4 + # . = _block_table + BLKCNT*4 #ifdef BEMBR . = 0x1b8 |