summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1997-05-11 12:39:43 +0000
committerbde <bde@FreeBSD.org>1997-05-11 12:39:43 +0000
commit7ed868f1de65ea67be1f55e47e10cef7494445ea (patch)
tree9630f0dab60abb7abed894e4fbbb5f0e44b60a47
parent4dcc2cb0014be35a26a631e178322edc5a552ef4 (diff)
downloadFreeBSD-src-7ed868f1de65ea67be1f55e47e10cef7494445ea.zip
FreeBSD-src-7ed868f1de65ea67be1f55e47e10cef7494445ea.tar.gz
Fixed initialization of ldt[]. Unused entries were garbage. A comment
was stale. Fixed initialization of gdt[] for the BDE_DEBUGGER case. APM entries clobbered debugger entries if the debugger was loaded (APM is incompatible with BDE_DEBUGGER) and unused entries were garbage if the debugger wasn't loaded.
-rw-r--r--sys/amd64/amd64/machdep.c12
-rw-r--r--sys/i386/i386/machdep.c12
2 files changed, 16 insertions, 8 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index c56b58e..1b1078c 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.239 1997/04/26 11:45:10 peter Exp $
+ * $Id: machdep.c,v 1.240 1997/05/07 20:12:47 peter Exp $
*/
#include "npx.h"
@@ -1048,7 +1048,12 @@ init386(first)
*/
gdt_segs[GCODE_SEL].ssd_limit = i386_btop(0) - 1;
gdt_segs[GDATA_SEL].ssd_limit = i386_btop(0) - 1;
- for (x = 0; x < NGDT; x++)
+#ifdef BDE_DEBUGGER
+#define NGDT1 8 /* avoid overwriting db entries with APM ones */
+#else
+#define NGDT1 (sizeof gdt_segs / sizeof gdt_segs[0])
+#endif
+ for (x = 0; x < NGDT1; x++)
ssdtosd(&gdt_segs[x], &gdt[x].sd);
#ifdef SMP
@@ -1084,8 +1089,7 @@ init386(first)
#define VM_END_USER_R_ADDRESS (VM_END_USER_RW_ADDRESS + UPAGES * PAGE_SIZE)
ldt_segs[LUCODE_SEL].ssd_limit = i386_btop(VM_END_USER_R_ADDRESS) - 1;
ldt_segs[LUDATA_SEL].ssd_limit = i386_btop(VM_END_USER_RW_ADDRESS) - 1;
- /* Note. eventually want private ldts per process */
- for (x = 0; x < NLDT; x++)
+ for (x = 0; x < sizeof ldt_segs / sizeof ldt_segs[0]; x++)
ssdtosd(&ldt_segs[x], &ldt[x].sd);
/* exceptions */
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index c56b58e..1b1078c 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.239 1997/04/26 11:45:10 peter Exp $
+ * $Id: machdep.c,v 1.240 1997/05/07 20:12:47 peter Exp $
*/
#include "npx.h"
@@ -1048,7 +1048,12 @@ init386(first)
*/
gdt_segs[GCODE_SEL].ssd_limit = i386_btop(0) - 1;
gdt_segs[GDATA_SEL].ssd_limit = i386_btop(0) - 1;
- for (x = 0; x < NGDT; x++)
+#ifdef BDE_DEBUGGER
+#define NGDT1 8 /* avoid overwriting db entries with APM ones */
+#else
+#define NGDT1 (sizeof gdt_segs / sizeof gdt_segs[0])
+#endif
+ for (x = 0; x < NGDT1; x++)
ssdtosd(&gdt_segs[x], &gdt[x].sd);
#ifdef SMP
@@ -1084,8 +1089,7 @@ init386(first)
#define VM_END_USER_R_ADDRESS (VM_END_USER_RW_ADDRESS + UPAGES * PAGE_SIZE)
ldt_segs[LUCODE_SEL].ssd_limit = i386_btop(VM_END_USER_R_ADDRESS) - 1;
ldt_segs[LUDATA_SEL].ssd_limit = i386_btop(VM_END_USER_RW_ADDRESS) - 1;
- /* Note. eventually want private ldts per process */
- for (x = 0; x < NLDT; x++)
+ for (x = 0; x < sizeof ldt_segs / sizeof ldt_segs[0]; x++)
ssdtosd(&ldt_segs[x], &ldt[x].sd);
/* exceptions */
OpenPOWER on IntegriCloud