본문 바로가기

정글캠프-WIL/핀토스

pintos - vm [stack_growth]

https://gyumingomin.tistory.com/94

 

vm - Page Fault 구현

https://gyumingomin.tistory.com/92 Pintos - vm [페이지 할당 초기화 과정을 위한 흐름도]https://gyumingomin.tistory.com/91 Pintos - SPT(Supplemental Page Table)와 Hash TableSPT(Supplemental Page Table)에서 hash table을 왜 쓸까?Pintos V

gyumingomin.tistory.com

여기서 vm_try_handle_fault 구현 중 Stack Growth 여부를 체크하고 호출하는 부분이 있습니다 이 흐름을 이해하고 현재 블로그 글을 보는 것을 추천드립니다.

1. vm_stack_growth

접은글 : vm_stack_growth 구현

1. 받은 fault 주소를 페이지 단위로 내린다. 0x8123 → 0x8000
2. vm_alloc_page() 매크로를 통해 vm_alloc_page_with_initializer()를 호출한다. 이 단계에서는 프레임을 할당하지 않고, SPT에 VM_UNINIT 상태의 페이지를 등록한다. 단, 이 uninit page 안에는 "나중에 claim될 때 anonymous page로 초기화하라"는 정보가 들어간다.
3. SPT 등록이 성공하면 vm_claim_page(upage)를 호출 해 실제로 frame을 할당하고, pml4에 매핑하고, swap_in()을 통해 uninit page가 anon page로 초기화된다.

이 과정을 정확하게 이해하기 위해서 보시길 추천드리는 페이지

https://gyumingomin.tistory.com/96

 

pintos - vm [setup_stack] 초기 스택 영역 메모리 관리 대상 추가

https://gyumingomin.tistory.com/95 pintos - vm_do_claim_page 구현https://gyumingomin.tistory.com/94 vm - Page Fault 구현https://gyumingomin.tistory.com/92 Pintos - vm [페이지 할당 초기화 과정을 위한 흐름도]https://gyumingomin.tistory.co

gyumingomin.tistory.com