Changeset 4841104 in mainline
- Timestamp:
- 2005-09-23T20:44:35Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- adecf496
- Parents:
- 23443b2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
include/mm/frame.h
r23443b2 r4841104 45 45 frame_t *frames; /**< array of frame_t structures in this zone */ 46 46 link_t free_head; /**< list of free frame_t structures */ 47 link_t busy_head; /**< list of busy frame_t structures */48 47 count_t free_count; /**< number of frame_t structures in free list */ 49 count_t busy_count; /**< number of frame_t structures in busylist */48 count_t busy_count; /**< number of frame_t structures not in free list */ 50 49 int flags; 51 50 }; 52 51 53 52 struct frame { 54 count_t refcount; /**< when > 0, the frame is in busy list, otherwisethe frame is in free list */55 link_t link; /**< link either to frame_zone free or busy list*/56 } ;53 count_t refcount; /**< when == 0, the frame is in free list */ 54 link_t link; /**< link to zone free list when refcount == 0 */ 55 } __attribute__ ((packed)); 57 56 58 57 extern spinlock_t zone_head_lock; /**< this lock protects zone_head list */ -
src/main/main.c
r23443b2 r4841104 36 36 #include <proc/thread.h> 37 37 #include <proc/task.h> 38 #include <mm/vm.h>39 38 #include <main/kinit.h> 40 39 #include <cpu.h> 41 #include <mm/heap.h>42 40 43 41 #ifdef __SMP__ … … 49 47 50 48 #include <arch/mm/memory_init.h> 49 #include <mm/heap.h> 51 50 #include <mm/frame.h> 52 51 #include <mm/page.h> 53 52 #include <mm/tlb.h> 53 #include <mm/vm.h> 54 54 55 #include <synch/waitq.h> 55 56 -
src/mm/frame.c
r23443b2 r4841104 116 116 frame->refcount++; 117 117 list_remove(tmp); /* remove frame from free_head */ 118 list_append(tmp, &zone->busy_head); /* append frame to busy_head */119 118 zone->free_count--; 120 119 zone->busy_count++; … … 181 180 182 181 if (!--frame->refcount) { 183 list_remove(&frame->link); /* remove frame from busy_head */184 182 list_append(&frame->link, &zone->free_head); /* append frame to free_head */ 185 183 zone->free_count++; … … 196 194 * 197 195 * Find respective frame structrue for supplied addr. 198 * Increment frame reference count and move the frame structure to busylist.196 * Increment frame reference count and remove the frame structure from free list. 199 197 * 200 198 * @param addr Address of the frame to be marked. It must be a multiple of FRAME_SIZE. … … 242 240 243 241 list_remove(&frame->link); /* remove frame from free_head */ 244 list_append(&frame->link, &zone->busy_head); /* append frame to busy_head */245 242 zone->free_count--; 246 243 zone->busy_count++; … … 314 311 315 312 z->busy_count = 0; 316 list_initialize(&z->busy_head);317 313 318 314 z->frames = (frame_t *) malloc(cnt * sizeof(frame_t));
Note:
See TracChangeset
for help on using the changeset viewer.