Skip to content

Commit

Permalink
style: Fix __riscv consistency with other ISAs
Browse files Browse the repository at this point in the history
The defines for the majority of other instruction set architectures are
of the form `__isa-name__` while RISC-V was `__isa-name`.  This makes
the relevant changes to keep the definition structure consistent.
  • Loading branch information
brianredbeard committed Feb 23, 2024
1 parent db2cd48 commit 144f786
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static inline uint64_t read_counter(void)
__asm__ __volatile__ ("mrs %0, pmccntr_el0" : "=r" (val));
#elif defined(__arm__)
__asm__ __volatile__ ("mrc p15, 0, %0, c9, c13, 0" : "=r" (val));
#elif defined(__riscv) && __riscv_xlen == 64
#elif defined(__riscv__) && __riscv_xlen == 64
__asm__ __volatile__ ("csrr %0, 0xc01" : "=r" (val) : : "memory");
#else
#error unsupported arch
Expand Down
2 changes: 1 addition & 1 deletion include/system/stdarg.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ typedef __builtin_va_list __builtin_sysv_va_list;
#endif

#if defined(__aarch64__) || defined(__arm__) || defined(__i386__) || \
defined(__i486__) || defined(__i686__) || defined(__COVERITY__) || defined(__riscv)
defined(__i486__) || defined(__i686__) || defined(__COVERITY__) || defined(__riscv__)

typedef __builtin_va_list ms_va_list;
typedef __builtin_va_list __builtin_ms_va_list;
Expand Down
6 changes: 3 additions & 3 deletions pe-relocate.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ allow_64_bit(void)
if (in_protocol)
return 1;
return 0;
#elif defined (__riscv) && __riscv_xlen == 64
#elif defined (__riscv__) && __riscv_xlen == 64
return 1;
#else /* assuming everything else is 32-bit... */
return 0;
Expand All @@ -302,7 +302,7 @@ allow_32_bit(void)
return 1;
#elif defined(__aarch64__)
return 0;
#elif defined (__riscv) && __riscv_xlen == 64
#elif defined (__riscv__) && __riscv_xlen == 64
return 0;
#else /* assuming everything else is 32-bit... */
return 1;
Expand Down Expand Up @@ -330,7 +330,7 @@ static const UINT16 machine_type =
IMAGE_FILE_MACHINE_I386;
#elif defined(__ia64__)
IMAGE_FILE_MACHINE_IA64;
#elif defined(__riscv) && __riscv_xlen == 64
#elif defined(__riscv__) && __riscv_xlen == 64
IMAGE_FILE_MACHINE_RISCV64;
#else
#error this architecture is not supported by shim
Expand Down
2 changes: 1 addition & 1 deletion shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
#endif
#endif

#if defined(__riscv) && __riscv_xlen == 64
#if defined(__riscv__) && __riscv_xlen == 64
#ifndef DEFAULT_LOADER
#define DEFAULT_LOADER L"\\grubriscv64.efi"
#endif
Expand Down

0 comments on commit 144f786

Please sign in to comment.