This commit is contained in:
Imbus 2025-09-01 21:50:22 +02:00
parent ea016307cf
commit ae356930d8
8 changed files with 12 additions and 201 deletions

View file

@ -1,5 +1,5 @@
#pragma once
#include <types.h>
#include <stdint.h>
typedef struct {
volatile uint32_t v; // 0 = unlocked, 1 = locked

View file

@ -1,3 +1,6 @@
#include <config.h>
#include <spinlock.h>
#include <riscv.h>
#include <stdint.h>
typedef enum {
@ -37,6 +40,7 @@ struct Cpu {
int intena; // Were interrupts enabled before push_off()?
};
/** Saved registers for kernel context switches. */
typedef struct {
/* 0 */ uint64_t kernel_satp; // kernel page table
/* 8 */ uint64_t kernel_sp; // top of process's kernel stack
@ -75,3 +79,10 @@ typedef struct {
/* 272 */ uint64_t t5;
/* 280 */ uint64_t t6;
} TrapFrame_t;
struct Cpu *mycpu(void);
extern struct Cpu cpus[NCPU];
/** Per-process state */
struct Proc {};