Zero Dereference
128 subscribers
3 photos
3 files
372 links
Interesting links related to systems programming, hacking, and science.

Contact: @richiefreedom
Download Telegram
Selfie is an educational project consisting of a compiler for a subset of C that generates code for a simplified RISC-V instruction set, a small emulator for that architecture, and a tiny hypervisor.

Selfie can compile and execute itself.

There are various extensions for Selfie that include a simple garbage collector and a symbolic executor.

http://selfie.cs.uni-salzburg.at/

#c #riscv #system #programming #lowlevel #compiler #osdev #hv #virt
Stoneknife Forth is a minimal forth translator that can compile itself. This compiler is so simple that it recognizes only one-letter identifiers.

This can be bootstrapped in two steps:

First of all Stoneknife is compiled by itself being interpreted by a slow interpreter written in python.

The second step is compiling with the compiler produced by the previous step. The result is a bootstrapped x86 ELF executable.

https://github.com/kragen/stoneknifeforth

#compiler #lowlevel #system #programming
I have already written about Rui Ueyama and the family of small C compilers: 8cc and 9cc. I also mentioned chibicc, a project that complements Rui's book.

Last time I didn't notice how the author organized the repository of chibicc. Each commit is a single step from zero to a full-featured C11 compiler (without optimizations and proper allocation of registers).

The first commit in the repository only involves a simple compiler that reads a number and generates a program that can return this number on completion. The last commit includes all the source code of the compiler that can build real projects like Git, SQLite and libpng!

https://github.com/rui314/chibicc

#c #compiler #lowlevel #system #programming
Ultibo is a bare metal environment to run FreePascal applications on any available RaspberryPi board. It provides APIs for networking, USB access, preemptive threading on multiple CPUs, filesystem access, exception handling, hardware accelerated OpenGL ES graphics, etc. All of the features are available without any operating system!

https://ultibo.org/wiki/Main_Page

#osdev #pascal #rpi #system #programming
You may remember I said that I was working on a small book about virtualization. A lot has changed since then, I had more work to do, and I quit working on the book.

A friend of mine recently shared with me a link to a series of articles on Qemu internals posted by Airbus. I hope you find these materials interesting.

https://airbus-seclab.github.io/qemu_blog/

#virt #qemu #system #programming
An article on an ahead of time binary translator that translates NES ROMs to native x86_64 executables.

https://andrewkelley.me/post/jamulator.html

#nes #plt #virt #system #programming #llvm
Cowgol is a simple programming language inspired by Ada. The language has been greatly simplified to enable easy but effective compilation for small platforms like Zilog Z80, Intel 8080, MOS 6502, Motorola 68K, and others.

The Cowgol compiler is bootstrapped and written in Cowgol itself. It uses a simple table-driven code generator but performs several optimizations. The code of the compiler is very accurate and pleasant to read.

https://github.com/davidgiven/cowgol

#plt #compiler #system #programming
This is a totally crazy thing! You definitely know Windows Subsystem for Linux. This project implements a kind of DOS Subsystem for Linux. You can run a Linux session from your DOS command shell and then exit back to DOS. The implementation details are very interesting!

https://github.com/haileys/doslinux

#lowlevel #dos #assembly #system #programming #linux
Any sufficiently advanced technology is indistinguishable from magic.

We use the terminal all the time rarely wondering how it works. How does a command shell interact with a terminal emulator in a graphical environment? How can libraries like ncurses render pseudographic windows and controls?

Aram Drevekenin has created a wonderful interactive article where he explains how the various components of the system interact with each other to create such a familiar console experience.

Anatomy of a Terminal Emulator

#unix #terminal #programming #linux
Do you remember toys from your childhood?

I have vivid memories of just a few of them. One of them is an eight-bit video game console, a pirate clone of the Nintendo Entertainment System (NES), which was sold in Russia under the Dendy brand. I spent a lot of time playing the immortal games for this platform.

Later, when I started working as a system programmer I became interested in how one of the best toys of my childhood was arranged. Information had to be collected bit by bit. Then I marveled at the engineering genius of the NES developers.

Fortunately, today there is more information about the NES hardware and games for it. For example, here is a good illustrated book (still unfinished) about the NES internals and how to develop games for it in assembly language.

Famicom Party. Making NES Games in Assembly

