Running into Bogus-Memory

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
Wacky

Running into Bogus-Memory

Post by Wacky »

Normaly i'm testing my OS on a normal PC.. it runs wonderfully :). But if i test my OS in BOCHS, i'll get following message.

Code: Select all

00008355822p[CPU  ] >>PANIC<< prefetch: running in bogus memory
where's my fault??



This is the debug-message fom Bochs:

Code: Select all

00008355822p[CPU  ] >>PANIC<< prefetch: running in bogus memory
00008355822i[SYS  ] Last time is 1056548645
00008355822i[CPU  ] protected mode
00008355822i[CPU  ] CS.d_b = 32 bit
00008355822i[CPU  ] SS.d_b = 32 bit
00008355822i[CPU  ] | EAX=60000018  EBX=00b7000f  ECX=10cd0000  EDX=000003f2
00008355822i[CPU  ] | ESP=00009000  EBP=00000000  ESI=00007d21  EDI=0000ffe4
00008355822i[CPU  ] | IOPL=0 NV UP DI PL NZ AC PE CY
00008355822i[CPU  ] | SEG selector     base    limit G D
00008355822i[CPU  ] | SEG sltr(index|ti|rpl)     base    limit G D
00008355822i[CPU  ] |  DS:0018( 0003| 0|  0) 00000000 000fffff 1 1
00008355822i[CPU  ] |  ES:0018( 0003| 0|  0) 00000000 000fffff 1 1
00008355822i[CPU  ] |  FS:0018( 0003| 0|  0) 00000000 000fffff 1 1
00008355822i[CPU  ] |  GS:0018( 0003| 0|  0) 00000000 000fffff 1 1
00008355822i[CPU  ] |  SS:0018( 0003| 0|  0) 00000000 000fffff 1 1
00008355822i[CPU  ] |  CS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00008355822i[CPU  ] | EIP=01000000 (01000000)
00008355822i[CPU  ] | CR0=0x60000011 CR1=0x00000000 CR2=0x00000000
00008355822i[CPU  ] | CR3=0x00000000 CR4=0x00000000
00008355822i[     ] restoring default signal behavior
00008355822i[CTRL ] quit_sim called with exit code 1
Bootimage: Look at the Attachment, or at http://home.pages.at/popangler/os/boot.asm please.

thx for every help.. Wacky

[attachment deleted by admin]
bkilgore

Re:Running into Bogus-Memory

Post by bkilgore »

I haven't looked through your code yet, but I had a problem with bochs giving me that message when booting before. It came when I jumped into my kernel and made any call statement before enabling paging, if I had the virtual address of the code at an address beyond the size of memory allocated for bochs.

That might sound a little confusing :) but basically, if I set my linker script to have my .text section start at offset 0xE0000000, bochs gives me the bogus memory error when any call statement is executed, but if I set it below 0x04000000 (the 64MB i reserved for bochs), everything works fine. I've put that bug on the backburner for now, so I don't have a solution for that yet, but you might be having the same problem.

If you are, let me know, and I'll try to let you know if I fix it, or you can let me know if you fix it first :)

- Brandon
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Running into Bogus-Memory

Post by Pype.Clicker »

you sent eip pointer to an uninitialized memory location. Please refer to the huge amount of already posted message to find out how and where.
Wacky

Re:Running into Bogus-Memory

Post by Wacky »

i've toyed a little bit with my linker-script and with the options in Bochs, but anyway there is still the same problem. Additionally i have to say, that the same problem happends on some other (older) PC's..

In my opinion the fault is in my Bootimage. :-(
bkilgore

Re:Running into Bogus-Memory

Post by bkilgore »

Code: Select all

GDT:

   DD   0x0            ; NULL DISKRIPTOR   
   DD   0x0            ;
   DD   0x0            ;
   DD   0x0            ;
Just so you know, you only need two of those DD for the NULL descriptor... 2 DD = 8 bytes which is the size of a descriptor. I don't think that would necessarily cause your problem, but for future reference...


I've looked all through your boot code and I can't find anything that jumps out at me. With my problem before, I always though it was the bootloader too, but it turned out to me later code. Can you attach the code that you are reading that gets jumped to at CODESEL:0x100000 ?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Running into Bogus-Memory

Post by Pype.Clicker »

you should read floppy info better, and look for a real mode tutorial.

1. you cannot read more than 18 sectors at once calling the floppy interrupts of the BIOS.
2. you cannot go further than 64K above 1MB while in realmode. So reading the whole floppy from 1MB is utopia.
3. you should not try to go higher than 1MB unless you activated A20 gate. not even by a byte, or you might be overwriting the interrupt vektorz. You're lucky to run bochs instead of a realPC (bochs enables A20 gate in the BIOS init)
bkilgore

Re:Running into Bogus-Memory

Post by bkilgore »

Pype.Clicker wrote:3. you should not try to go higher than 1MB unless you activated A20 gate. not even by a byte, or you might be overwriting the interrupt vektorz. You're lucky to run bochs instead of a realPC (bochs enables A20 gate in the BIOS init)
Pype: If I remember his code correctly, he actually does enable the A20 gate, though that's the least of his worries right now :)

Wacky: because of the 64K limitation while in real mode, you would probably be better off in general reading into another section of the available memory. If you take a look at some docs on the contents of memory at boot, you'll see that there are a few fairly large chunks of available memory in the 1MB space that you can use without worrying about hitting the end of memory. One example is at the address 0x1000 (or any combination of segment and offset thereof).

- Brandon
Post Reply