본문 바로가기

SW사관학교 정글 4기/pintos6

install_page 코드 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) 매핑을 추가함. unmappe.. 2022. 6. 11.
load_segment 코드 static bool load_segment (struct file *file, off_t ofs, uint8_t *upage, uint32_t read_bytes, uint32_t zero_bytes, bool writable) { ASSERT ((read_bytes + zero_bytes) % PGSIZE == 0); ASSERT (pg_ofs (upage) == 0); ASSERT (ofs % PGSIZE == 0); file_seek (file, ofs); while (read_bytes > 0 || zero_bytes > 0) { /* Do calculate how to fill this page. * We will read PAGE_READ_BYTES bytes from FILE * an.. 2022. 6. 11.
[Project 2 - Userprogram] 시스템콜, 시스템콜 핸들러 보호되어 있는 글 입니다. 2022. 6. 5.
Project 2: User Programs 검색어 목록 1. User mode vs. Kernel mode User mode는 해당 user program의 private한 저장공간(virtual memory)에만 접근할 수 있고, I/O작업을 수행하는 것이 불가능하다. 그에 반해, Kernel은 메모리의 어떤 공간이든 접근할 수 있고 어떤 I/O작업도 가능하다. 유저모드와 커널모드의 구별을 위해 Mode-bit을 사용해 0, 1을 각각 kernel mode, user mode로 구분한다. 가상주소공간: kernel은 단 하나의 가상주소공간을 갖지만, 사용자 프로그램은 분리된 주소공간을 갖는다. 2. Process 프로세스는 자원의 할당 단위이다. 각 프로세스는 고립된 가상 메모리를 할당 받고, 프로세스 간에는 다른 가상메모리 공간에 접근할 수 없다.(pro.. 2022. 5. 30.