diff options
Diffstat (limited to 'env/pm')
-rw-r--r-- | env/pm/link.ld | 44 | ||||
-rw-r--r-- | env/pm/riscv_test.h | 75 |
2 files changed, 119 insertions, 0 deletions
diff --git a/env/pm/link.ld b/env/pm/link.ld new file mode 100644 index 0000000..6b19389 --- /dev/null +++ b/env/pm/link.ld @@ -0,0 +1,44 @@ +/*======================================================================*/ +/* Proxy kernel linker script */ +/*======================================================================*/ +/* This is the linker script used when building the proxy kernel. */ + +/*----------------------------------------------------------------------*/ +/* Setup */ +/*----------------------------------------------------------------------*/ + +/* The OUTPUT_ARCH command specifies the machine architecture where the + argument is one of the names used in the BFD library. More + specifically one of the entires in bfd/cpu-mips.c */ + +OUTPUT_ARCH( "riscv" ) + +/* The ENTRY command specifies the entry point (ie. first instruction + to execute). The symbol _start should be defined in each test. */ + +ENTRY( _start ) + +/*----------------------------------------------------------------------*/ +/* Sections */ +/*----------------------------------------------------------------------*/ + +SECTIONS +{ + + /* text: test code section */ + . = 0x00002000; + .text : + { + *(.text) + } + + /* data: Initialized data segment */ + .data : + { + *(.data) + } + + /* End of uninitalized data segement */ + _end = .; +} + diff --git a/env/pm/riscv_test.h b/env/pm/riscv_test.h new file mode 100644 index 0000000..102e6e0 --- /dev/null +++ b/env/pm/riscv_test.h @@ -0,0 +1,75 @@ +#ifndef _ENV_PHYSICAL_MULTI_CORE_H +#define _ENV_PHYSICAL_MULTI_CORE_H + +//----------------------------------------------------------------------- +// Begin Macro +//----------------------------------------------------------------------- + +#define RVTEST_RV64U \ + +#define RVTEST_RV64S \ + +#define RVTEST_FP_ENABLE \ + setpcr cr0, 2; \ + mfpcr a0, cr0; \ + and a0, a0, 2; \ + beqz a0, 1f; \ + mtfsr x0; \ +1: + +#define RVTEST_PASS_NOFP \ + RVTEST_FP_ENABLE \ + bnez a0, 2f; \ + RVTEST_PASS \ +2: \ + +#define RVTEST_VEC_ENABLE \ + mfpcr a0, cr0; \ + ori a0, a0, 4; \ + mtpcr a0, cr0; \ + li a0, 0xff; \ + mtpcr a0, cr18; \ + +#define RVTEST_CODE_BEGIN \ + .text; \ + .align 4; \ + .global _start; \ +_start: \ + RVTEST_FP_ENABLE \ + RVTEST_VEC_ENABLE \ + +//----------------------------------------------------------------------- +// End Macro +//----------------------------------------------------------------------- + +#define RVTEST_CODE_END \ + +//----------------------------------------------------------------------- +// Pass/Fail Macro +//----------------------------------------------------------------------- + +#define RVTEST_FAIL \ + fence; \ + beqz x28, 1f; \ + sll x28, x28, 1; \ + or x28, x28, 1; \ + mtpcr x28, cr30; \ +1: b 1b; \ + +#define RVTEST_PASS \ + fence; \ + li x1, 1; \ + mtpcr x1, cr30; \ +1: b 1b; \ + +//----------------------------------------------------------------------- +// Data Section Macro +//----------------------------------------------------------------------- + +#define RVTEST_DATA_BEGIN +#define RVTEST_DATA_END + +//#define RVTEST_DATA_BEGIN .align 4; .global begin_signature; begin_signature: +//#define RVTEST_DATA_END .align 4; .global end_signature; end_signature: + +#endif |