usr: implement user process switching
This is a rather large commit, so the gist of it is this: User context switching is now functional, after a change to the TSS, and a few minor details in the scheduler and loader. ELF parsing is rather primitive, but basically functional, as long as it only loads code. The interrupt 0x80 is for syscalls, and will switch from user mode to kernel mode. It is currently the only interrupt that can be called from user mode This adds the syscall functionality, which currently uses a red-black tree to store the function pointers, although when the table is more flushed out, it will probably be replaced with an array The pager now correctly marks the parent nodes with attributes as it allocates them. Without doing this, the page table entries will never be reached in lower privilege modes, causing page faults Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
This commit is contained in:
parent
d60da85470
commit
37518aea81
19 changed files with 262 additions and 69 deletions
|
|
@ -34,13 +34,13 @@ uint16_t gdt_insert_tss(uintptr_t rsp0)
|
|||
|
||||
struct gdt_desc_sys *desc = (struct gdt_desc_sys *)((struct gdt_desc *)__gdt + gdt_index);
|
||||
|
||||
paddr_t tss_addr = (paddr_t)(tss_table + tss_index) & (~hhdm_start);
|
||||
paddr_t tss_addr = (paddr_t)(tss_table + tss_index);
|
||||
desc->limit = sizeof(struct tss) - 1;
|
||||
desc->base = tss_addr & 0xFFFF;
|
||||
desc->base = tss_addr & 0xFFFFFF;
|
||||
desc->base_2 = (tss_addr >> 16) & 0xFF;
|
||||
desc->base_3 = (tss_addr >> 24) & 0xFF;
|
||||
desc->base_4 = (tss_addr >> 32) & 0xFFFFFFFF;
|
||||
desc->access = 0x89;
|
||||
desc->access = 0xE9;
|
||||
desc->flags = 0x00;
|
||||
|
||||
tss_index += 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue