9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 2df6457e92b43886f7d4dd370d5ac5512fc99425
parent c3938efaed94cbf4c42fe54478f54d4baba2c7b0
Author: Dimitris Papastamos <dimitris.papastamos@arm.com>
Date:   Mon, 15 Oct 2018 13:19:28 +0100

[amd64] Reorganize a bit the port

Each test has to provide its own environment and implementation of
common functions like swtch().  This is to allow mocking the behaviour
of those functions for the purposes of testing them.

Change-Id: Ia72022865ce57ebf0acdd11c83a771bec363643a
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>

Diffstat:
March/amd64/Makefile | 4++--
Aarch/amd64/arch.c | 15+++++++++++++++
Darch/amd64/arch.s | 15---------------
Darch/amd64/panic.c | 9---------
Mtest/test1/Makefile | 6+-----
Mtest/test1/test.c | 13+++++++++++++
6 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/arch/amd64/Makefile b/arch/amd64/Makefile @@ -1,8 +1,8 @@ PROJECTDIR = ../.. include $(PROJECTDIR)/scripts/rules.mk -ROMOBJS = crt-$(SYS).o panic.o arch.o rom.o $(SRCDIR)/romfw/builtin.o -RAMOBJS = crt-$(SYS).o panic.o arch.o rom.o $(SRCDIR)/ramfw/builtin.o +ROMOBJS = crt-$(SYS).o arch.o rom.o $(SRCDIR)/romfw/builtin.o +RAMOBJS = crt-$(SYS).o arch.o rom.o $(SRCDIR)/ramfw/builtin.o TARGET = $(BINDIR)/romfw.elf $(BINDIR)/ramfw.elf LIBS = -lhdl -lrmu -lc diff --git a/arch/amd64/arch.c b/arch/amd64/arch.c @@ -0,0 +1,15 @@ +#include <rcode.h> + +void +panic(const char *msg) +{ + printk("panic: %s\n", msg); + for (;;) + ; +} + +void +swtch(struct trapframe *fp) +{ + panic("swtch() not implemented"); +} diff --git a/arch/amd64/arch.s b/arch/amd64/arch.s @@ -1,15 +0,0 @@ - .file "arch.s" - - .text - .globl swtch,panic - -panic: - jmp cpanic - -swtch: - mov $msg,%rdi - call panic - - .section .rodata -msg: - .asciz "swtch not implemented for amd64" diff --git a/arch/amd64/panic.c b/arch/amd64/panic.c @@ -1,9 +0,0 @@ -#include <rcode.h> - -void -cpanic(const char *msg) -{ - printk("panic: %s\n", msg); - for (;;) - ; -} diff --git a/test/test1/Makefile b/test/test1/Makefile @@ -45,11 +45,7 @@ LIBOBJ = hdl_RMU_Crypto_Random.o \ hdl_RMU_System_InterfaceVersion.o \ hdl_RMU_System_Status.o \ -OBJS = $(ARCHDIR)/crt-$(SYS).o \ - $(ARCHDIR)/arch.o \ - $(ARCHDIR)/panic.o \ - $(SRCDIR)/romfw/builtin.o \ - test.o +OBJS = $(ARCHDIR)/crt-$(SYS).o $(SRCDIR)/romfw/builtin.o test.o LIBS = -lhdl -lc LIBDEP = libhdl.a $(LIBDIR)/libc.a diff --git a/test/test1/test.c b/test/test1/test.c @@ -22,3 +22,16 @@ main(int argc, char *argv[]) } return 0; } + +void +panic(const char *msg) +{ + printk("panic: %s\n", msg); + abort(); +} + +void +swtch(struct trapframe *fp) +{ + panic("swtch() not implemented"); +}