OK, my first question is this:
When I try to set a byte at an address >= 4 MB, I get a General Protection Fault, shouldn't I get a Page Fault?
My second question:
How can I find an area in memory suitable for my heap? Seems that it's data everywhere...
Question no. 3:
Should a process have it's own selectors? If, why? My kernel selector has it's limit at 4 GB.
4th question:
How should a process' memory be mapped?
physic 0 -> 4 MB = Kernel
process 1 = physic 4 -> 8 MB
process 2 = physic 8 -> 12 MB
But what if process 1 wants to extend it's memory?
Questions, questions questions...
Re:Questions, questions questions...
not sure about this one.. but I think it will fail as long as you don't set up paging (and an appropriate entry)OK, my first question is this:
When I try to set a byte at an address >= 4 MB, I get a General Protection Fault, shouldn't I get a Page Fault?
Simple: if you've got paging, set up a constant range, for example from 0xE000_0000 to 0xF000_0000 (which is a range of 256Mb), and assign physical memory to it on demand. If you don't have paging enabled, get it just after your kernel: get your linker script to put a symbol on your kernel's end and assign the space for the heap on runtime. Be cautious not to overwrite static memory if you've got any after the kernel.My second question:
How can I find an area in memory suitable for my heap? Seems that it's data everywhere...
I set up a dummy selector, code&data selectors for kernel (base 0 size 4Gb), code&data selectors for user(base 0 size 4Gb) and a TSS.Question no. 3:
Should a process have it's own selectors? If, why? My kernel selector has it's limit at 4 GB.
Nah, I don't recommend such a scheme. Under paging you could have one memory space for one app. The range 0xc000_0000 - 0xFFFF_FFFF would be the kernel's range, indifferent for all spaces, and 0x8000_0000 to 0xBFFF_FFFF would be the processes. So each process would be situated at virtual 0x8000_0000, and to change tasks you would have to change the address space.4th question:
How should a process' memory be mapped?
physic 0 -> 4 MB = Kernel
process 1 = physic 4 -> 8 MB
process 2 = physic 8 -> 12 MB
But what if process 1 wants to extend it's memory?
[glow=red,2,300]Cheers[/glow]
edit: Why do you call yourself "Mr. X" ?
Re:Questions, questions questions...
OK, some things got clearer.
One thing:
I don't know LD script too well, so I couldn't manage to setup a symbol and read it in C. (I've searched the web).
One thing:
I don't know LD script too well, so I couldn't manage to setup a symbol and read it in C. (I've searched the web).
Re:Questions, questions questions...
I've managed to get the end of the kernel now.mr. X wrote: OK, some things got clearer.
One thing:
I don't know LD script too well, so I couldn't manage to setup a symbol and read it in C. (I've searched the web).
One thing, is this how the kernel's memory should be split up?
Kernal | Stack | Heap ->
Re:Questions, questions questions...
Heh, much replying by me, but I've registered now.
The memory could maybe be split up like this?
Kernel | Heap -> <- Stack| 4 MB
btw, I don't really know why I call myself "mr. x" :/
The memory could maybe be split up like this?
Kernel | Heap -> <- Stack| 4 MB
btw, I don't really know why I call myself "mr. x" :/
Re:Questions, questions questions...
Why not use the entire address space? User space could reside from 0 to 3GB, while the kernel sits in the top gigabyte of virtual memory for each process address space.Adek336 wrote:The range 0xc000_0000 - 0xFFFF_FFFF would be the kernel's range, indifferent for all spaces, and 0x8000_0000 to 0xBFFF_FFFF would be the processes. So each process would be situated at virtual 0x8000_0000, and to change tasks you would have to change the address space.
Yes, that's the typical layout.mr. x wrote:The memory could maybe be split up like this?
Kernel | Heap -> <- Stack| 4 MB
Re:Questions, questions questions...
I wanted to leave it because I heard some blah blah that a process in virtual mode will be able to access the first 2Gb.. as I wasn't sure I wanted to leave it this way, so when I got to v86 mode and it dir matter, I would have the framework already there and if it didn't, I would just change some bits.Why not use the entire address space? User space could reside from 0 to 3GB, while the kernel sits in the top gigabyte of virtual memory for each process address space.
Hm, it seems that I was wrong about that virtual-thing? How does it work then?
Cheers,
Adrian.
[glow=red,2,300](does this glow??)[/glow]
Re:Questions, questions questions...
[glow=green,2,300]with microsoft ie6 at least, it does[/glow]
In Linux-environment (which I f. ex. use at home mostly these days not only because of mydoom and consorts but because of the nifty command line tools - and the kernel development) I didn't manage to get even a fart of a glow - just red or green or whatsoever font.
In Linux-environment (which I f. ex. use at home mostly these days not only because of mydoom and consorts but because of the nifty command line tools - and the kernel development) I didn't manage to get even a fart of a glow - just red or green or whatsoever font.
Re:Questions, questions questions...
I'm using Mozilla Firefox and all I saw was the tag :p