Include Assembly Source Files In Rust Project (and Build with Cargo)

Update 2021-12-21: I included documentation references. Since Rust nightly 1.59 macros global_asm! and asm! are finally stable! Recently I stumbled upon a Rust project, where *.S– and *.rs-files were side by side in the same Cargo source directory and I was like: “What the heck, I always wanted this!” At the time when I created this article, there was no documentation about this, or it was well hidden. If you’ve programmed in C/C++ Read more…

Measuring TTFB (Time to First Byte) for HTTP Requests in Rust

The other day I created a small CLI + library written in Rust, that helps to measure the TTFB (time to first byte) for HTTP GET-Requests in Rust. I had this project on my to-do list for a few months now and finally some time for it. I got inspired by the Dev Tools in Google Chrome. You can see an example screenshot from Chrome down below: I wanted to program something similar. Read more…

How to Find Out if a Binary Runs Inside QEMU

In the previous blog post we talked about how to use QEMUs debugcon feature. To do this responsibly, we should only do this if the binary runs in fact inside QEMU. To find this out, one can use the cpuid instruction. It gives us a lot of information about our environment including information about the CPU brand name or if we run inside a hypervisor. This instruction is specific for the x86-platform. It Read more…

How to Use QEMUs “debugcon”-Feature (and Write Debug Infomation to the Terminal or a File)

QEMU is a VMM often used for low-level OS/kernel development and testing. Especially when you write your own OS/kernel, things can get really hard and difficult to debug. Furthermore, there are not many debug capabilities, as you can’t write to files or print to the screen in early boot phases, thus, without loaded drivers. For these cases, QEMU has a featured called debugcon. It is not as good/prominent documented as it should be, Read more…

Rust: setTimeout and setInterval as in Javascript with “tokio” as Runtime

Even though I’m working with Rust for over 2.5 years now, I unfortunately never made a deep dive into the async/await/future-world. But I started using tokio a few days ago and a few questions came up. Tokio is a runtime for executing futures, great! For this, tokio needs some kind of “tasks” or “lightweight userland threads”, okay. To schedule N tasks across M cores, tokio need some kind of event loop,.. so.. similar Read more…