From 8aa17b12f29536ea9c8b6ca22c7f153e8d90fa3b Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 10 Apr 2022 15:39:41 +0300 Subject: add clang format and run it --- arch/riscv64/include/csr.h | 69 ++++++++++++++++++++++---------------------- arch/riscv64/include/pages.h | 8 ++--- arch/riscv64/include/sbi.h | 7 +++-- 3 files changed, 42 insertions(+), 42 deletions(-) (limited to 'arch/riscv64/include') diff --git a/arch/riscv64/include/csr.h b/arch/riscv64/include/csr.h index 43c365b..7f9fc1f 100644 --- a/arch/riscv64/include/csr.h +++ b/arch/riscv64/include/csr.h @@ -3,43 +3,42 @@ #include -#define SATP_MODE_Sv32 0x80000000 -#define SATP_MODE_Sv39 0x8000000000000000 -#define SATP_MODE_Sv48 0x9000000000000000 - +#define SATP_MODE_Sv32 0x80000000 +#define SATP_MODE_Sv39 0x8000000000000000 +#define SATP_MODE_Sv48 0x9000000000000000 /* supervisor CSR registers */ -#define CSR_SSTATUS 0x100 -#define CSR_SIE 0x104 -#define CSR_STVEC 0x105 -#define CSR_SCOUNTEREN 0x106 +#define CSR_SSTATUS 0x100 +#define CSR_SIE 0x104 +#define CSR_STVEC 0x105 +#define CSR_SCOUNTEREN 0x106 -#define CSR_SENVCFG 0x10A +#define CSR_SENVCFG 0x10A -#define CSR_SSCRATCH 0x140 -#define CSR_SEPC 0x141 -#define CSR_SCAUSE 0x142 -#define CSR_STVAL 0x143 -#define CSR_SIP 0x144 +#define CSR_SSCRATCH 0x140 +#define CSR_SEPC 0x141 +#define CSR_SCAUSE 0x142 +#define CSR_STVAL 0x143 +#define CSR_SIP 0x144 -#define CSR_SATP 0x180 +#define CSR_SATP 0x180 -#define CSR_SCONTEXT 0x5A8 +#define CSR_SCONTEXT 0x5A8 /* Exception causes */ -#define EXC_INST_MISALIGNED 0 -#define EXC_INST_ACCESS 1 -#define EXC_BREAKPOINT 3 -#define EXC_LOAD_ACCESS 5 -#define EXC_STORE_ACCESS 7 -#define EXC_SYSCALL 8 -#define EXC_INST_PAGE_FAULT 12 -#define EXC_LOAD_PAGE_FAULT 13 -#define EXC_STORE_PAGE_FAULT 15 +#define EXC_INST_MISALIGNED 0 +#define EXC_INST_ACCESS 1 +#define EXC_BREAKPOINT 3 +#define EXC_LOAD_ACCESS 5 +#define EXC_STORE_ACCESS 7 +#define EXC_SYSCALL 8 +#define EXC_INST_PAGE_FAULT 12 +#define EXC_LOAD_PAGE_FAULT 13 +#define EXC_STORE_PAGE_FAULT 15 /* status CSR bits */ -#define SSTATUS_SUM (1 << 18) -#define SSTATUS_SPP (1 << 8) +#define SSTATUS_SUM (1 << 18) +#define SSTATUS_SPP (1 << 8) /* directly lifted from Linux:/arch/riscv/include/asm/asm.h:9-13 */ #if defined(__ASSEMBLY__) @@ -48,16 +47,16 @@ #define __ASM_STR(x) #x #endif -#define csr_read(csr, res)\ - __asm__ volatile ("csrr %0, " __ASM_STR(csr) : "=r" (res) : : "memory") +#define csr_read(csr, res) \ + __asm__ volatile("csrr %0, " __ASM_STR(csr) : "=r"(res) : : "memory") -#define csr_write(csr, val)\ - __asm__ volatile ("csrw " __ASM_STR(csr) ", %0" : : "r" (val) : "memory") +#define csr_write(csr, val) \ + __asm__ volatile("csrw " __ASM_STR(csr) ", %0" : : "r"(val) : "memory") -#define csr_set(csr, val)\ - __asm__ volatile ("csrs " __ASM_STR(csr) ", %0" : : "r" (val) : "memory") +#define csr_set(csr, val) \ + __asm__ volatile("csrs " __ASM_STR(csr) ", %0" : : "r"(val) : "memory") -#define csr_clear(csr, val)\ - __asm__ volatile ("csrc " __ASM_STR(csr) ", %0" : : "r" (val) : "memory") +#define csr_clear(csr, val) \ + __asm__ volatile("csrc " __ASM_STR(csr) ", %0" : : "r"(val) : "memory") #endif /* APOS_CSR_H */ diff --git a/arch/riscv64/include/pages.h b/arch/riscv64/include/pages.h index 643d3b4..20dab3d 100644 --- a/arch/riscv64/include/pages.h +++ b/arch/riscv64/include/pages.h @@ -1,10 +1,10 @@ #ifndef APOS_RISCV_PAGES_H #define APOS_RISCV_PAGES_H -#define MM_KPAGE MM_O0 -#define MM_MPAGE MM_O1 -#define MM_GPAGE MM_O2 -#define MM_TPAGE MM_O3 +#define MM_KPAGE MM_O0 +#define MM_MPAGE MM_O1 +#define MM_GPAGE MM_O2 +#define MM_TPAGE MM_O3 #define MM_KPAGE_SIZE SZ_4K #define MM_MPAGE_SIZE SZ_2M diff --git a/arch/riscv64/include/sbi.h b/arch/riscv64/include/sbi.h index 609849d..e6ceb92 100644 --- a/arch/riscv64/include/sbi.h +++ b/arch/riscv64/include/sbi.h @@ -5,8 +5,9 @@ struct sbiret { long value; }; -struct sbiret sbi_ecall(int ext, int fid, - unsigned long arg0, unsigned long arg1, unsigned long arg2, - unsigned long arg3, unsigned long arg4, unsigned long arg5); +struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0, + unsigned long arg1, unsigned long arg2, + unsigned long arg3, unsigned long arg4, + unsigned long arg5); #endif /* APOS_RISCV_SBI_H */ -- cgit v1.3