Screenshot of Sourcecode

Direct Systemcalls to Linux from Rust Code (x86_64)

What I show in this blog post is nothing new or unique, but it is something I wish someone would have shown me in this simplicity in my second or third semester at university. In this post, I briefly explain how you can talk to Linux without the libc or the Rust standard library (which uses libc behind the scenes most probably). Furthermore, I give you pointers to the corresponding syscall code in Read more…

Minimal GRUB Configuration To Boot A Multiboot2 Kernel With Boot Modules

TLDR: for Multiboot2 you use module2 and for Multiboot1 module in GRUB config files. One of my projects of the last months was to build a prototype setup for kernels written in Rust. The kernel is Multiboot2-compliant and boots on x86_64 with UEFI as firmware. To test everything, I create a standalone GRUB in a directory, which contains the kernel (an 64-bit ELF) and a minimal grub.conf. The “standalone GRUB” is a regular Read more…

Adding and Using Files To/From the GRUB Memdisk (GRUB Standalone)

TLDR: GRUB can reference internal files via the volume specifier (memdisk), similar to external drives (hd0). GRUB has an undocumented but really convenient feature to include files/images (e.g., bootable kernels) directly into the GRUB installation itself. If you use $ grub-mkstandalone to store GRUB on a USB stick or a QEMU volume for example, you can bundle GRUB as EFI-application together with a configuration and payload/files. These files can be stored in the Read more…

Rust: Calling Functions With Different Calling Conventions From Same File

The other day I had some fun with assembly and wanted to try to call assembly functions from Rust. Each compiler follows a certain calling convention, that specifies how parameters are passed between functions. The calling convention is part of an ABI, an application binary interface. There are two major calling conventions out there: System V ABI and “Microsoft/PE x64”. The latter has no real official name, at least I can’t find one Read more…

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

Update: Since Rust 1.59, the macros global_asm! and asm! are finally stable! I also updated the blog post a little but it is mostly in the state from back then. In this blog post, I show how you can create assembly files next to Rust files and compile everything by Cargo. What are .S files? Recently I stumbled upon a Rust project, where *.S– and *.rs-files were side by side in the same 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…