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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.3. BASIC CONCEPTS CHAPTER 3. VM, PROTECTION AND PAGING<br />

<strong>of</strong> the use_4_m_pages bit. Sweb defines an union between the two structs so both<br />

interpretations can be used conveniently. <strong>The</strong> bits are further explained in table 3.3.3.<br />

1 #include " types .h"<br />

2<br />

3 #define PAGE_TABLE_ENTRIES 1024<br />

4 #define PAGE_SIZE 4096<br />

5 #define PAGE_INDEX_OFFSET_BITS 12<br />

6<br />

7 struct page_directory_entry_4k_struct<br />

8 {<br />

9 uint32 present : 1 ;<br />

10 uint32 writeable : 1 ;<br />

11 uint32 user_access : 1 ;<br />

12 uint32 write_through : 1 ;<br />

13 uint32 cache_disabled : 1 ;<br />

14 uint32 accessed : 1 ;<br />

15 uint32 reserved : 1 ;<br />

16 uint32 use_4_m_pages : 1 ;<br />

17 uint32 global_page : 1 ;<br />

18 uint32 avail_1 : 1 ;<br />

19 uint32 avail_2 : 1 ;<br />

20 uint32 avail_3 : 1 ;<br />

21 uint32 page_table_base_address :20;<br />

22 } __attribute__ ( ( __packed__ ) ) ;<br />

23<br />

24 struct page_directory_entry_4m_struct<br />

25 {<br />

26 uint32 present : 1 ;<br />

27 uint32 writeable : 1 ;<br />

28 uint32 user_access : 1 ;<br />

29 uint32 write_through : 1 ;<br />

30 uint32 cache_disabled : 1 ;<br />

31 uint32 accessed : 1 ;<br />

32 uint32 dirty : 1 ;<br />

33 uint32 use_4_m_pages : 1 ;<br />

34 uint32 global_page : 1 ;<br />

35 uint32 avail_1 : 1 ;<br />

36 uint32 avail_2 : 1 ;<br />

37 uint32 avail_3 : 1 ;<br />

38 uint32 pat : 1 ;<br />

39 uint32 reserved : 9 ;<br />

40 uint32 page_base_address :10;<br />

41 } __attribute__ ( ( __packed__ ) ) ;<br />

42<br />

43 union page_directory_entry_union<br />

44 {<br />

45 struct page_directory_entry_4k_struct pde4k ;<br />

46 struct page_directory_entry_4m_struct pde4m;<br />

47 } __attribute__ ( ( __packed__ ) ) ;<br />

48 typedef union page_directory_entry_union page_directory_entry ;<br />

49<br />

50 struct page_table_entry_struct<br />

51 {<br />

52 uint32 present : 1 ;<br />

53 uint32 writeable : 1 ;<br />

54 uint32 user_access : 1 ;<br />

55 uint32 write_through : 1 ;<br />

56 uint32 cache_disabled : 1 ;<br />

57 uint32 accessed : 1 ;<br />

58 uint32 dirty : 1 ;<br />

59 uint32 pat : 1 ;<br />

30 <strong>of</strong> 151

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

Saved successfully!

Ooh no, something went wrong!