Mindbogglingly, many BIOS vendors expect to be able to load %ds with
0x40 and then access data stored in real-mode segment 0x40, even when called in protected mode. Microsoft unfortunately coddle these individuals, and so must we if we want to run their code. This change works around GPFs in some APM and PnP BIOS implementations. Obtained from: Linux
This commit is contained in:
parent
fb63bd8ded
commit
da44a32897
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.357 1999/07/29 01:49:18 msmith Exp $
|
||||
* $Id: machdep.c,v 1.358 1999/08/09 10:34:43 phk Exp $
|
||||
*/
|
||||
|
||||
#include "apm.h"
|
||||
@ -995,7 +995,16 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* GPANIC_SEL 8 Panic Tss Descriptor */
|
||||
/* GBIOSLOWMEM_SEL 8 BIOS access to realmode segment 0x40, must be #8 in GDT */
|
||||
{ 0x400, /* segment base address */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMRWA, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GPANIC_SEL 9 Panic Tss Descriptor */
|
||||
{ (int) &dblfault_tss, /* segment base address */
|
||||
sizeof(struct i386tss)-1,/* length - all address space */
|
||||
SDT_SYS386TSS, /* segment type */
|
||||
@ -1004,16 +1013,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, 0,
|
||||
0, /* unused - default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSCODE32_SEL 9 BIOS 32-bit interface (32bit Code) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMERA, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSCODE16_SEL 10 BIOS 32-bit interface (16bit Code) */
|
||||
/* GBIOSCODE32_SEL 10 BIOS 32-bit interface (32bit Code) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMERA, /* segment type */
|
||||
@ -1022,7 +1022,16 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSDATA_SEL 11 BIOS 32-bit interface (Data) */
|
||||
/* GBIOSCODE16_SEL 11 BIOS 32-bit interface (16bit Code) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMERA, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSDATA_SEL 12 BIOS 32-bit interface (Data) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMRWA, /* segment type */
|
||||
@ -1031,7 +1040,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSUTIL_SEL 12 BIOS 16-bit interface (Utility) */
|
||||
/* GBIOSUTIL_SEL 13 BIOS 16-bit interface (Utility) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMRWA, /* segment type */
|
||||
@ -1040,7 +1049,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSARGS_SEL 13 BIOS 16-bit interface (Arguments) */
|
||||
/* GBIOSARGS_SEL 14 BIOS 16-bit interface (Arguments) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMRWA, /* segment type */
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)segments.h 7.1 (Berkeley) 5/9/91
|
||||
* $Id: segments.h,v 1.20 1999/06/18 14:32:21 bde Exp $
|
||||
* $Id: segments.h,v 1.21 1999/07/29 01:49:19 msmith Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_SEGMENTS_H_
|
||||
@ -214,17 +214,18 @@ struct region_descriptor {
|
||||
#define GLDT_SEL 5 /* LDT - eventually one per process */
|
||||
#define GUSERLDT_SEL 6 /* User LDT */
|
||||
#define GTGATE_SEL 7 /* Process task switch gate */
|
||||
#define GPANIC_SEL 8 /* Task state to consider panic from */
|
||||
#define GBIOSCODE32_SEL 9 /* BIOS interface (32bit Code) */
|
||||
#define GBIOSCODE16_SEL 10 /* BIOS interface (16bit Code) */
|
||||
#define GBIOSDATA_SEL 11 /* BIOS interface (Data) */
|
||||
#define GBIOSUTIL_SEL 12 /* BIOS interface (Utility) */
|
||||
#define GBIOSARGS_SEL 13 /* BIOS interface (Arguments) */
|
||||
#define GBIOSLOWMEM_SEL 8 /* BIOS low memory access (must be entry 8) */
|
||||
#define GPANIC_SEL 9 /* Task state to consider panic from */
|
||||
#define GBIOSCODE32_SEL 10 /* BIOS interface (32bit Code) */
|
||||
#define GBIOSCODE16_SEL 11 /* BIOS interface (16bit Code) */
|
||||
#define GBIOSDATA_SEL 12 /* BIOS interface (Data) */
|
||||
#define GBIOSUTIL_SEL 13 /* BIOS interface (Utility) */
|
||||
#define GBIOSARGS_SEL 14 /* BIOS interface (Arguments) */
|
||||
|
||||
#ifdef BDE_DEBUGGER
|
||||
#define NGDT 18 /* some of 11-17 are reserved for debugger */
|
||||
#else
|
||||
#define NGDT 14
|
||||
#define NGDT 15
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.357 1999/07/29 01:49:18 msmith Exp $
|
||||
* $Id: machdep.c,v 1.358 1999/08/09 10:34:43 phk Exp $
|
||||
*/
|
||||
|
||||
#include "apm.h"
|
||||
@ -995,7 +995,16 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* GPANIC_SEL 8 Panic Tss Descriptor */
|
||||
/* GBIOSLOWMEM_SEL 8 BIOS access to realmode segment 0x40, must be #8 in GDT */
|
||||
{ 0x400, /* segment base address */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMRWA, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GPANIC_SEL 9 Panic Tss Descriptor */
|
||||
{ (int) &dblfault_tss, /* segment base address */
|
||||
sizeof(struct i386tss)-1,/* length - all address space */
|
||||
SDT_SYS386TSS, /* segment type */
|
||||
@ -1004,16 +1013,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, 0,
|
||||
0, /* unused - default 32 vs 16 bit size */
|
||||
0 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSCODE32_SEL 9 BIOS 32-bit interface (32bit Code) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMERA, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSCODE16_SEL 10 BIOS 32-bit interface (16bit Code) */
|
||||
/* GBIOSCODE32_SEL 10 BIOS 32-bit interface (32bit Code) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMERA, /* segment type */
|
||||
@ -1022,7 +1022,16 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSDATA_SEL 11 BIOS 32-bit interface (Data) */
|
||||
/* GBIOSCODE16_SEL 11 BIOS 32-bit interface (16bit Code) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMERA, /* segment type */
|
||||
0, /* segment descriptor priority level */
|
||||
1, /* segment descriptor present */
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSDATA_SEL 12 BIOS 32-bit interface (Data) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMRWA, /* segment type */
|
||||
@ -1031,7 +1040,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, 0,
|
||||
1, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSUTIL_SEL 12 BIOS 16-bit interface (Utility) */
|
||||
/* GBIOSUTIL_SEL 13 BIOS 16-bit interface (Utility) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMRWA, /* segment type */
|
||||
@ -1040,7 +1049,7 @@ struct soft_segment_descriptor gdt_segs[] = {
|
||||
0, 0,
|
||||
0, /* default 32 vs 16 bit size */
|
||||
1 /* limit granularity (byte/page units)*/ },
|
||||
/* GBIOSARGS_SEL 13 BIOS 16-bit interface (Arguments) */
|
||||
/* GBIOSARGS_SEL 14 BIOS 16-bit interface (Arguments) */
|
||||
{ 0, /* segment base address (overwritten) */
|
||||
0xfffff, /* length */
|
||||
SDT_MEMRWA, /* segment type */
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)segments.h 7.1 (Berkeley) 5/9/91
|
||||
* $Id: segments.h,v 1.20 1999/06/18 14:32:21 bde Exp $
|
||||
* $Id: segments.h,v 1.21 1999/07/29 01:49:19 msmith Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_SEGMENTS_H_
|
||||
@ -214,17 +214,18 @@ struct region_descriptor {
|
||||
#define GLDT_SEL 5 /* LDT - eventually one per process */
|
||||
#define GUSERLDT_SEL 6 /* User LDT */
|
||||
#define GTGATE_SEL 7 /* Process task switch gate */
|
||||
#define GPANIC_SEL 8 /* Task state to consider panic from */
|
||||
#define GBIOSCODE32_SEL 9 /* BIOS interface (32bit Code) */
|
||||
#define GBIOSCODE16_SEL 10 /* BIOS interface (16bit Code) */
|
||||
#define GBIOSDATA_SEL 11 /* BIOS interface (Data) */
|
||||
#define GBIOSUTIL_SEL 12 /* BIOS interface (Utility) */
|
||||
#define GBIOSARGS_SEL 13 /* BIOS interface (Arguments) */
|
||||
#define GBIOSLOWMEM_SEL 8 /* BIOS low memory access (must be entry 8) */
|
||||
#define GPANIC_SEL 9 /* Task state to consider panic from */
|
||||
#define GBIOSCODE32_SEL 10 /* BIOS interface (32bit Code) */
|
||||
#define GBIOSCODE16_SEL 11 /* BIOS interface (16bit Code) */
|
||||
#define GBIOSDATA_SEL 12 /* BIOS interface (Data) */
|
||||
#define GBIOSUTIL_SEL 13 /* BIOS interface (Utility) */
|
||||
#define GBIOSARGS_SEL 14 /* BIOS interface (Arguments) */
|
||||
|
||||
#ifdef BDE_DEBUGGER
|
||||
#define NGDT 18 /* some of 11-17 are reserved for debugger */
|
||||
#else
|
||||
#define NGDT 14
|
||||
#define NGDT 15
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user