Commit Diff


commit - d3dcf18f6e08015f5678bbe9866e6417fa8b4789
commit + cd0438ce5c0e5285e02b003de77438a71492de5d
blob - 910b207a5c86bc89611cebafb24cf0fa056f2e3d
blob + b3effc2e5b9380ab02b840e3cbe2539fea1f0fb8
--- .gitignore
+++ .gitignore
@@ -1,6 +1,7 @@
 examples/*.elf
 src/syscalls.h
 src/signal-bootstrap-code.h
+src/data.[ch]
 src/*.o
 tools/bin
 tools/build
blob - 2f0240d26bbf0ac729b0e65831b7205fe3eb7858
blob + 4124e1203a82d28f1fc7418e37d6e6d3c628c626
--- Makefile
+++ Makefile
@@ -12,7 +12,7 @@ COPT	= -g -O2
 CFLAGS	= ${CFLAGS_OS} ${COPT} -std=c2x -Wall -Wextra
 LDFLAGS	= ${LDFLAGS_OS} -lpthread
 
-OBJ	= src/linurv.o src/ecall.o src/cpu.o src/exec.o src/signal.o
+OBJ	= src/linurv.o src/ecall.o src/cpu.o src/exec.o src/signal.o src/data.o
 T	= signal
 PROGS	= examples/test.elf	\
 	  examples/echo.elf	\
@@ -37,7 +37,7 @@ distclean: clean
 	(cd tools; ${MAKE} distclean)
 
 clean:
-	rm -f linurv src/*.o examples/*.elf *.core src/syscalls.h src/signal-bootstrap-code.h src/sbc.*
+	rm -f linurv src/*.o examples/*.elf *.core src/syscalls.h src/signal-bootstrap-code.h src/sbc.* src/data.[ch]
 	rm -rf rootfs
 
 install: linurv
@@ -68,3 +68,6 @@ src/signal-bootstrap-code.h: src/signal-bootstrap-code
 
 .S.elf:
 	${CROSS}-gcc -g -o $@ $<
+
+src/data.c src/data.h: src/data.dst
+	(cd src && ../tools/bin/destruct -e little -H data.h -o data.c data.dst)
blob - /dev/null
blob + c2f091bc7b9f67ffb6c76e1b9e89e6b274ba28d1 (mode 644)
--- /dev/null
+++ src/data.dst
@@ -0,0 +1,27 @@
+
+struct elf64_ehdr {
+	ident: [u8; 16],
+	type: u16,
+	machine: u16,
+	version: u32,
+	phoff: u64,
+	shoff: u64,
+	flags: u32,
+	ehsize: u16,
+	phentsize: u16,
+	phnum: u16,
+	shentsize: u16,
+	shnum: u16,
+	shstrndx: u16,
+};
+
+struct elf64_phdr {
+	type: u32,
+	flags: u32,
+	offset: u64,
+	vaddr: u64,
+	paddr: u64,
+	filesz: u64,
+	memsz: u64,
+	aign: u64,
+};