diff options
author | johannst <johannst@users.noreply.github.com> | 2023-02-05 17:35:44 +0000 |
---|---|---|
committer | johannst <johannst@users.noreply.github.com> | 2023-02-05 17:35:44 +0000 |
commit | 3f1d25c3e62f91f2555f0649c7c71f3b730717be (patch) | |
tree | 15222f7154b4bef4404c1bcf1475adcb80a67468 /print.html | |
parent | b590f4ed4db110bb61da35fec288a467d32c9a62 (diff) | |
download | notes-3f1d25c3e62f91f2555f0649c7c71f3b730717be.tar.gz notes-3f1d25c3e62f91f2555f0649c7c71f3b730717be.zip |
deploy: 724d077860e103631605f09a7de35e3ad8796f56
Diffstat (limited to 'print.html')
-rw-r--r-- | print.html | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -2092,6 +2092,34 @@ launched with the <strong>same</strong> parameters.</p> ... </code></pre> <p>Instructions to build a minimal <a href="https://blog.memzero.de/kernel-debugging-qemu"><code>Kernel</code> and <code>initrd</code></a>.</p> +<h2 id="appendix-cheap-instruction-tracer"><a class="header" href="#appendix-cheap-instruction-tracer">Appendix: Cheap instruction tracer</a></h2> +<pre><code class="language-make">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 +</code></pre> +<pre><code class="language-x86asm">.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 +</code></pre> <h2 id="references"><a class="header" href="#references">References</a></h2> <ul> <li><a href="https://github.com/qemu/qemu/blob/master/docs/usb2.txt">QEMU USB</a></li> |