Skip to content

Commit

Permalink
avoid non-standard predefined macros
Browse files Browse the repository at this point in the history
  • Loading branch information
aswaterman committed Dec 7, 2016
1 parent ce70afb commit 9e219c9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion encoding.h
Expand Up @@ -150,7 +150,7 @@

#ifdef __riscv

#ifdef __riscv64
#if __riscv_xlen == 64
# define MSTATUS_SD MSTATUS64_SD
# define SSTATUS_SD SSTATUS64_SD
# define RISCV_PGLEVEL_BITS 9
Expand Down
2 changes: 1 addition & 1 deletion p/riscv_test.h
Expand Up @@ -52,7 +52,7 @@
RVTEST_ENABLE_SUPERVISOR; \
.endm

#ifdef __riscv64
#if __riscv_xlen == 64
# define CHECK_XLEN csrr a0, misa; bltz a0, 1f; RVTEST_PASS; 1:
#else
# define CHECK_XLEN csrr a0, misa; bgez a0, 1f; RVTEST_PASS; 1:
Expand Down
2 changes: 1 addition & 1 deletion v/entry.S
@@ -1,6 +1,6 @@
#include "riscv_test.h"

#ifdef __riscv64
#if __riscv_xlen == 64
# define STORE sd
# define LOAD ld
# define REGBYTES 8
Expand Down
6 changes: 1 addition & 5 deletions v/riscv_test.h
Expand Up @@ -46,11 +46,7 @@ userstart: \
#define PGSHIFT 12
#define PGSIZE (1UL << PGSHIFT)

#ifdef __riscv64
# define SIZEOF_TRAPFRAME_T 288
#else
# define SIZEOF_TRAPFRAME_T 144
#endif
#define SIZEOF_TRAPFRAME_T ((__riscv_xlen / 8) * 36)

#ifndef __ASSEMBLER__

Expand Down
4 changes: 2 additions & 2 deletions v/vm.c
Expand Up @@ -62,7 +62,7 @@ void wtf()
#define l1pt pt[0]
#define user_l2pt pt[1]
#define kernel_l2pt pt[2]
#ifdef __riscv64
#if __riscv_xlen == 64
# define NPT 5
# define user_l3pt pt[3]
# define kernel_l3pt pt[4]
Expand Down Expand Up @@ -204,7 +204,7 @@ void vm_boot(uintptr_t test_addr)
l1pt[PTES_PER_PT-1] = ((pte_t)kernel_l2pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V;
// map user to lowermost megapage
l1pt[0] = ((pte_t)user_l2pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V;
#ifdef __riscv64
#if __riscv_xlen == 64
kernel_l2pt[PTES_PER_PT-1] = ((pte_t)kernel_l3pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V;
user_l2pt[0] = ((pte_t)user_l3pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V;
#endif
Expand Down

0 comments on commit 9e219c9

Please sign in to comment.