Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 536 → Rev 537

/kernel/trunk/generic/include/mm/frame.h
54,7 → 54,6
spinlock_t lock; /**< this lock protects everything below */
__address base; /**< physical address of the first frame in the frames array */
frame_t *frames; /**< array of frame_t structures in this zone */
link_t free_head; /**< list of free frame_t structures */
count_t free_count; /**< number of frame_t structures in free list */
count_t busy_count; /**< number of frame_t structures not in free list */
63,10 → 62,9
};
 
struct frame {
count_t refcount; /**< when == 0, the frame is in free list */
link_t link; /**< link to zone free list when refcount == 0 */
count_t refcount; /**< tracking of shared frames */
__u8 buddy_order; /**< buddy system block order */
link_t buddy_link; /**< link to the next free block inside one order*/
link_t buddy_link; /**< link to the next free block inside one order */
};
 
struct region {
/kernel/trunk/generic/src/mm/frame.c
63,17 → 63,16
{
if (config.cpu_active == 1) {
zone_init();
frame_region_not_free(config.base, config.kernel_size);
frame_region_not_free(KA2PA(config.base), config.kernel_size);
}
 
frame_arch_init();
}
 
/** Allocate a frame
/** Allocate power-of-two frames of physical memory.
*
* Allocate a frame of physical memory.
*
* @param flags Flags for host zone selection and address processing.
* @param order Allocate exactly 2^order frames.
*
* @return Allocated frame.
*/
202,19 → 201,19
*
* Mark frame region not free.
*
* @param start First address.
* @param stop Last address.
* @param base Base address of non-available region.
* @param size Size of non-available region.
*/
void frame_region_not_free(__address base, size_t size)
{
count_t index;
index_t index;
index = zone_blacklist_count++;
ASSERT(base % FRAME_SIZE == 0);
if (size % FRAME_SIZE != 0) {
size = ALIGN(size, FRAME_SIZE);
}
ASSERT(size % FRAME_SIZE == 0);
 
/* Force base to the nearest lower address frame boundary. */
base &= ~(FRAME_SIZE - 1);
/* Align size to frame boundary. */
size = ALIGN(size, FRAME_SIZE);
 
ASSERT(zone_blacklist_count <= ZONE_BLACKLIST_SIZE);
zone_blacklist[index].base = base;
zone_blacklist[index].size = size;
235,13 → 234,15
void zone_create_in_region(__address base, size_t size) {
int i;
zone_t * z;
__address s; size_t sz;
__address s;
size_t sz;
ASSERT(base % FRAME_SIZE == 0);
ASSERT(size % FRAME_SIZE == 0);
if (!size) return;
if (!size)
return;
 
for (i = 0; i < zone_blacklist_count; i++) {
if (zone_blacklist[i].base >= base && zone_blacklist[i].base < base + size) {
s = base; sz = zone_blacklist[i].base - base;
303,8 → 304,6
z->flags = flags;
 
z->free_count = cnt;
list_initialize(&z->free_head);
 
z->busy_count = 0;
z->frames = (frame_t *) early_malloc(cnt * sizeof(frame_t));
315,13 → 314,13
for (i = 0; i<cnt; i++) {
frame_initialize(&z->frames[i], z);
list_append(&z->frames[i].link, &z->free_head);
}
/*
* Create buddy system for the zone
*/
for (max_order = 0; cnt >> max_order; max_order++);
for (max_order = 0; cnt >> max_order; max_order++)
;
z->buddy_system = buddy_system_create(max_order, &zone_buddy_system_operations, (void *) z);
/* Stuffing frames */
363,7 → 362,6
{
frame->refcount = 1;
frame->buddy_order = 0;
link_initialize(&frame->link);
}
 
 
/kernel/trunk/arch/ia64/include/mm/page.h
34,8 → 34,8
 
#define PAGE_SIZE FRAME_SIZE
 
#define KA2PA(x) (((__address) (x))-0x8000000000000000)
#define PA2KA(x) (((__address) (x))+0x8000000000000000)
#define KA2PA(x) ((__address) (x))
#define PA2KA(x) ((__address) (x))
 
#define page_arch_init() ;
 
/kernel/trunk/arch/ia32/src/mm/frame.c
41,8 → 41,6
void frame_arch_init(void)
{
zone_t *z;
__address start, stop;
size_t size;
__u8 i;
if (config.cpu_active == 1) {
53,8 → 51,8
/* Reserve real mode bootstrap memory */
frame_region_not_free(BOOTSTRAP_OFFSET, hardcoded_unmapped_ktext_size + hardcoded_unmapped_kdata_size);
for (i=0;i<e820counter;i++) {
if (e820table[i].type==MEMMAP_MEMORY_AVAILABLE) {
for (i = 0; i < e820counter; i++) {
if (e820table[i].type == MEMMAP_MEMORY_AVAILABLE) {
zone_create_in_region(e820table[i].base_address, e820table[i].size & ~(FRAME_SIZE-1));
}
}