From a73857da7f10ca59611122ddd83722bb07b1f090 Mon Sep 17 00:00:00 2001 From: Amelia Coutard Date: Fri, 14 Oct 2022 01:38:56 +0200 Subject: [PATCH] Added the userspace module to the repo It's not made to last, so don't worry about the lack of cleanness. I'll implement elf64 soon-ish. --- test_module/module.mk | 13 +++++++++++++ test_module/test.S | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 test_module/module.mk create mode 100644 test_module/test.S diff --git a/test_module/module.mk b/test_module/module.mk new file mode 100644 index 0000000..032fce7 --- /dev/null +++ b/test_module/module.mk @@ -0,0 +1,13 @@ +# Written in 2022 by Amélia COUTARD +# To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this file to the public domain worldwide. This file is distributed without any warranty. +# You should have received a copy of the CC0 Public Domain Dedication along with this file. If not, see . + +# So, about the license. I don't think I have a copyright on this file's code, but, +# since I gave it the CC0 license in case I do, that doesn't matter either way. + +TO_ISO += isodir/boot/test-module + +isodir/boot/test-module: test_module/test.S + export TMP="$$(mktemp)"; \ + printf "$$($(CXX) $(CXX_ARGS) -c "$<" -o $$TMP && objdump $$TMP -d | grep -A 10000000000 '<\.text>' | tail -n +2 | sed 's/^ *[0-9a-f]*:\t//' | sed 's/\t.*$$//' | tr -d '\n' | sed 's/ */ /g' | sed 's/^/ /' | sed 's/ $$//' | sed 's/ /\\x/g')" > isodir/boot/test-module; \ + rm "$$TMP" diff --git a/test_module/test.S b/test_module/test.S new file mode 100644 index 0000000..75d1b73 --- /dev/null +++ b/test_module/test.S @@ -0,0 +1,12 @@ + .section .text + mov $65, %rdi + syscall + mov $67, %rdi + syscall + mov $68, %rdi + syscall + mov $67, %rdi + syscall + mov $10, %rdi + syscall +1: jmp 1b -- 2.47.0