Rev 1224 | Rev 1248 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1224 | Rev 1236 | ||
---|---|---|---|
Line 942... | Line 942... | ||
942 | return v; |
942 | return v; |
943 | } |
943 | } |
944 | 944 | ||
945 | /** Free a frame. |
945 | /** Free a frame. |
946 | * |
946 | * |
947 | * Find respective frame structure for supplied addr. |
947 | * Find respective frame structure for supplied PFN. |
948 | * Decrement frame reference count. |
948 | * Decrement frame reference count. |
949 | * If it drops to zero, move the frame structure to free list. |
949 | * If it drops to zero, move the frame structure to free list. |
950 | * |
950 | * |
951 | * @param frame Frame no to be freed. |
951 | * @param frame Frame number to be freed. |
952 | */ |
952 | */ |
953 | void frame_free(pfn_t pfn) |
953 | void frame_free(pfn_t pfn) |
954 | { |
954 | { |
955 | ipl_t ipl; |
955 | ipl_t ipl; |
956 | zone_t *zone; |
956 | zone_t *zone; |
Line 967... | Line 967... | ||
967 | 967 | ||
968 | spinlock_unlock(&zone->lock); |
968 | spinlock_unlock(&zone->lock); |
969 | interrupts_restore(ipl); |
969 | interrupts_restore(ipl); |
970 | } |
970 | } |
971 | 971 | ||
- | 972 | /** Add reference to frame. |
|
- | 973 | * |
|
- | 974 | * Find respective frame structure for supplied PFN and |
|
- | 975 | * increment frame reference count. |
|
- | 976 | * |
|
- | 977 | * @param frame Frame no to be freed. |
|
- | 978 | */ |
|
- | 979 | void frame_reference_add(pfn_t pfn) |
|
- | 980 | { |
|
- | 981 | ipl_t ipl; |
|
- | 982 | zone_t *zone; |
|
- | 983 | frame_t *frame; |
|
- | 984 | ||
- | 985 | ipl = interrupts_disable(); |
|
972 | 986 | ||
- | 987 | /* |
|
- | 988 | * First, find host frame zone for addr. |
|
- | 989 | */ |
|
- | 990 | zone = find_zone_and_lock(pfn,NULL); |
|
- | 991 | ASSERT(zone); |
|
- | 992 | ||
- | 993 | frame = &zone->frames[pfn-zone->base]; |
|
- | 994 | frame->refcount++; |
|
- | 995 | ||
- | 996 | spinlock_unlock(&zone->lock); |
|
- | 997 | interrupts_restore(ipl); |
|
- | 998 | } |
|
973 | 999 | ||
974 | /** Mark given range unavailable in frame zones */ |
1000 | /** Mark given range unavailable in frame zones */ |
975 | void frame_mark_unavailable(pfn_t start, count_t count) |
1001 | void frame_mark_unavailable(pfn_t start, count_t count) |
976 | { |
1002 | { |
977 | int i; |
1003 | int i; |