tiny clarifications to some gdt code.
This commit is contained in:
parent
0a4a4230a3
commit
858475e4df
4
mmu.h
4
mmu.h
|
@ -39,6 +39,7 @@
|
|||
|
||||
#define CR4_PSE 0x00000010 // Page size extension
|
||||
|
||||
// various segment selectors.
|
||||
#define SEG_KCODE 1 // kernel code
|
||||
#define SEG_KDATA 2 // kernel data+stack
|
||||
#define SEG_KCPU 3 // kernel per-cpu data
|
||||
|
@ -46,6 +47,9 @@
|
|||
#define SEG_UDATA 5 // user data+stack
|
||||
#define SEG_TSS 6 // this process's task state
|
||||
|
||||
// cpu->gdt[NSEGS] holds the above segments.
|
||||
#define NSEGS 7
|
||||
|
||||
//PAGEBREAK!
|
||||
#ifndef __ASSEMBLER__
|
||||
// Segment Descriptor
|
||||
|
|
3
proc.h
3
proc.h
|
@ -1,6 +1,3 @@
|
|||
// Segments in proc->gdt.
|
||||
#define NSEGS 7
|
||||
|
||||
// Per-CPU state
|
||||
struct cpu {
|
||||
uchar id; // Local APIC ID; index into cpus[] below
|
||||
|
|
3
vm.c
3
vm.c
|
@ -9,7 +9,6 @@
|
|||
|
||||
extern char data[]; // defined by kernel.ld
|
||||
pde_t *kpgdir; // for use in scheduler()
|
||||
struct segdesc gdt[NSEGS];
|
||||
|
||||
// Set up CPU's kernel segment descriptors.
|
||||
// Run once on entry on each CPU.
|
||||
|
@ -28,7 +27,7 @@ seginit(void)
|
|||
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
|
||||
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
|
||||
|
||||
// Map cpu, and curproc
|
||||
// Map cpu and curproc -- these are private per cpu.
|
||||
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
|
||||
|
||||
lgdt(c->gdt, sizeof(c->gdt));
|
||||
|
|
Loading…
Reference in a new issue