thasso.xyz

https://thasso.xyz/ (RSS)
visit blog
Fixing C strings
16 Dec 2024 | original ↗

It’s well-known that null-terminated C strings are bug-prone and unsafe to use. They’re the stereotypical footgun. I’ve been tinkering in a bare-metal environment recently, writing all code myself, including the common types and routines you find in libc or similar. In all the code I wrote, there is not at single null-terminated string, and I...

Setting up an x86 CPU in 64-bit mode
13 Jul 2024 | original ↗

People say there are things that are complex and there are things that are just complicated. Complexity is considered interesting, complicatedness is considered harmful. The process of setting up an x86_64 CPU is mostly complicated. I’ll describe one way to go from a boot sector loaded by the BIOS with the CPU in 16-bit real mode to the CPU set...

Between Curious and Frantic
23 Apr 2024 | original ↗

I’ve been upset with my output lately. Just overall. For a few months, I felt I did a good (at least decent) job posting inspired content on this site. I was also learning steadily and making good progress on my programming. But in recent months, less so. I tried to focus on specific projects, but I couldn’t stick to any of them for long. As...

Parsing Expressions by Recursive Descent in Haskell
31 Oct 2023 | original ↗

Parsing numerical expressions by recursive descent is a joy in Haskell! It is incredibly concise and elegant, yet very simple. What we want to parse are binary expressions like 7 + 42 * 9, 2 * 3 / 4 * 5, or 8 * (10 - 6). As always, when parsing such expressions, we have to be aware of the associativity of the operators involved and of their...

C VLAs are cool!
7 Oct 2023 | original ↗
Can you use a class in C?
11 Aug 2023 | original ↗

Recently, I’ve been working on a C debugger. This requires reading and processing the DWARF debugging information that’s part of the binary. Since this is a rather complex task, I figured I might use a library that exports a nice interface to the debugging information. One such library that I found early on was libelfin. It wasn’t perfect from...

↑ These items are from RSS. Visit the blog itself at https://thasso.xyz/ to find everything else and to appreciate author's digital home.