pml4
를 사용하여 가상 메모리 주소와 물리 메모리 주소간의 매핑정보를 저장<aside> 💡 따라서 Page Fault 와 Resource Management를 수원하게 진행 할 수 있도록 Supplemental Page Table를 구현
</aside>
struct supplemental_page_table
을 먼저 구현 하고 그 후에 관련 함수를 구현 한다.hash table
로 구현!struct page {
const struct page_operations *operations;//페이지 관련 연산종류
void *va; /* Address in terms of user space */
struct frame *frame; //물리 메모리 프레임 주소
/* Your implementation */
struct hash_elem hash_elem;
...
}
hash_elem
의 page 중, 하나의 va
로 부터 해시값을 구하는 함수hash_bytes()
의 맵핑 함수 라고 할 수 있다.// hash_elem를 넣으면 해당 페이지의 va에서 해시값을 추출
unsigned
page_hash (const struct hash_elem *e, void *aux){
const struct page *p = hash_entry (e, struct page, hash_elem);
return hash_bytes(&p->va, sizeof(p->va));
}