From 3f1d25c3e62f91f2555f0649c7c71f3b730717be Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 5 Feb 2023 17:35:44 +0000 Subject: deploy: 724d077860e103631605f09a7de35e3ad8796f56 --- print.html | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'print.html') diff --git a/print.html b/print.html index f4bc094..4383404 100644 --- a/print.html +++ b/print.html @@ -2092,6 +2092,34 @@ launched with the same parameters.

...

Instructions to build a minimal Kernel and initrd.

+

Appendix: Cheap instruction tracer

+
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
+
+
.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
+

References