commit 5061404358fd6f0e642871691ee59aadfe6867f9
parent 39f1f69637bff2387ad2487f23a258f659d3fd9a
Author: Dimitris Papastamos <dimitris.papastamos@arm.com>
Date: Fri, 12 Oct 2018 16:20:21 +0100
[arm64] Generate offsets for trapframe members
Change-Id: Ie6cf86d82ea3fea302691e26b7270483ec8d58de
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
Diffstat:
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -4,6 +4,7 @@
*.bin
*.elf
*.out
+arch/arm64/frame.inc
bin/
lib/
src/romfw/rmctbl.c
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
@@ -14,7 +14,9 @@ $(BINDIR)/ramfw.bin: $(BINDIR)/ramfw.tst
$(BINDIR)/romfw.bin: $(BINDIR)/romfw.tst
crt-none.s: cdeps
- ./cdeps | ed -s $@
+ ./cdeps | sh
+
+crt-none.s: frame.inc
ram-crt-none.o rom-crt-none.o: macros.s crt-none.s
diff --git a/arch/arm64/cdeps.c b/arch/arm64/cdeps.c
@@ -1,3 +1,4 @@
+#include <stddef.h>
#include <stdio.h>
#include <machine.h>
@@ -8,6 +9,44 @@ main(void)
int siz = sizeof(struct trapframe);
siz = (siz + 15) & ~15;
- printf("/^FRAMESIZ/ s/=.*/=\t%d/\nw\n", siz);
+ 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;
}