#nes #programming #gamedev #retro #assembly #lowlevel
I've always been attracted to minimalistic programming languages. Among them were Scheme, TCL, Rebol, Smalltalk and of course Forth. I didn’t write big programs on these languages, but each of them taught me something. Unfortunately, many of them have remained niche and are not widely used in business. Well, okay, the main thing is that programming in these languages makes us a little happier, right? Today I propose to take a look at a modern programming language that develops ideas of Forth.

Retro is a minimalistic modern Forth-like language with a miniature virtual machine implemented in a variety of programming languages. Despite its minimalism, it remains a pragmatic language that allows you to solve real problems.

Just in case, let me remind that I have already written about other Forth-like modern languages, for example, about Factor (1, 2).

#forth #minimalism #plt #programming #retro
Brutal is a fast-growing hobbyist microkernel operating system project.

The design resembles third-generation microkernels: all resources in the system are represented in a generalized form by objects. Access to objects is possible through locally unique handles, which can be transferred between tasks via IPC.

The project has gone through three major milestones. The authors have already implemented their UEFI bootloader, SMP-compatible microkernel, interface description language, PCIe and ACPI services, and interrupt routing to userspace.

Next in line is work on a block layer, a network stack, and own compiler for a C-like programming language.

Apparently, the same community is working on the Brutal project as on SkiftOS.

#osdev #system #programming #lowlevel #microkernel
Stumbled upon a site with an introduction to basic computer science concepts.

The presentation is superficial, but it covers most of the topics that a modern programmer needs to look at.

The author starts with the basic architecture of a computer: the representation of numbers, the concepts of processor and instructions, a description of a typical pipeline, the hierarchy of memory, caches, and buses. There are also chapters about cache coherence, memory paging, and DMA.

Using Unix as example the author explains concepts such as multitasking, system calls, kernel privileged mode, processes, and virtual memory. He also pays attention to ELF object files and dynamic linking.

Of course, after reading these materials, a person will not automatically become a systems programmer but will have a good high-level understanding of how modern hardware and system software work.

You can download the offline PDF version.

#book #cs #system #programming #hardware #osdev #lowlevel
It seems to me that for most problems one can find not only a complex highly optimized solution but also a simpler solution that gives a fairly good result.

Dominic Szablewski, for example, came up with a lossless image compression format that in most cases shows a compression ratio comparable to PNG. The format is called QOI (Quite OK Image Format). The peculiarity of the format is the linear complexity of the compression algorithm and its incredibly simple design. According to published data, QOI can provide image compression up to 20x faster than most PNG implementations. The decompression speed can be just 4x faster. These results are impressive!

The author made a series of measurements on a set of various images.

The source code for the project is available on GitHub.

#programming #minimalism
Yes, I know that I have already written about ToaruOS, and many of the readers have already heard about this operating system. But it's worth mentioning it because a lot has changed since that time.

Once upon a time, the author of this OS had an alternative branch where he tried to get rid of all external dependencies by rewriting the missing libraries on his own. This branch was called toaru-nih. Surprisingly, Klange finished getting rid of the foreign code and merged toaru-nih into the main branch of the project.

Now, this Unix-like operating system provides a fast GUI based on a compositing window manager Yutani, a package manager, a set of standard applications, and even its Python-like programming language called Kuroko.

Surprisingly, all of this work is done by one person!

#osdev #lowlevel #system #programming
IOCCC (The International Obfuscated C Code Contest) is a well-known annual event for system programmers who know how to make any C code unreadable.

You may know some winners of the contest and their programs. For example, Fabrice Bellard and his otcc which later became the Tiny C Compiler (tcc).

But today I would like to recall an entry submitted by Gavin Barraclough, a multitasking operating system equipped with a window manager, a terminal emulator, and a text editor. All the code was a single 3.5 Kb file written in obfuscated C!

One guy from Russia deobfuscated this OS and fixed some bugs. Now we can compare the original and deobfuscated versions.

#osdev #lowlevel #system #programming
Alexander Zolotov (Night Radio) released his song as a simple C program with a single dependency on libSDL2. All synthesizers and sound effects are implemented directly in the program.

Alexander is known for his SunVox and other good programs focused on composing music and computer graphics.

#dsp #synth #c #programming