Make gdt_segs[] public again for APM.

Make ldt[] public again and restore currentldt and _default_ldt for
USER_LDT.
This commit is contained in:
Bruce Evans 1994-11-15 14:12:55 +00:00
parent dc4de4ca23
commit b0d1e6de04
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4501
4 changed files with 32 additions and 16 deletions

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.90 1994/11/14 14:19:55 bde Exp $
* $Id: machdep.c,v 1.91 1994/11/14 14:23:54 bde Exp $
*/
#include "npx.h"
@ -160,8 +160,6 @@ extern int pager_map_size;
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
static union descriptor ldt[NLDT]; /* local descriptor table */
void
cpu_startup()
{
@ -932,15 +930,18 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
* Initialize segments & interrupt table
*/
int currentldt;
int _default_ldt;
union descriptor gdt[NGDT]; /* global descriptor table */
struct gate_descriptor idt[NIDT]; /* interrupt descriptor table */
union descriptor ldt[NLDT]; /* local descriptor table */
struct i386tss tss, panic_tss;
extern struct user *proc0paddr;
/* software prototypes -- in more palatable form */
static struct soft_segment_descriptor gdt_segs[] = {
struct soft_segment_descriptor gdt_segs[] = {
/* GNULL_SEL 0 Null Descriptor */
{ 0x0, /* segment base address */
0x0, /* length */
@ -1087,7 +1088,8 @@ struct soft_segment_descriptor ldt_segs[] = {
1, /* segment descriptor present */
0, 0,
1, /* default 32 vs 16 bit size */
1 /* limit granularity (byte/page units)*/ } };
1 /* limit granularity (byte/page units)*/ },
};
void
setidt(idx, func, typ, dpl)
@ -1245,7 +1247,9 @@ init386(first)
r_idt.rd_base = (int) idt;
lidt(&r_idt);
lldt(GSEL(GLDT_SEL, SEL_KPL));
_default_ldt = GSEL(GLDT_SEL, SEL_KPL);
lldt(_default_ldt);
currentldt = _default_ldt;
#ifdef DDB
kdb_init();

View File

@ -35,11 +35,11 @@
* SUCH DAMAGE.
*
* from: @(#)segments.h 7.1 (Berkeley) 5/9/91
* $Id: segments.h,v 1.5 1994/10/01 02:56:08 davidg Exp $
* $Id: segments.h,v 1.6 1994/11/14 14:18:15 bde Exp $
*/
#ifndef _MACHINE_SEGMENTS_H_
#define _MACHINE_SEGMENTS_H_ 1
#define _MACHINE_SEGMENTS_H_
/*
* 386 Segmentation Data Structures and definitions
@ -231,8 +231,12 @@ struct region_descriptor {
#define NLDT (LUDATA_SEL + 1)
#ifdef KERNEL
extern int currentldt;
extern int _default_ldt;
extern union descriptor gdt[NGDT];
extern struct soft_segment_descriptor gdt_segs[];
extern struct gate_descriptor idt[NIDT];
extern union descriptor ldt[NLDT];
void lgdt __P((struct region_descriptor *rdp));
void lidt __P((struct region_descriptor *rdp));

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.90 1994/11/14 14:19:55 bde Exp $
* $Id: machdep.c,v 1.91 1994/11/14 14:23:54 bde Exp $
*/
#include "npx.h"
@ -160,8 +160,6 @@ extern int pager_map_size;
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
static union descriptor ldt[NLDT]; /* local descriptor table */
void
cpu_startup()
{
@ -932,15 +930,18 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
* Initialize segments & interrupt table
*/
int currentldt;
int _default_ldt;
union descriptor gdt[NGDT]; /* global descriptor table */
struct gate_descriptor idt[NIDT]; /* interrupt descriptor table */
union descriptor ldt[NLDT]; /* local descriptor table */
struct i386tss tss, panic_tss;
extern struct user *proc0paddr;
/* software prototypes -- in more palatable form */
static struct soft_segment_descriptor gdt_segs[] = {
struct soft_segment_descriptor gdt_segs[] = {
/* GNULL_SEL 0 Null Descriptor */
{ 0x0, /* segment base address */
0x0, /* length */
@ -1087,7 +1088,8 @@ struct soft_segment_descriptor ldt_segs[] = {
1, /* segment descriptor present */
0, 0,
1, /* default 32 vs 16 bit size */
1 /* limit granularity (byte/page units)*/ } };
1 /* limit granularity (byte/page units)*/ },
};
void
setidt(idx, func, typ, dpl)
@ -1245,7 +1247,9 @@ init386(first)
r_idt.rd_base = (int) idt;
lidt(&r_idt);
lldt(GSEL(GLDT_SEL, SEL_KPL));
_default_ldt = GSEL(GLDT_SEL, SEL_KPL);
lldt(_default_ldt);
currentldt = _default_ldt;
#ifdef DDB
kdb_init();

View File

@ -35,11 +35,11 @@
* SUCH DAMAGE.
*
* from: @(#)segments.h 7.1 (Berkeley) 5/9/91
* $Id: segments.h,v 1.5 1994/10/01 02:56:08 davidg Exp $
* $Id: segments.h,v 1.6 1994/11/14 14:18:15 bde Exp $
*/
#ifndef _MACHINE_SEGMENTS_H_
#define _MACHINE_SEGMENTS_H_ 1
#define _MACHINE_SEGMENTS_H_
/*
* 386 Segmentation Data Structures and definitions
@ -231,8 +231,12 @@ struct region_descriptor {
#define NLDT (LUDATA_SEL + 1)
#ifdef KERNEL
extern int currentldt;
extern int _default_ldt;
extern union descriptor gdt[NGDT];
extern struct soft_segment_descriptor gdt_segs[];
extern struct gate_descriptor idt[NIDT];
extern union descriptor ldt[NLDT];
void lgdt __P((struct region_descriptor *rdp));
void lidt __P((struct region_descriptor *rdp));