redirecting console output of bochs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
vjain20
Member
Member
Posts: 73
Joined: Wed Apr 04, 2012 9:12 pm

redirecting console output of bochs

Post by vjain20 »

Hi,

I am try to write an OS by following a tutorial. I am using bochs as the emulator.
The OS writes to the screen by writing to vga memory. I need to know if there is a way to
redirect the output in bochs' console to a file. The problem is that bochs terminal doesnt allow scrolling so if there
are many lines of text there is no way to see the all the lines as they just scroll through fast.
What should I do ?
- Thanks
Vaibhav jain
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: redirecting console output of bochs

Post by thepowersgang »

Use the port 0xE9 hack, or use the serial port.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: redirecting console output of bochs

Post by Combuster »

Read the manual on bochsrc
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: redirecting console output of bochs

Post by bubach »

add line "log: bochsout.txt" in the bochsrc config-file.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
vjain20
Member
Member
Posts: 73
Joined: Wed Apr 04, 2012 9:12 pm

Re: redirecting console output of bochs

Post by vjain20 »

bubach wrote:add line "log: bochsout.txt" in the bochsrc config-file.
I am not asking about the ouput of bochs itself. Logging is already enabled.I am asking about
the text that is written by the kernel to the terminal.

- Thanks
- Thanks
Vaibhav jain
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: redirecting console output of bochs

Post by Combuster »

I just tried the obvious solution of redirecting standard output and it just worked...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
vjain20
Member
Member
Posts: 73
Joined: Wed Apr 04, 2012 9:12 pm

Re: redirecting console output of bochs

Post by vjain20 »

Combuster wrote:I just tried the obvious solution of redirecting standard output and it just worked...
Are you referring to parallel port or port 0xE9 hack ?
- Thanks
Vaibhav jain
linguofreak
Member
Member
Posts: 510
Joined: Wed Mar 09, 2011 3:55 am

Re: redirecting console output of bochs

Post by linguofreak »

vjain20 wrote:
bubach wrote:add line "log: bochsout.txt" in the bochsrc config-file.
I am not asking about the ouput of bochs itself. Logging is already enabled.I am asking about
the text that is written by the kernel to the terminal.

- Thanks
By "to the terminal" you mean "to the (emulated) screen in text mode" right?

There's no way to do that, AFAIK, but you *can* have the routine that prints to the screen also output each character that it prints to the serial port (for general portability), or to port 0xE9, for convenience with Bochs. If you have the port E9 feature turned on in bochsrc, I believe every character output through port E9 will appear in your log file, assuming you have logging enabled (it will certainly appear on the terminal you're running Bochs in).
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: redirecting console output of bochs

Post by xenos »

linguofreak wrote:I believe every character output through port E9 will appear in your log file, assuming you have logging enabled (it will certainly appear on the terminal you're running Bochs in).
Actually it's not in the log file, but only on the terminal (stdout). But of course you can redirect the terminal output to some file.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
kerravon
Member
Member
Posts: 278
Joined: Fri Nov 17, 2006 5:26 am

Re: redirecting console output of bochs

Post by kerravon »

XenOS wrote:
linguofreak wrote:I believe every character output through port E9 will appear in your log file, assuming you have logging enabled (it will certainly appear on the terminal you're running Bochs in).
Actually it's not in the log file, but only on the terminal (stdout). But of course you can redirect the terminal output to some file.
For anyone stumbling across this thread as I did, to capture the port E9 output, what you need to do is run bochs, as in bochs >xxx.txt, and all the port E9 output will appear in xxx.txt. I originally misunderstood this thread. I thought it was talking about redirecting the output of applications running under your OS, which wasn't very helpful.
dseller
Member
Member
Posts: 84
Joined: Thu Jul 03, 2014 5:18 am
Location: The Netherlands
Contact:

Re: redirecting console output of bochs

Post by dseller »

Dude. This thread is 6 years old.
Post Reply