Page 1 of 1
Logging disk access in Bochs
Posted: Fri Mar 25, 2011 6:09 am
by madanra
I would like to log what is read from disk by an OS running in Bochs; is this possible? I tried logging 'HD' events, but every IO was logged so there was vastly too much data, when all I'm really wanting is a list of which sectors were read.
Re: Logging disk access in Bochs
Posted: Fri Mar 25, 2011 8:19 am
by turdus
madanra wrote:I would like to log what is read from disk by an OS running in Bochs; is this possible? I tried logging 'HD' events, but every IO was logged so there was vastly too much data, when all I'm really wanting is a list of which sectors were read.
Put a logger into your readsector routine. Read this about how to write to bochs' output:
http://wiki.osdev.org/Bochs#I.2FO_debugger_macros
Re: Logging disk access in Bochs
Posted: Fri Mar 25, 2011 8:39 am
by Combuster
Did both of you tried running "man grep"? Why introduce new code when you already have something that can do it?
Re: Logging disk access in Bochs
Posted: Fri Mar 25, 2011 2:25 pm
by madanra
@turdus:
This isn't actually for my OS, I'm actually running Windows 7 (which does work in Bochs, just), so I can't edit the OS.
@Combuster:
Ah, managed to find the information, using grep to get rid of most of the unimportant data and then find+replace to trim it down a bit more. I hadn't actually realised to begin with that the necessary information was actually in the log file, but it is there, if a little confusing - it says 'sector number', 'cylinder low' and 'cylinder high' despite the fact that it's using 28-bit LBA!
Re: Logging disk access in Bochs
Posted: Mon Mar 28, 2011 1:56 am
by Solar
madanra wrote:...and then find+replace to trim it down a bit more...
I hope that by "find + replace" you mean that you wrote...
Code: Select all
grep <searchstring> $1 | sed "s/<find>/<replace>/g"
...into a script somewhere.
Re: Logging disk access in Bochs
Posted: Mon Mar 28, 2011 2:20 am
by turdus
Combuster wrote:Did both of you tried running "man grep"? Why introduce new code when you already have something that can do it?
Well, my bochs cannot log as much as I want, and it's not configurable (only at runtime, which is quite annoying). And I usually trust code only if it was written by me
Yes, you can call me paranoid
That's why I suggested an ultimate solution, but I didn't know it's not his/her own OS.
Re: Logging disk access in Bochs
Posted: Mon Mar 28, 2011 3:02 am
by madanra
Solar wrote:madanra wrote:...and then find+replace to trim it down a bit more...
I hope that by "find + replace" you mean that you wrote...
Code: Select all
grep <searchstring> $1 | sed "s/<find>/<replace>/g"
...into a script somewhere.
Sorry, no
I'm a Windows guy, I get confused without a GUI
Re: Logging disk access in Bochs
Posted: Mon Mar 28, 2011 3:18 am
by Solar
That's a problem that should be addressed. You may love or loathe the Unix shell, but it is a powerful and useful tool for any developer.
Actually, I consider a Windows without Cygwin installed to be crippled.
Re: Logging disk access in Bochs
Posted: Mon Mar 28, 2011 3:50 am
by madanra
Ooh, this forum has weird smilies, I used :P which normally would have shown I was (slightly) joking, but it replaced it with more of a :D smilie...
I do have Cygwin, and would probably switch to Linux if it wasn't for the lack of decent parental controls, which is an instant dealbreaker.
Re: Logging disk access in Bochs
Posted: Mon Mar 28, 2011 5:25 am
by Solar
Re: Logging disk access in Bochs
Posted: Mon Mar 28, 2011 6:21 am
by madanra
I know there are options, but when I last tried actually using any of them, nothing was really up to standard. That was ~8 months ago though, the situation may have improved by now. I may well have a look again when I have the time.