-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.h
More file actions
37 lines (30 loc) · 869 Bytes
/
page.h
File metadata and controls
37 lines (30 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef __PAGE_H__
#define __PAGE_H__
#include "types.h"
/* Following global vars are defined in mem.S */
extern uint32_t TEXT_START;
extern uint32_t TEXT_END;
extern uint32_t DATA_START;
extern uint32_t DATA_END;
extern uint32_t RODATA_START;
extern uint32_t RODATA_END;
extern uint32_t BSS_START;
extern uint32_t BSS_END;
extern uint32_t HEAP_START;
extern uint32_t HEAP_SIZE;
/* base configuration of pages */
#define PAGE_SIZE 4096 /* (2 << 12) */
#define PAGE_ORDER 12
#define NUM_RESERVED_PAGES 8
/* bits in the flag */
#define PAGE_TAKEN (uint8_t)(1 << 0) /* bit-0 indicates the allocated page */
#define PAGE_LAST (uint8_t)(1 << 1) /* bit-1 indicates the last page */
/* Page Descriptor */
struct page {
uint8_t flags;
};
void page_init(void);
void *page_alloc(int npages);
void page_free(void *p);
void page_test(void);
#endif /* __PAGE_H__ */