Aug 19, 2019
Updated Mu's fork of the Linux kernel again. Today I deleted the entire top-level sound/ directory and a whole bunch of unused file systems.

LoC down from 6.1M to 4.4M.

Context: https://github.com/akkartik/mu#readme

permalink

* *
Aug 14, 2019
Stack manipulations in SubX

I've been noodling on a Forth-inspired (but likely insane) syntactic sugar for stack manipulations in raw machine code. Behold:

{ 0 0 ->%ecx
...
}

This expands to:

push 0/imm32
push 0/imm32
copy %esp to %ecx
...
add 8 to %esp

Basically you get a (fairly unsafe) block scope containing an 8-byte local in %ecx.

To temporarily spill a register:

{ %ecx
...
}

Function call:

{ z y x
call f/disp32
}

The `}` turns into code to undo pushes in the `{` line.

permalink

* *
Aug 11, 2019
Now that I'm packaging Mu with a fork of bleeding-edge Linux, I have a tiger by the tail. I need to stay abreast of changes from upstream or risk bitrot, particularly as new security vulnerabilities are uncovered and patched.

I'm going to start changing the kernel soon, and I need a way to not kill myself merging patches from upstream. For starters: aggressively delete code Mu doesn't need. That'll reduce merge conflicts.

In the first run I just deleted non-x86 architectures. So far so good.

permalink

* *
Aug 10, 2019
Turn a set of .subx files into a bootable disk image.

$ git clone https://github.com/akkartik/mu
$ cd mu
# package up a "hello world" binary and Linux kernel into mu.iso
$ ./gen_iso examples/ex6.subx
# try it out
$ qemu-system-x86_64 -m 256M -cdrom mu.iso -boot d

https://github.com/akkartik/mu#readme

The process is still fairly klunky, and I've added several large dependencies. But now that I have something working I can start polishing it.

Credit: http://minimal.linux-bg.org/

One aspect that seems more broadly useful than just my own Assembly language project: how to deploy bootable disk images on Linode.

permalink

* *
Aug 8, 2019
Cloud VPS from "scratch"

I just successfully built a minimal Linux kernel, installed a SubX binary as init -- and ran the whole thing on a Linode.

Linode console showing "Hello world" followed by a Kernel panic.

It's not in https://github.com/akkartik/mu yet, but there will soon be step-by-step instructions.

This couldn't have happened without the education I received from http://minimal.linux-bg.org

permalink

* *
Aug 1, 2019
Table literals in my Assembly language

https://github.com/akkartik/mu/blob/37c859058/apps/desugar.subx#L440

permalink

* *
Jul 29, 2019
Question for Unix experts: why do we need open()?

I've spent some time in the past staring at the abyss that is http://pubs.opengroup.org/onlinepubs/009695399/functions/open.html, and much of its complexity seems needed only for Things That Are Not Files.

At the syscall level it's pretty ugly that sockets are not files. Alternative client-side syscalls that unify file system and network:

  • PUT
  • GET
  • POST
  • DELETE

Just have them take a resource name and maybe a Go channel for synchronizing. What am I missing?!

permalink

* *
Jul 24, 2019
My new Assembly syntax

SubX can now build itself! 9kLoC in 1.5s. Caveats:

  1. Zero error checking. You still need the C++ translator for development (just like a text editor and other tools).
  2. Some programs compile with the C++ translator but not the self-hosted one. Ones with no `Entry` labels, no `data` segments, or with uppercase hex will throw errors. However, it's a bug if a program successfully compiles but generates a different binary.

What's next? I have a few ideas.

permalink

* *
Jul 22, 2019
Status update on self-hosting my new Assembly syntax

All example apps now translating correctly, and the result is bit-for-bit identical with the results of the C++ translator.

The last remaining step, the final frontier: SubX-in-SubX in SubX-in-SubX. Translating the self-hosted translator using the self-hosted translator. Still seeing some discrepancies there.

I fixed just one bug since yesterday, but had to cope with a 4.4GB trace for it.

https://github.com/akkartik/mu/blob/70a0776031ff/subx/Readme.md

permalink

* *
Jul 22, 2019
Status update on self-hosting my new Assembly syntax

Standard library is now self-hosted!

apps/factorial is also translating successfully, and the binary is the exact same size as before. However there are diffs to track down.

I'm ignoring emulated mode for now, and am testing ELF binaries natively. 5k lines of input take 26 seconds to translate. The cost: having to slum it with some light debug by print action in the absence of time-travel debugging.

permalink

* *
archive
projects
writings
videos
subscribe
Mastodon
RSS (?)
twtxt (?)
Station (?)