CSRW/CSRS
This commit is contained in:
parent
0d7d09dda3
commit
dd8aed04c7
2 changed files with 95 additions and 0 deletions
12
kern/start.c
12
kern/start.c
|
|
@ -50,6 +50,18 @@ void start() {
|
|||
memory_sweep(heap_start, heap_end);
|
||||
buddy_init(heap_start, heap_end);
|
||||
spinlock_init(&sl);
|
||||
|
||||
/* Set previous privilege to S-mode, this causes mret to enter S-mode trap handler */
|
||||
unsigned long x = r_mstatus();
|
||||
x &= ~MSTATUS_MPP_MASK;
|
||||
x |= MSTATUS_MPP_S;
|
||||
w_mstatus(x);
|
||||
|
||||
/* Delegate all interrupts and exceptions to S-mode */
|
||||
w_medeleg(~(uint64_t)0x0);
|
||||
w_mideleg(~(uint64_t)0x0);
|
||||
w_sie(r_sie() | SIE_SEIE | SIE_STIE | SIE_SSIE);
|
||||
|
||||
for (int i = 0; i < banner_len; i++) uart_putc(banner[i]);
|
||||
__sync_synchronize();
|
||||
hold = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue