Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 373 → Rev 372

/SPARTAN/trunk/src/main/main.c
35,8 → 35,10
#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>
46,12 → 48,9
#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,6 → 115,7
 
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++;
179,6 → 180,7
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--;
193,7 → 195,7
/** Mark frame not free.
*
* Find respective frame structrue for supplied addr.
* Increment frame reference count and remove the frame structure from free list.
* Increment frame reference count and move the frame structure to busy list.
*
* @param addr Address of the frame to be marked. It must be a multiple of FRAME_SIZE.
*/
239,6 → 241,7
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++;
}
310,6 → 313,7
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) {
/SPARTAN/trunk/include/mm/frame.h
44,15 → 44,16
__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 not in free list */
count_t busy_count; /**< number of frame_t structures in busy list */
int flags;
};
 
struct frame {
count_t refcount; /**< when == 0, the frame is in free list */
link_t link; /**< link to zone free list when refcount == 0 */
} __attribute__ ((packed));
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 */
};
 
extern spinlock_t zone_head_lock; /**< this lock protects zone_head list */
extern link_t zone_head; /**< list of all zones in the system */