Page 1 of 1

bochs, port 0xe9 and instant text printing

Posted: Sun Aug 01, 2004 5:43 pm
by Adek336
Hi!

This seems to be a widely unknown feature of bochs, and I learnt it only recently when seeking sysenter capabilities in the mentioned software. The functionality is called port e9 hack, and can be enabled with ./configure --enable-port-e9-hack.

What is it about? In such a bochs build, any data sent to port 0xe9 by the guest computer will be printed out by bochs in the console. This seems a darn cool debugging aid! Especially when console output fails for reasons or you have more debugging info than a screenful. I checked this on the recent 2.1.1 version, and it looks like a million dollar! All the debugging data, and I can scroll up xterm to see it all! You don't have to send the '\0' character.

Wanted to keep you informed. Tell me if this is helpful or not.

Cheers;)
Adrian

Re:bochs, port 0xe9 and instant text printing

Posted: Mon Aug 02, 2004 2:12 am
by Legend
Now what happens on a real PC if you flood port 0xE9? Perhaps you need seperate debug builds ...

Re:bochs, port 0xe9 and instant text printing

Posted: Mon Aug 02, 2004 3:38 am
by Pype.Clicker
afaik, they took 0xE9 on purpose because there was nothing there ... (0E0-0EF Reserved, according to HelpPC) ...

so on a real computer, these I/O commands will simply go to a kind of hardware /dev/null :P

Re:bochs, port 0xe9 and instant text printing

Posted: Mon Aug 02, 2004 12:18 pm
by bkilgore
Another handy one I've been using is redirecting parallel port output to a file. By adding to your bochsrc.txt

Code: Select all

parport1: enabled=1, file="parout.txt"
You can write to the parallel port and it will be dumped to the text file. Then you dont even need to worry about your console, you can peruse the file at your convenience, or save it if there's something you see wrong so you can look back on it a few days later...

When compiling for bochs i just -D PRINT_TO_PARALLEL

and when printing a character to the screen i also do

Code: Select all

#ifdef PRINT_TO_PARALLEL
outportb(0x37a, 0x04|0x08);
outportb(0x378, (unsigned char)c);
outportb(0x37a, 0x01);
#endif
That way I can enable verbose debugging and then just look over the file.

Re:bochs, port 0xe9 and instant text printing

Posted: Mon Aug 02, 2004 5:27 pm
by Gnome
I use the Bochs port e9 hack in my kernel. I retrofitted the logging subsystem to dump everything to that port (normally it ignores debug and below, unless configured to do otherwise). Rather handy, since I've found that it doesn't update the VGA often enough, and things printed right before a crash aren't shown.

Lately though, I've started using QEMU. It's (much) faster, integrates better with GDB, etc... but, it doesn't have this feature, which is a bummer. I'm not using it so much anymore though. Not since I've moved past the really low-level stuff that crashes the system without the kernel crashing it (i.e, interrupt handling, paging, etc.)