From 6c2def279ea92f1bfad331aeda0b2c7edd4703f0 Mon Sep 17 00:00:00 2001 From: bde Date: Fri, 8 Mar 1996 05:15:54 +0000 Subject: [PATCH] Fixed restoring segment descriptors in prot_to_real(). The descriptors must have limit 0xffff and attribute G = 0 (byte granularity) as well as other properties that they already had (see e.g., the Intel i486 manual section 22.5). Not restoring them broke Ctrl-Alt-Del in the bootstrap for my ASUS P55TP4XE system, probably because the Award BIOS does anti-tracing stuff involving inaccessible %esp's. asm.S: Don't use lret in prot_to_real(). This reduces the risk of using an incompletely intialized stack segment and saves space. Submitted by: "K.Higashino" (on 13 Jan 1995!) reworked by me --- sys/i386/boot/biosboot/asm.S | 21 +++++++++++---------- sys/i386/boot/biosboot/table.c | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/sys/i386/boot/biosboot/asm.S b/sys/i386/boot/biosboot/asm.S index ac59d5bb3bcb..82844a7aab7e 100644 --- a/sys/i386/boot/biosboot/asm.S +++ b/sys/i386/boot/biosboot/asm.S @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:34:13 rpd - * $Id: asm.S,v 1.5 1994/10/06 09:41:01 rgrimes Exp $ + * $Id: asm.S,v 1.6 1995/01/25 21:37:36 bde Exp $ */ @@ -116,16 +116,17 @@ xprot: ENTRY(prot_to_real) - /* set up a dummy stack frame for the second seg change. */ - movw $BOOTSEG, %ax - pushw %ax - movw $xreal, %ax /* gas botches pushw $xreal, extra bytes 0, 0 */ - pushw %ax /* decode to add %al, (%eax) (%al usually 0) */ + /* Prepare %ax while we're still in a mode that gas understands. */ + movw $0x30, %ax /* Change to use16 mode. */ ljmp $0x28, $x16 - x16: + + mov %ax, %ds + mov %ax, %ss + mov %ax, %es + /* clear the PE bit of CR0 */ mov %cr0, %eax data32 @@ -134,12 +135,12 @@ x16: /* * make intersegment jmp to flush the processor pipeline - * using the fake stack frame set up earlier * and reload CS register */ - lret - + data32 + ljmp $BOOTSEG, $xreal xreal: + /* * we are in real mode now * set up the real mode segment registers : DS, SS, ES diff --git a/sys/i386/boot/biosboot/table.c b/sys/i386/boot/biosboot/table.c index aa9778911b97..7faa9a8930bf 100644 --- a/sys/i386/boot/biosboot/table.c +++ b/sys/i386/boot/biosboot/table.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:36:43 rpd - * $Id: table.c,v 1.7 1995/05/30 07:58:36 rgrimes Exp $ + * $Id: table.c,v 1.8 1995/06/25 14:02:57 joerg Exp $ */ /* @@ -86,9 +86,9 @@ struct seg_desc Gdt[] = { {0xFFFF, RUN, RUN, 0x9E, 0x40, 0x0}, /* 0x18 : boot code */ {0xFFFF, RUN, RUN, 0x92, 0x40, 0x0}, /* 0x20 : boot data */ {0xFFFF, RUN, RUN, 0x9E, 0x0, 0x0}, /* 0x28 : boot code, 16 bits */ + {0xFFFF, 0x0, 0x0, 0x92, 0x0, 0x0}, /* 0x30 : boot data, 16 bits */ #ifdef BDE_DEBUGGER /* More for bdb. */ - {}, /* BIOS_CS_INDEX = 6 : null */ {}, /* BIOS_TMP_INDEX = 7 : null */ {}, /* TSS_INDEX = 8 : null */ {0xFFFF, 0x0, 0x0, 0xB2, 0x40, 0x0}, /* DS_286_INDEX = 9 */