mirror of
https://github.com/drasko/codezero.git
synced 2026-05-01 16:11:30 +02:00
Added posix code
This commit is contained in:
45
conts/posix/mm0/include/physmem.h
Normal file
45
conts/posix/mm0/include/physmem.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Physical memory descriptors
|
||||
*
|
||||
* Copyright (C) 2007 - 2009 Bahadir Balban
|
||||
*/
|
||||
#ifndef __PAGER_PHYSMEM_H__
|
||||
#define __PAGER_PHYSMEM_H__
|
||||
|
||||
/* A compact memory descriptor to determine used/unused pages in the system */
|
||||
struct page_bitmap {
|
||||
unsigned long pfn_start;
|
||||
unsigned long pfn_end;
|
||||
unsigned int map[];
|
||||
};
|
||||
|
||||
/* Describes a portion of physical memory. */
|
||||
struct memdesc {
|
||||
unsigned int start;
|
||||
unsigned int end;
|
||||
unsigned int free_cur;
|
||||
unsigned int free_end;
|
||||
unsigned int numpages;
|
||||
};
|
||||
|
||||
struct membank {
|
||||
unsigned long start;
|
||||
unsigned long end;
|
||||
unsigned long free;
|
||||
struct page *page_array;
|
||||
};
|
||||
extern struct membank membank[];
|
||||
|
||||
/* Describes bitmap of used/unused state for all physical pages */
|
||||
extern struct page_bitmap page_map;
|
||||
extern struct memdesc physmem;
|
||||
|
||||
/* Sets the global page map as used/unused. Aligns input when needed. */
|
||||
int set_page_map(struct page_bitmap *pmap, unsigned long start,
|
||||
int numpages, int val);
|
||||
|
||||
struct initdata;
|
||||
void init_physmem_primary(struct initdata *initdata);
|
||||
void init_physmem_secondary(struct initdata *initdata, struct membank *membank);
|
||||
|
||||
#endif /* __PAGER_PHYSMEM_H__ */
|
||||
Reference in New Issue
Block a user