paging

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
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

paging

Post by lukem95 »

i implemented paging using JamesM's tutorials, and it seems to work fine except for the page_fault handler... but we wont go into that, ill get it working, or create another thread once iv had a decent shot at it anyway.

but my problem is that it runs fine on bochs and qemu, but when i run it on ms virtual pc, it dies giving a "fatal processor error" in a messagebox.

has anybody else experienced this and knows a solution?

lukem95!
~ Lukem95 [ Cake ]
Release: 0.08b
Image
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Re: paging

Post by t0xic »

lukem_95 wrote:i run it on ms virtual pc
^^ Theres your problem... MS virtual PC is made to run windows, dos, and os/2 iirc

--Michael
User avatar
liquid.silver
Member
Member
Posts: 46
Joined: Sat Jun 30, 2007 12:07 pm
Location: South Africa
Contact:

Post by liquid.silver »

Does it run on a real pc? That's the real test.

Btw: your thread title is a little misleading.
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Post by Ready4Dis »

I haven't read the tutorial, but last time I booted my OS on a real PC it worked great, and it uses paging. Any chance we could take a look at the functions in question, it's hard to really debug without looking at anything, just saying: "Hey, my program crashes, does anybody know why" won't receive to many useful answer (I know you were a little more specific saying you were implementing paging from JamesM's). One thing that pops to mind, is make sure you invalidage the pages as you are setting them up.
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

oh god sorry, my original post actually sucked =\ (it was 1am ish when i made it)...

ok well i wasn't really asking for help on the paging thing, as it seems to be working fine. I'll try it on actual hardware and edit this post with the results. Thankyou all for your replies though

EDIT: it works on a real pc... so i guess MS have some queer code in there, unless its just something funny going on =\
~ Lukem95 [ Cake ]
Release: 0.08b
Image
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Post by Ready4Dis »

lukem_95 wrote:oh god sorry, my original post actually sucked =\ (it was 1am ish when i made it)...

ok well i wasn't really asking for help on the paging thing, as it seems to be working fine. I'll try it on actual hardware and edit this post with the results. Thankyou all for your replies though

EDIT: it works on a real pc... so i guess MS have some queer code in there, unless its just something funny going on =\
Sometimes when that happens, it could possibly be something not being initialized properly, or possibly just one of the m$ bugs, hard to say really, but if it works on real hardware, then that should suffice ;). Make sure you test it on more than one machine though, you just never know.
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:

Post by Combuster »

The only bugs in VPC I'm aware of deal with VME, and also appear in QEmu.

VPC does run non-windows OSes, including mine. Normally if something doesn't work in VPC it doesn't work on some or all real PCs as well. The chance that you picked a bug is small, most likely its an oversight in your code.

In other words: Time to implement proper error handlers :wink:
"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 ]
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Post by Ready4Dis »

Combuster wrote:The only bugs in VPC I'm aware of deal with VME, and also appear in QEmu.

VPC does run non-windows OSes, including mine. Normally if something doesn't work in VPC it doesn't work on some or all real PCs as well. The chance that you picked a bug is small, most likely its an oversight in your code.

In other words: Time to implement proper error handlers :wink:
Yeah, just be careful, I had a problem where my code was working on a real PC and crashing in Bochs... come to find out, it was some un-initialized memory, on my PC I guess it was being set to all zero's, so it was just doing NOP's a bunch of times, in bochs it set the memory to something for debugging and would crash with invalid instructions, so it is still very possible that it's some code that may be working on your PC but might crash another, you need to track down where it's crashing at to find out exactly what/where the problem is coming from.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

, it dies giving a "fatal processor error" in a messagebox.
:shock: Egads! :shock:

Is that the stock code downloadable from my website or your own version? If the second, could you please give my downloadable code a try and let me know if it works?

Cheers,

James
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

Are you sure you got that the right way around? Bochs is notorious for having all it's memory set to 0 lulling people into thinking their code works properly.
The cake is a lie | rackbits.com
djenkins75
Posts: 11
Joined: Sun Dec 16, 2007 11:32 am
Location: Wisconsin, USA

MS-Virtual PC vs others

Post by djenkins75 »

I too discovered that my code would crash on VPC and run fine on VMWare.

It seems that if your virtual machine tries to access physical ram that is not there (but the virtual address is mapped), that on VMWare reads will return "0x00". On virtual PC they returned "0xff" (or so I remember).

In other words:

1) Configure a VM for 4M of ram.

2a) With paging disabled, but in p-mode in your VM, read from 0x80000000. The read should work (on real hardware you're reading gibberish).

2b) Enable paging. Map physical 0x80000000 to someplace in your virtual memory map. Now try to read the virtual address. You should get the same result as above.

My theory is that VMWare / Virtual PC map all non-existant (from point of view of your VM) physical memory to a real page that is initialized with all 0x00 or 0xff.

I fixed my bug before testing on Bochs. My real PC (a dell dimension 8400, some intel chipset) returns '0xff' for reads of non-existant memory (and hence my code crashed on bare metal).

I hope that this helps.
Post Reply