/SPARTAN/trunk/include/mm/frame.h |
---|
44,16 → 44,15 |
__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 */ |
link_t busy_head; /**< list of busy frame_t structures */ |
count_t free_count; /**< number of frame_t structures in free list */ |
count_t busy_count; /**< number of frame_t structures in busy list */ |
count_t busy_count; /**< number of frame_t structures not in free list */ |
int flags; |
}; |
struct frame { |
count_t refcount; /**< when > 0, the frame is in busy list, otherwise the frame is in free list */ |
link_t link; /**< link either to frame_zone free or busy list */ |
}; |
count_t refcount; /**< when == 0, the frame is in free list */ |
link_t link; /**< link to zone free list when refcount == 0 */ |
} __attribute__ ((packed)); |
extern spinlock_t zone_head_lock; /**< this lock protects zone_head list */ |
extern link_t zone_head; /**< list of all zones in the system */ |
/SPARTAN/trunk/src/main/main.c |
---|
35,10 → 35,8 |
#include <proc/scheduler.h> |
#include <proc/thread.h> |
#include <proc/task.h> |
#include <mm/vm.h> |
#include <main/kinit.h> |
#include <cpu.h> |
#include <mm/heap.h> |
#ifdef __SMP__ |
#include <arch/smp/apic.h> |
48,9 → 46,12 |
#include <smp/smp.h> |
#include <arch/mm/memory_init.h> |
#include <mm/heap.h> |
#include <mm/frame.h> |
#include <mm/page.h> |
#include <mm/tlb.h> |
#include <mm/vm.h> |
#include <synch/waitq.h> |
#include <arch/arch.h> |
/SPARTAN/trunk/src/mm/frame.c |
---|
115,7 → 115,6 |
frame->refcount++; |
list_remove(tmp); /* remove frame from free_head */ |
list_append(tmp, &zone->busy_head); /* append frame to busy_head */ |
zone->free_count--; |
zone->busy_count++; |
180,7 → 179,6 |
ASSERT(frame->refcount); |
if (!--frame->refcount) { |
list_remove(&frame->link); /* remove frame from busy_head */ |
list_append(&frame->link, &zone->free_head); /* append frame to free_head */ |
zone->free_count++; |
zone->busy_count--; |
195,7 → 193,7 |
/** Mark frame not free. |
* |
* Find respective frame structrue for supplied addr. |
* Increment frame reference count and move the frame structure to busy list. |
* Increment frame reference count and remove the frame structure from free list. |
* |
* @param addr Address of the frame to be marked. It must be a multiple of FRAME_SIZE. |
*/ |
241,7 → 239,6 |
frame->refcount++; |
list_remove(&frame->link); /* remove frame from free_head */ |
list_append(&frame->link, &zone->busy_head); /* append frame to busy_head */ |
zone->free_count--; |
zone->busy_count++; |
} |
313,7 → 310,6 |
list_initialize(&z->free_head); |
z->busy_count = 0; |
list_initialize(&z->busy_head); |
z->frames = (frame_t *) malloc(cnt * sizeof(frame_t)); |
if (!z->frames) { |