Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yhzhang0128 committed Dec 30, 2022
1 parent a8071db commit e9d0ff5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ github.com/AlDanial/cloc v 1.94 T=0.05 s (949.3 files/s, 62349.4 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C 36 487 593 1580
C/C++ Header 10 70 105 286
C 36 486 589 1581
C/C++ Header 10 69 105 285
Assembly 3 6 24 70
make 1 12 0 64
-------------------------------------------------------------------------------
SUM: 50 575 722 2000 <- exactly 2000
SUM: 50 573 718 2000 <- exactly 2000
-------------------------------------------------------------------------------
```

Expand Down
6 changes: 3 additions & 3 deletions grass/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
struct process{
int pid;
int status;
int receiver_pid; /* used when waiting to send a message */
int receiver_pid; /* used when waiting to send a message */
void *sp, *mepc; /* process context = stack pointer (sp)
* + machine exception program counter (mepc) */

void *mepc; /* machine exception program counter (mepc) */
void *sp_vaddr; /* used to switch between user and kernel stacks */
};

#define MAX_NPROCESS 16
Expand Down
4 changes: 2 additions & 2 deletions grass/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void intr_entry(int id) {
}

/* Switch to the kernel stack */
ctx_start(&proc_set[proc_curr_idx].sp_vaddr, (void*)GRASS_STACK_TOP);
ctx_start(&proc_set[proc_curr_idx].sp, (void*)GRASS_STACK_TOP);
}

void ctx_entry() {
Expand All @@ -72,7 +72,7 @@ void ctx_entry() {
/* Switch back to the user application stack */
mepc = (int)proc_set[proc_curr_idx].mepc;
asm("csrw mepc, %0" ::"r"(mepc));
ctx_switch((void**)&tmp, proc_set[proc_curr_idx].sp_vaddr);
ctx_switch((void**)&tmp, proc_set[proc_curr_idx].sp);
}

static void proc_yield() {
Expand Down

0 comments on commit e9d0ff5

Please sign in to comment.