gaf
User
 Platinum Osdever
| Posts: 153 |  | Karma: 10
|
Re: Memory map and GDT - 2006/02/05 09:25
Hello, If you go for a flat-mode kernel, protection is not provided by segmentation (descriptors in the gdt/ldt) but only by the paging mechanism. The values defined in the gdt entries are virtual addresses and every time a memory reference is made by a task, the cpu looks up the address in the page-directory/page-table to get the corresponding physical address. To make sure that a task can't access memory hold by another task, all you have to do is to use one page-directory per process, and make sure that no two tasks have the same physical address mapped to their virtual address-space.
| Code: | page-directory task[0]:
v-addr p-addr
0x00000000 0x01000000 (physical = 16M
0x00001000 0x01001000 (next page = page+4096)
....
0x000FC000 0x010FC000 (last page = 17M
page-directory task[1]:
v-addr p-addr
0x00000000 0x01100000 (physical = 17M
0x00001000 0x01101000 (next page = page+4096)
....
0x000FC000 0x011FC000 (last page = 18M
task[0]: mov [0x00000100] -> phys 0x01000100
task[1]: mov [0x00000100] -> phys 0x01100100 |
regards,
gaf
|