My background: I’m a Go dev and am now learning Rust, so I checked out this course on OS.
I see that struct proc
represents a process in xv6, but why does proc
has field kstack
as char*
? Isn’t char
in C a byte (uint8)? They why reference to a byte is the bottom of kernel stack.
struct proc {
char *mem; // Start of process memory
uint sz; // Size of process memory
char *kstack; // Bottom of kernel stack
// for this process
enum proc_state state; // Process state
int pid; // Process ID
struct proc *parent; // Parent process
void *chan; // If !zero, sleeping on chan
int killed; // If !zero, has been killed
struct file *ofile[NOFILE]; // Open files
struct inode *cwd; // Current directory
struct context context; // Switch here to run process
struct trapframe *tf; // Trap frame for the current interrupt
};