17.01.2014 Views

The holy bible of SWEB - Institute of Applied Information Processing ...

The holy bible of SWEB - Institute of Applied Information Processing ...

The holy bible of SWEB - Institute of Applied Information Processing ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.4. INTERFACE & CLASSES CHAPTER 3. VM, PROTECTION AND PAGING<br />

3.4 Interface & Classes<br />

3.4.1 ArchMemory<br />

<strong>The</strong> class ArchMemory does not get instantiated. Instead it is a collection <strong>of</strong> architecture<br />

dependent static methods related to Memory and Pages. <strong>The</strong>refore these methods<br />

will be refereed to as functions. An alternative would have been to use namespaces,<br />

but this approach was taken. ArchMemory contains architecture dependent code and<br />

needs to be implemented separately for each platform. This document focuses on the<br />

x86 architecture.<br />

Interface<br />

Function<br />

static void initNewPageDirectory(uint32<br />

physical_page_to_use);<br />

static void mapPage(uint32 physical_page_directory_page,<br />

uint32<br />

linear_page, uint32 physical_page,<br />

uint32 user_access, uint32<br />

page_size=PAGE_SIZE);<br />

static void unmapPage(uint32 physical_page_directory_page,<br />

uint32<br />

linear_page);<br />

static void freePageDirectory(uint32<br />

physical_page_directory_page);<br />

Description<br />

creates a new Page-Directory for an user process<br />

by copying the original kernel-only page<br />

directory. <strong>The</strong> parameter physical_page_to_use<br />

specifies where the new PDE should be.<br />

maps a linear page to a physical page (pde<br />

and pte need to be set up first). physical_page_directory_page<br />

specifies the physical<br />

page where the Page-Directory-Entry to work<br />

on can be found. With user_access the User/-<br />

Supervisor Flag can be set. page_size is optional<br />

and defaults to 4KiB pages, but you need<br />

to set it to 1024*4096 if you want to map a<br />

4MiB page.<br />

removes the mapping <strong>of</strong> a linear_page by marking<br />

its PTE Entry as non valid <strong>The</strong> parameter<br />

physical_page_directory_page specifies the real<br />

memory page where the PDE to work on can be<br />

found. virtual_page identifies the mapping that<br />

will be invalidated.<br />

recursively removes a Page-Directory-Entry,<br />

the Page-Tables it points to and marks all<br />

mapped pages as free in the PageManger. physical_page_directory_page<br />

are the 20 most significant<br />

bits <strong>of</strong> the physical address on which<br />

the Page-Directory can be found.<br />

34 <strong>of</strong> 151

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!