tiny clarifications to some gdt code.

This commit is contained in:
Robert Morris 2016-08-10 10:51:14 -04:00
parent 0a4a4230a3
commit 858475e4df
3 changed files with 5 additions and 5 deletions

4
mmu.h
View file

@ -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
View file

@ -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
View file

@ -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));