aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/qemu-src
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2023-02-05 17:35:44 +0000
committerjohannst <johannst@users.noreply.github.com>2023-02-05 17:35:44 +0000
commit3f1d25c3e62f91f2555f0649c7c71f3b730717be (patch)
tree15222f7154b4bef4404c1bcf1475adcb80a67468 /tools/qemu-src
parentb590f4ed4db110bb61da35fec288a467d32c9a62 (diff)
downloadnotes-3f1d25c3e62f91f2555f0649c7c71f3b730717be.tar.gz
notes-3f1d25c3e62f91f2555f0649c7c71f3b730717be.zip
deploy: 724d077860e103631605f09a7de35e3ad8796f56
Diffstat (limited to 'tools/qemu-src')
-rw-r--r--tools/qemu-src/Makefile9
-rw-r--r--tools/qemu-src/test.s16
2 files changed, 25 insertions, 0 deletions
diff --git a/tools/qemu-src/Makefile b/tools/qemu-src/Makefile
new file mode 100644
index 0000000..1d21811
--- /dev/null
+++ b/tools/qemu-src/Makefile
@@ -0,0 +1,9 @@
+test: test.s
+ as -o test.o test.s
+ ld -o test test.o testc.o
+
+trace: test
+ qemu-x86_64 -singlestep -d nochain,cpu ./test 2>&1 | awk '/RIP/ { print $$1; }'
+
+clean:
+ $(RM) test test-bin test.o
diff --git a/tools/qemu-src/test.s b/tools/qemu-src/test.s
new file mode 100644
index 0000000..562b2ec
--- /dev/null
+++ b/tools/qemu-src/test.s
@@ -0,0 +1,16 @@
+.section .text, "ax"
+
+.global _start
+_start:
+ xor %rax, %rax
+ mov $0x8, %rax
+1:
+ cmp $0, %rax
+ je 2f
+ dec %rax
+ jmp 1b
+2:
+ # x86-64 exit(2) syscall
+ mov $0, %rdi
+ mov $60, %rax
+ syscall