xs,am: add xsextra as supplementary test API specified for xs test suit

* Thus, no need to implement APIs in xsextra for nemu,qemu,native,etc.
This commit is contained in:
wangkaifan 2022-04-20 09:21:31 +08:00
parent 70a1488d43
commit e3e3f4d37f
5 changed files with 58 additions and 2 deletions

View File

@ -15,10 +15,10 @@ AM_SRCS := noop/isa/riscv/trm.c \
nemu/common/video.c \
dummy/audio.c \
noop/isa/riscv/instr.c \
dummy/mpe.c \
xs/isa/riscv/mpe.c \
nemu/isa/riscv/boot/start.S
CFLAGS += -I$(AM_HOME)/am/src/nemu/include -DISA_H=\"riscv.h\"
CFLAGS += -I$(AM_HOME)/am/src/nemu/include -I$(AM_HOME)/am/src/xs/include -DISA_H=\"riscv.h\"
ASFLAGS += -DMAINARGS=\"$(mainargs)\"
.PHONY: $(AM_HOME)/am/src/nemu/common/mainargs.S

11
am/src/xs/include/xs.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef __XIANGSHAN_H__
#define __XIANGSHAN_H__
#include <am.h>
#include <xsextra.h>
#include <klib-macros.h>
#include ISA_H // "x86.h", "mips32.h", ...
#endif

21
am/src/xs/isa/riscv/mpe.c Normal file
View File

@ -0,0 +1,21 @@
#include <xs.h>
int _mpe_init(void (*entry)()) {
return 1;
}
int _ncpu() {
return 1;
}
int _cpu() {
return 0;
}
intptr_t _atomic_xchg(volatile intptr_t *addr, intptr_t newval) {
return 0;
}
intptr_t _atomic_add(volatile intptr_t *addr, intptr_t adder) {
return 0;
}

23
am/xsextra.h Normal file
View File

@ -0,0 +1,23 @@
/*
* Supplementary driver APIs for XiangShan test suit
*/
#ifndef __XSEXTRA_H__
#define __XSEXTRA_H__
#include <stdint.h>
#include <stddef.h>
#include ARCH_H // "arch/x86-qemu.h", "arch/native.h", ...
#ifdef __cplusplus
extern "C" {
#endif
// ================= Supplement MPE =================
intptr_t _atomic_add(volatile intptr_t *addr, intptr_t adder);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -2,6 +2,7 @@
#define __AMUNIT_H__
#include <am.h>
#include <xsextra.h>
#include <klib.h>
#include <klib-macros.h>