jart / blink

tiniest x86-64-linux emulator
ISC License
7k stars 225 forks source link

Some (remaining) issues in getting "Game of Life" to work under Blinkenlights #53

Closed tkchia closed 1 year ago

tkchia commented 1 year ago

There are some issues in Blinkenlights currently preventing Amey Narkhede's "Game of Life" (https://github.com/glitzflitz/gameoflife) PC booter program from working (blinkenlights -r gameoflife.bin). These issues may need quite a fair amount of work to fully resolve.

Thank you!

tkchia commented 1 year ago

(QEMU allows the program to continue. But it is possible that QEMU is wrong here. We probably need to check what an actual x86-64 CPU does.)

It turns out that QEMU's emulation (see target/i386/tcg/seg_helper.c) is apparently correct, and as far as I can tell, matches the behavior seen on a real CPU (!).

In particular, it is OK to load a zero selector value into %ss in long mode — while in ring 0. In ring 3 though, loading zero into %ss will raise a CPU exception.

Thank you!