Page 1 of 1

protected memory

Posted: Wed Jul 11, 2007 10:06 pm
by Ninjarider
got ahold of an intel manual and been doing some reading.
thinking about starting off with it just in case down the road.
does anyone have an os that has this functioning.

is there any memory fields that i should not touch. (a-block ie video, and bios areas, ?????)

Posted: Thu Jul 12, 2007 2:32 am
by JamesM
There are two ways (in X86) of protecting memory - paging and segmentation.

I don't use segmentation.

I have paging working and have user/supervisor level protection and have had that for quite a while now.

Posted: Thu Jul 12, 2007 9:35 am
by Combuster
The best thing is to not touch anything that you do not know about. For most starting people that means 'do not write to anything but RAM that you know is present or video memory'. You'll probably figure about other places you can write to yourself sooner or later.

The same can be said about I/O ports, btw.

Posted: Fri Jul 13, 2007 2:22 am
by AndrewAPrice
I use paging. I found C++ to be a lot of help, since each process is an instance of a Process class, which has it's own linked list of pages. When a task switch is done, I disable the the paging bit of CR0, regenerate the page table (just loop through the linked list of kernel then process pages and add them to the page table/directories), and re-enable the paging bit of CR0.

I know it's not the quickest way (some people give each process it's own page directory in memory and just swap the value of CR3 instead of generating a new one), but it works for me and and saves memory.