See, I started out using bochs (installed using macports). It was fine for my 32-bit kernel, but then I started building a 64 bit kernel... I just would have to specify that it should use a 64-bit processor. So, here we go: "cpuid: x86_64=1". "cpuid directive malformed." Just that. Well, **** you. I googled around for some working combinations (maybe I needed to specify some more settings for 64-bit support). Same error. The source code has if-statements to test for every condition, it just won't tell you which "if" statement decided something was wrong. Because, **** you.
I found out that bochs needed to be compiled using x86_64 support, and it probably wasn't (macports didn't specify the argument), so I tried to add it. "cpuid directive malformed." Just... **** you.
Okay, off with macports. I'll compile it myself. I download it, configure with some flags that look like I need them, make... Aaaand error about some type not being declared (cdrom_base). It recommends cdrom_base_c, so I add a typedef. Waaay more errors, that have nothing to do with the previous one. Great.
Off to google. Apparently there's a script that compiles it, especially for the mac! I run it, aaaand... **** you some more. We'll use a compiler flag that your compiler doesn't know. So, I try switching to gcc (non-cross compiling, installed using macports). More compiler flags that aren't recognised.
Screw bochs, time to give qemu a try.
First, qemu seems to work like a charm. 64-bit code runs fine. Until I place a breakpoint. See, qemu works fine, except in combination with gdb when you switch from protected mode to long mode. It will crash saying some message is too large.
Off to google. Some posts, on this forum as well. Apparently one can revert a commit from the stone ages, except that it won't work just reverting this one. I don't want to reset all the way back to such an old version either. Some comment of Brendan containing a patch he says works, but doesn't (it probably did back then, but after countless of updates, it doesn't seem to anymore). Some patch for gdb which looks like a terrible hack of some random guy on here. It may work, but I'm not sure I want to try it. Nobody commented it worked, anyway.
So, back to bochs. I manage to compile it manually, finally, using the absolutely minimum required flags:
Code: Select all
CFLAGS="-I/opt/X11/include -L/opt/X11/lib" CXXFLAGS="-I/opt/X11/include -L/opt/X11/lib" ./configure --with-prefix=/usr/local --enable-gdb-stub --with-x11 --enable-x86-64
Still, bochs feels like a mess now. It's slow as hell anyway.
Anyways, so: which emulator are you using? Does anyone have a working qemu with gdb when switching from protected mode to long mode? One that isn't terribly old anyway, and how did you do it?