nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Page frame 관리자

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_allocatorpage_allocator_init (void *info, void *addr, unsigned int size)
 page frame 관리자를 초기화 한다. More...
 

Detailed Description

Page allocator 는 Page frame 을 관리한다. Buddy allocator 를 나름대로(독자적으로) 이해해서, 구현 하였다.

Author
Sung-jae Park nices.nosp@m.j@ni.nosp@m.cesj..nosp@m.com
Date
2013-9-21

할당 가능 한 page frame 에 대한 정보를 담고 있는 Bitmap 블럭과 사용 중인 page frame 에 대한 정보를 담고 있는 Bitmap 블럭을 이용해서 할당과 해제를 관리한다.

할당 가능 한 bit (page frame) 을 찾을 때, 매 Bit 를 하나씩 비교 하고 있기 때문에, 추 후 개선 가능성이 있다.

Function Documentation

void* page_allocator_alloc ( struct page_allocator handle,
unsigned int  nr_of_pages 
)

page frame 을 할당한다.

Parameters
[in]handlepage 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().

Here is the call graph for this function:

Here is the caller graph for this function:

void page_allocator_dump_header ( struct page_allocator handle)

page frame 관리 정보를 화면에 출력한다.

Parameters
[in]handlepage frame 관리 핸들
Returns
void

Definition at line 381 of file page_allocator.c.

References base, bitmap_sz, dbg_printf(), max_order, and nr_of_pages.

Here is the call graph for this function:

int page_allocator_fini ( struct page_allocator handle)

page frame 관리자를 종료한다.

Parameters
[in]handle
Returns
int

Definition at line 202 of file page_allocator.c.

References EINVAL.

int page_allocator_free ( struct page_allocator handle,
void *  addr 
)

할당 된 page frame 을 해제한다.

Parameters
[in]handlepage frame 관리 정보
[in]addr할당된 page frame 주소
Returns
int

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().

Here is the caller graph for this function:

int page_allocator_get_region ( struct page_allocator handle,
unsigned int *  start,
unsigned int *  end 
)

handle 이 관리하고 있는 Page frame 관리 영역에 대한 정보를 제공한다.

Parameters
[in]handlePage allocator 핸들
[out]start시작 주소
[out]end끝 주소
Returns
int

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().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int page_allocator_info_size ( unsigned int  size)

page allocator 가 관리 정보를 담기 위해 필요한 information block 의 크기

Parameters
[in]size할당 가능 한 페이지들의 전체 크기 (byte 단위)
Returns
unsigned int

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().

Here is the call graph for this function:

Here is the caller graph for this function:

struct page_allocator* page_allocator_init ( void *  info,
void *  addr,
unsigned int  size 
)

page frame 관리자를 초기화 한다.

Parameters
[in]infopage frame 관리를 위해 정보를 담고 관리 할 메모리 버퍼
[in]addr시작 주소
[in]size사용 가능 한 메모리 크기
Returns
struct page_allocator

Definition at line 180 of file page_allocator.c.

References _SC_PAGESIZE, NULL, page_size_bits, and sysconf().

Referenced by page_frame_init().

Here is the call graph for this function:

Here is the caller graph for this function: