cs412017
2005-11-08 06:04:26 UTC
I am getting a really weird error (while implementing user memory
mapping). When I run bochs, I get the following message:
00000000000i[ ] installing x module as the Bochs GUI
00000000000i[ ] using log file ./bochs.out
8192KB memory detected, 1659 pages in freelist, 1048576 bytes in kernel heap
Initializing IDT...
Paging on ? : 0
Paging on ? : 1
Initializing timer...
Delay loop: 7314 iterations per tick
Initializing keyboard...
Initializing DMA Controller...
Initializing floppy controller...
fd0: cyl=80, heads=2, sectors=18
Initializing IDE controller...
ide0: cyl=40, heads=8, sectors=64
Registering paging device: /c/pagefile.bin on ide0
Mounted /c filesystem!
Welcome to GeekOS!
Spawning init process (/c/shell.exe)
About to switch to thread 6...leaving Schedule
========================================================================
Bochs is exiting with the following message:
[CPU ] prefetch: running in bogus memory
========================================================================
I put in the print statement ("About to switch...") in Schedule(). It
seems that the code is barfing in Switch_User_Thread().
A few details about what I am sure I've done right so far:
a. I am using memcpy to copy the kernel page directory entries into my
user page directory entries (I've verified that they're the same).
b. I am pretty sure that I am setting up the top 2 Gb of the user page
directory correctly. Particularly, I am having to set up 4 pages in
physical memory for the code/text segments (for shell..I've verified
this through debug statements). I am also setting the appropriate flags
/ present bits for the page directory entries / page table entries.
c. I am using memcpy to copy stuff from memory into the pages that I am
allocating for setting up text / code (I've verified that the content of
the page matches the corresponding chunk from memory).
d. As mentioned in the description, I am using the last 2 entries of the
last page table to set up the user stack and arg block respectively...
e. I am also making sure that size which is being passed in to
Create_User_Context does not include the size of the user stack and the
size of the argument block.
Things that I am not sure about:
a. I am setting userContext->entryAddr = exeFormat->entryAddr as was
being done in userseg.c...I'm not sure if this should be changed or not
b. I am setting userContext->argBlockAddr to 0xfffff000 and
userContext->stackPointerAddr to be 0xfffff000 (the same).
c. I changed the baseAddr argument in
Init_(Code/Data)_Segment_Descriptor to be USER_VM_START from
context->memory.
d. I am passing in the physical address of the argblock as the first
argument, ie, the address of the page that I allocated for the argblock,
and 0xfffff000 as the userAddress, or 3rd argument...
I started getting this bogus memory error right after I did part (c)
from the things that I am not sure about...before that I was getting a
page fault exception...
Any help on this would be appreciated.Thanks.
mapping). When I run bochs, I get the following message:
00000000000i[ ] installing x module as the Bochs GUI
00000000000i[ ] using log file ./bochs.out
8192KB memory detected, 1659 pages in freelist, 1048576 bytes in kernel heap
Initializing IDT...
Paging on ? : 0
Paging on ? : 1
Initializing timer...
Delay loop: 7314 iterations per tick
Initializing keyboard...
Initializing DMA Controller...
Initializing floppy controller...
fd0: cyl=80, heads=2, sectors=18
Initializing IDE controller...
ide0: cyl=40, heads=8, sectors=64
Registering paging device: /c/pagefile.bin on ide0
Mounted /c filesystem!
Welcome to GeekOS!
Spawning init process (/c/shell.exe)
About to switch to thread 6...leaving Schedule
========================================================================
Bochs is exiting with the following message:
[CPU ] prefetch: running in bogus memory
========================================================================
I put in the print statement ("About to switch...") in Schedule(). It
seems that the code is barfing in Switch_User_Thread().
A few details about what I am sure I've done right so far:
a. I am using memcpy to copy the kernel page directory entries into my
user page directory entries (I've verified that they're the same).
b. I am pretty sure that I am setting up the top 2 Gb of the user page
directory correctly. Particularly, I am having to set up 4 pages in
physical memory for the code/text segments (for shell..I've verified
this through debug statements). I am also setting the appropriate flags
/ present bits for the page directory entries / page table entries.
c. I am using memcpy to copy stuff from memory into the pages that I am
allocating for setting up text / code (I've verified that the content of
the page matches the corresponding chunk from memory).
d. As mentioned in the description, I am using the last 2 entries of the
last page table to set up the user stack and arg block respectively...
e. I am also making sure that size which is being passed in to
Create_User_Context does not include the size of the user stack and the
size of the argument block.
Things that I am not sure about:
a. I am setting userContext->entryAddr = exeFormat->entryAddr as was
being done in userseg.c...I'm not sure if this should be changed or not
b. I am setting userContext->argBlockAddr to 0xfffff000 and
userContext->stackPointerAddr to be 0xfffff000 (the same).
c. I changed the baseAddr argument in
Init_(Code/Data)_Segment_Descriptor to be USER_VM_START from
context->memory.
d. I am passing in the physical address of the argblock as the first
argument, ie, the address of the page that I allocated for the argblock,
and 0xfffff000 as the userAddress, or 3rd argument...
I started getting this bogus memory error right after I did part (c)
from the things that I am not sure about...before that I was getting a
page fault exception...
Any help on this would be appreciated.Thanks.