728x90
코드
static bool
install_page (void *upage, void *kpage, bool writable) {
struct thread *t = thread_current ();
/* Verify that there's not already a page at that virtual
* address, then map our page there. */
return (pml4_get_page (t->pml4, upage) == NULL
&& pml4_set_page (t->pml4, upage, kpage, writable));
}
목적
- 페이지 테이블에 upage(user virtual address) -> kpage(kernel virtual address) 매핑을 추가함.
- unmapped 상태인지 먼저 확인하고, mapping함, 이미 mapped라면 return false
- kpage는 반드시 user pool에서 할당받아야 한다. 실패시 false
- 인자인 writable이 true인 경우엔 사용자 프로세스가 해당 페이지를 수정할 것이고 아니면 read-only.
호출되는 곳
userprog/process.c의 setup_stack함수, load_segment함수
728x90
'🚩 3. Projects & Retrospect > SW사관학교 정글 4기' 카테고리의 다른 글
| 정글 수료 그 후, 무엇을 할까? (2) | 2022.08.26 |
|---|---|
| load_segment (0) | 2022.06.11 |
| [SW사관학교 정글] Week 09~10 회고 (0) | 2022.06.08 |
| 정글 Chapter 3. 정글 끝까지 - 1, 2 회고 (0) | 2022.06.08 |
| [Project 2 - Userprogram] 시스템콜, 시스템콜 핸들러 (0) | 2022.06.05 |
댓글