【发布时间】:2022-08-19 03:02:29
【问题描述】:
在 xv6-x86 中,每个 cpu 结构都有一个 gdt:
struct cpu {
uchar apicid; // LAPIC ID
struct context *scheduler;
struct taskstate ts;
struct segdesc gdt[NSEGS]; // GDT
volatile uint started;
int ncli;
int intena;
struct proc *proc;
};
但它在 xv6-riscv 中被删除:
// Per-CPU state.
struct cpu {
struct proc *proc; // The process running on this cpu, or null.
struct context context; // swtch() here to enter scheduler().
int noff; // Depth of push_off() nesting.
int intena; // Were interrupts enabled before push_off()?
};
所以操作系统中不需要gdt? 很困惑,感谢任何答复。
标签: operating-system riscv xv6