9os

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

commit 838c4ecdb969980770a2ecb2d7160d4eaffbb197
parent 47906f9630a8d1f607459765569132c64fa869b9
Author: Dimitris Papastamos <dimitris.papastamos@arm.com>
Date:   Fri, 12 Oct 2018 23:18:18 +0100

[arm64] No need to pass trapframe to main()

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

Diffstat:
March/arm64/Makefile | 5-----
Darch/arm64/cdeps.c | 52----------------------------------------------------
March/arm64/crt-none.s | 11-----------
March/arm64/ram.c | 2+-
March/arm64/rom.c | 14+++++---------
5 files changed, 6 insertions(+), 78 deletions(-)

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile @@ -13,11 +13,6 @@ all: $(TARGET) $(BINDIR)/ramfw.bin: $(BINDIR)/ramfw.tst $(BINDIR)/romfw.bin: $(BINDIR)/romfw.tst -frame.inc crt-none.s: cdeps - ./cdeps | sh - -crt-none.s: frame.inc - ram-crt-none.o rom-crt-none.o: crt-none.s ram-crt-linux.o rom-crt-linux.o: crt-linux.s diff --git a/arch/arm64/cdeps.c b/arch/arm64/cdeps.c @@ -1,52 +0,0 @@ -#include <stddef.h> -#include <stdio.h> - -#include <rcode.h> - -int -main(void) -{ - int siz = sizeof(struct trapframe); - - siz = (siz + 15) & ~15; - printf("printf \"/^FRAMESIZ/ s/=.*/=\t%d/\\nw\\n\" | ed -s crt-none.s\n", siz); - printf("printf \"" - "FR_X0_OFF\t= %u\\nFR_X1_OFF\t= %u\\n" - "FR_X2_OFF\t= %u\\nFR_X3_OFF\t= %u\\n" - "FR_X4_OFF\t= %u\\nFR_X5_OFF\t= %u\\n" - "FR_X6_OFF\t= %u\\nFR_X7_OFF\t= %u\\n" - "FR_X8_OFF\t= %u\\nFR_X9_OFF\t= %u\\n" - "FR_X10_OFF\t= %u\\nFR_X11_OFF\t= %u\\n" - "FR_X12_OFF\t= %u\\nFR_X13_OFF\t= %u\\n" - "FR_X14_OFF\t= %u\\nFR_X15_OFF\t= %u\\n" - "FR_X16_OFF\t= %u\\nFR_X17_OFF\t= %u\\n" - "FR_X18_OFF\t= %u\\nFR_X19_OFF\t= %u\\n" - "FR_X20_OFF\t= %u\\nFR_X21_OFF\t= %u\\n" - "FR_X22_OFF\t= %u\\nFR_X23_OFF\t= %u\\n" - "FR_X24_OFF\t= %u\\nFR_X25_OFF\t= %u\\n" - "FR_X26_OFF\t= %u\\nFR_X27_OFF\t= %u\\n" - "FR_X28_OFF\t= %u\\nFR_X29_OFF\t= %u\\n" - "FR_X30_OFF\t= %u\\nFR_SP_OFF\t= %u\\n" - "FR_ELR_OFF\t= %u\\nFR_SPSR_OFF\t= %u\\n" - "FR_ESR_OFF\t= %u\\nFR_FAR_OFF\t= %u\\n\" > frame.inc\n", - offsetof(struct trapframe, x0), offsetof(struct trapframe, x1), - offsetof(struct trapframe, x2), offsetof(struct trapframe, x3), - offsetof(struct trapframe, x4), offsetof(struct trapframe, x5), - offsetof(struct trapframe, x6), offsetof(struct trapframe, x7), - offsetof(struct trapframe, x8), offsetof(struct trapframe, x9), - offsetof(struct trapframe, x10), offsetof(struct trapframe, x11), - offsetof(struct trapframe, x12), offsetof(struct trapframe, x13), - offsetof(struct trapframe, x14), offsetof(struct trapframe, x15), - offsetof(struct trapframe, x16), offsetof(struct trapframe, x17), - offsetof(struct trapframe, x18), offsetof(struct trapframe, x19), - offsetof(struct trapframe, x20), offsetof(struct trapframe, x21), - offsetof(struct trapframe, x22), offsetof(struct trapframe, x23), - offsetof(struct trapframe, x24), offsetof(struct trapframe, x25), - offsetof(struct trapframe, x26), offsetof(struct trapframe, x27), - offsetof(struct trapframe, x28), offsetof(struct trapframe, x29), - offsetof(struct trapframe, x30), offsetof(struct trapframe, sp), - offsetof(struct trapframe, elr), offsetof(struct trapframe, spsr), - offsetof(struct trapframe, esr), offsetof(struct trapframe, far)); - - return 0; -} diff --git a/arch/arm64/crt-none.s b/arch/arm64/crt-none.s @@ -1,10 +1,7 @@ - .include "frame.inc" - /* TODO: extract data section address from RSCB */ BSS = 0x2E00F000 BSSSIZ = 1024 PAGESIZ = 4096 -FRAMESIZ= 288 .text .globl _start @@ -29,15 +26,7 @@ _start: mov x2,BSSSIZ bl memset - mov x0,#FRAMESIZ - mov x1,sp - sub x1,x1,x0 - mov sp,x1 - mrs x0,rvbar_el3 - str x0,[sp,#FR_X0_OFF] - - mov x0,sp bl main adr x0,outsync b panic diff --git a/arch/arm64/ram.c b/arch/arm64/ram.c @@ -1,6 +1,6 @@ #include <rcode.h> void -main(struct trapframe *fp) +main(void) { } diff --git a/arch/arm64/rom.c b/arch/arm64/rom.c @@ -1,5 +1,3 @@ -#include <string.h> - #include <rcode.h> void @@ -32,16 +30,14 @@ badrmc(Rmucmd *cmd, int error) } void -main(struct trapframe *fp) +main(unsigned long long rvbar_el3) { - unsigned long long rvbar_el3; + struct trapframe frame = { 0 }; /* don't leak info to EL3h */ - rvbar_el3 = fp->x0; - memset(fp, 0, sizeof(*fp)); /* don't leak info to EL3h */ - fp->elr = rvbar_el3; - fp->spsr = 0xf << 6 | 0xd; + frame.elr = rvbar_el3; + frame.spsr = 0xf << 6 | 0xd; - swtch(fp); + swtch(&frame); /* * main is not expected to return. If it happens we will * be out of sync and we will panic