riscv-pke/kernel/process.h

41 lines
1.0 KiB
C

#ifndef _PROC_H_
#define _PROC_H_
#include "riscv.h"
typedef struct trapframe {
// 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;
}trapframe;
// code file struct, including directory index and file name char pointer
typedef struct {
uint64 dir; char *file;
} code_file;
// address-line number-file name table
typedef struct {
uint64 addr, line, file;
} addr_line;
// the extremely simple definition of process, used for begining labs of PKE
typedef struct process {
// pointing to the stack used in trap handling.
uint64 kstack;
// trapframe storing the context of a (User mode) process.
trapframe* trapframe;
char *debugline; char **dir; code_file *file; addr_line *line; int line_ind;
}process;
void switch_to(process*);
extern process* current;
#endif