Skip to content

Commit

Permalink
Clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
HAKarlsson committed May 16, 2024
1 parent 98501df commit 0842e21
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
9 changes: 5 additions & 4 deletions kernel/src/exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#define SRET 0x10200073
#define URET 0x00200073


static proc_t *_exception_delegate(proc_t *proc, uint64_t mcause, uint64_t mtval)
static proc_t *_exception_delegate(proc_t *proc, uint64_t mcause,
uint64_t mtval)
{
proc->regs[REG_ECAUSE] = mcause;
proc->regs[REG_EVAL] = mtval;
Expand All @@ -36,9 +36,10 @@ static proc_t *_exception_trap_return(proc_t *proc)
return proc;
}

proc_t *exception_handler(proc_t * proc, uint64_t mcause, uint64_t mtval)
proc_t *exception_handler(proc_t *proc, uint64_t mcause, uint64_t mtval)
{
if (mcause == ILLEGAL_INSTRUCTION && (mtval == MRET || mtval == SRET || mtval == URET))
if (mcause == ILLEGAL_INSTRUCTION
&& (mtval == MRET || mtval == SRET || mtval == URET))
return _exception_trap_return(proc);
return _exception_delegate(proc, mcause, mtval);
}
2 changes: 1 addition & 1 deletion kernel/src/interrupt.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <proc.h>
#include <interrupt.h>
#include <proc.h>
#include <sched.h>

proc_t *interrupt_handler(proc_t *proc, uint64_t mcause, uint64_t mtval)
Expand Down
7 changes: 3 additions & 4 deletions kernel/src/trap.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#include <trap.h>

#include <syscall.h>
#include <exception.h>
#include <interrupt.h>
#include <sched.h>
#include <syscall.h>
#include <trap.h>

proc_t *trap_handler(proc_t *proc, uint64_t mcause, uint64_t mtval)
{
if (mcause == 8) {
proc_t *next = syscall_handler(proc);
if (next != proc)
proc_release(proc);
if (next)
if (next)
return next;
return sched();
} else if ((int64_t)mcause < 0) {
Expand Down

0 comments on commit 0842e21

Please sign in to comment.