You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
riscv-pke/kernel/process.h

41 lines
995 B

#ifndef _PROC_H_
#define _PROC_H_
#include "riscv.h"
typedef struct trapframe_t {
// space to store context (all common registers)
/* offset:0 */ riscv_regs regs;
// process's "user kernel" stack
/* offset:248 */ uint64 kernel_sp;
// pointer to smode_trap_handler
/* offset:256 */ uint64 kernel_trap;
// saved user process counter
/* offset:264 */ uint64 epc;
// kernel page table. added @lab2_1
/* offset:272 */ uint64 kernel_satp;
}trapframe;
// the extremely simple definition of process, used for begining labs of PKE
typedef struct process_t {
// pointing to the stack used in trap handling.
uint64 kstack;
// user page table
pagetable_t pagetable;
// trapframe storing the context of a (User mode) process.
trapframe* trapframe;
}process;
// switch to run user app
void switch_to(process*);
// current running process
extern process* current;
// address of the first free page in our simple heap. added @lab2_2
extern uint64 g_ufree_page;
#endif