|
nckernel
0.1
|
Page allocator 는 Page frame 을 관리한다. Buddy allocator 를 나름대로(독자적으로) 이해해서, 구현 하였다. More...
Functions | |
| void * | page_allocator_alloc (struct page_allocator *handle, unsigned int nr_of_pages) |
| page frame 을 할당한다. More... | |
| void | page_allocator_dump_header (struct page_allocator *handle) |
| page frame 관리 정보를 화면에 출력한다. More... | |
| int | page_allocator_fini (struct page_allocator *handle) |
| page frame 관리자를 종료한다. More... | |
| int | page_allocator_free (struct page_allocator *handle, void *addr) |
| 할당 된 page frame 을 해제한다. More... | |
| int | page_allocator_get_region (struct page_allocator *handle, unsigned int *start, unsigned int *end) |
| handle 이 관리하고 있는 Page frame 관리 영역에 대한 정보를 제공한다. More... | |
| unsigned int | page_allocator_info_size (unsigned int size) |
| page allocator 가 관리 정보를 담기 위해 필요한 information block 의 크기 More... | |
| struct page_allocator * | page_allocator_init (void *info, void *addr, unsigned int size) |
| page frame 관리자를 초기화 한다. More... | |
Page allocator 는 Page frame 을 관리한다. Buddy allocator 를 나름대로(독자적으로) 이해해서, 구현 하였다.
할당 가능 한 page frame 에 대한 정보를 담고 있는 Bitmap 블럭과 사용 중인 page frame 에 대한 정보를 담고 있는 Bitmap 블럭을 이용해서 할당과 해제를 관리한다.
할당 가능 한 bit (page frame) 을 찾을 때, 매 Bit 를 하나씩 비교 하고 있기 때문에, 추 후 개선 가능성이 있다.
| void* page_allocator_alloc | ( | struct page_allocator * | handle, |
| unsigned int | nr_of_pages | ||
| ) |
page frame 을 할당한다.
| [in] | handle | page frame 관리 정보 |
| [in] | nr_of_pages | 할당 받을 page frame 개수. 2 의 멱수. |
Stage 1. Finding available bit-group.
Stage 2. Split found bit-group to requested one.
Stage 2.1 Mark splited bit-groups to be available
Definition at line 232 of file page_allocator.c.
References base, BIT_MASK, bitmap, bitmap_sz, BYTE_IDX, dbg_printf(), max_order, and page_size_bits.
Referenced by page_frame_alloc().


| void page_allocator_dump_header | ( | struct page_allocator * | handle) |
page frame 관리 정보를 화면에 출력한다.
| [in] | handle | page frame 관리 핸들 |
Definition at line 381 of file page_allocator.c.
References base, bitmap_sz, dbg_printf(), max_order, and nr_of_pages.

| int page_allocator_fini | ( | struct page_allocator * | handle) |
page frame 관리자를 종료한다.
| [in] | handle |
Definition at line 202 of file page_allocator.c.
References EINVAL.
| int page_allocator_free | ( | struct page_allocator * | handle, |
| void * | addr | ||
| ) |
할당 된 page frame 을 해제한다.
| [in] | handle | page frame 관리 정보 |
| [in] | addr | 할당된 page frame 주소 |
Definition at line 324 of file page_allocator.c.
References base, BIT_MASK, bitmap, bitmap_sz, BYTE_IDX, EINVAL, ENOENT, max_order, and page_size_bits.
Referenced by page_frame_fini(), and page_frame_free().

| int page_allocator_get_region | ( | struct page_allocator * | handle, |
| unsigned int * | start, | ||
| unsigned int * | end | ||
| ) |
handle 이 관리하고 있는 Page frame 관리 영역에 대한 정보를 제공한다.
| [in] | handle | Page allocator 핸들 |
| [out] | start | 시작 주소 |
| [out] | end | 끝 주소 |
Definition at line 416 of file page_allocator.c.
References _SC_PAGESIZE, base, EINVAL, nr_of_pages, and sysconf().
Referenced by find_zone_by_addr().


| unsigned int page_allocator_info_size | ( | unsigned int | size) |
page allocator 가 관리 정보를 담기 위해 필요한 information block 의 크기
| [in] | size | 할당 가능 한 페이지들의 전체 크기 (byte 단위) |
i = (((i << 1) >> 3) << 1) i = ((i >> 2) << 1) i = (i >> 1)
Definition at line 392 of file page_allocator.c.
References _SC_PAGESIZE, nr_of_pages, page_size_bits, and sysconf().
Referenced by page_frame_init().


| struct page_allocator* page_allocator_init | ( | void * | info, |
| void * | addr, | ||
| unsigned int | size | ||
| ) |
page frame 관리자를 초기화 한다.
| [in] | info | page frame 관리를 위해 정보를 담고 관리 할 메모리 버퍼 |
| [in] | addr | 시작 주소 |
| [in] | size | 사용 가능 한 메모리 크기 |
Definition at line 180 of file page_allocator.c.
References _SC_PAGESIZE, NULL, page_size_bits, and sysconf().
Referenced by page_frame_init().


1.8.4