2 static char RCSId[] = "$Id: ldt.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
3 static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
8 #include "prototypes.h"
10 #if defined(__NetBSD__) || defined(__FreeBSD__)
11 #include <machine/segments.h>
14 /**********************************************************************
17 /* XXX These are *real* 386 descriptors !! */
23 unsigned long base_addr, limit;
25 #if defined(__NetBSD__) || defined(__FreeBSD__)
26 struct segment_descriptor *sd;
29 if (get_ldt(buffer) < 0)
32 lp = (unsigned long *) buffer;
33 #if defined(__NetBSD__) || defined(__FreeBSD__)
34 sd = (struct segment_descriptor *) buffer;
37 for (i = 0; i < 32; i++, lp++)
39 /* First 32 bits of descriptor */
40 base_addr = (*lp >> 16) & 0x0000FFFF;
41 limit = *lp & 0x0000FFFF;
44 /* First 32 bits of descriptor */
45 base_addr |= (*lp & 0xFF000000) | ((*lp << 16) & 0x00FF0000);
46 limit |= (*lp & 0x000F0000);
48 type = (*lp >> 10) & 5;
49 dpl = (*lp >> 13) & 3;
51 #if defined(__NetBSD__) || defined(__FreeBSD__)
58 printf("Entry %2d: Base %08.8x, Limit %05.5x, DPL %d, Type %d\n",
59 i, base_addr, limit, dpl, type);
74 printf("page limit, ");
76 printf("byte limit, ");
78 printf(" %08.8x %08.8x\n", *(lp), *(lp-1));
82 printf("Entry %2d: Base %08.8x, Limit %05.5x, DPL %d, Type %d\n",
83 i, base_addr, limit, dpl, type);
84 printf(" SYSTEM: %08.8x %08.8x\n", *lp, *(lp-1));
89 #endif /* ifndef WINELIB */