Rev 2725 | Rev 3185 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2725 | Rev 2745 | ||
---|---|---|---|
Line 118... | Line 118... | ||
118 | return (index_t) (frame - zone->frames) + zone->base; |
118 | return (index_t) (frame - zone->frames) + zone->base; |
119 | } |
119 | } |
120 | 120 | ||
121 | static inline int frame_index_valid(zone_t *zone, index_t index) |
121 | static inline int frame_index_valid(zone_t *zone, index_t index) |
122 | { |
122 | { |
123 | return (index >= 0) && (index < zone->count); |
123 | return (index < zone->count); |
124 | } |
124 | } |
125 | 125 | ||
126 | /** Compute pfn_t from frame_t pointer & zone pointer */ |
126 | /** Compute pfn_t from frame_t pointer & zone pointer */ |
127 | static index_t make_frame_index(zone_t *zone, frame_t *frame) |
127 | static index_t make_frame_index(zone_t *zone, frame_t *frame) |
128 | { |
128 | { |
Line 208... | Line 208... | ||
208 | unsigned int hint = pzone ? *pzone : 0; |
208 | unsigned int hint = pzone ? *pzone : 0; |
209 | zone_t *z; |
209 | zone_t *z; |
210 | 210 | ||
211 | spinlock_lock(&zones.lock); |
211 | spinlock_lock(&zones.lock); |
212 | 212 | ||
213 | if (hint >= zones.count || hint < 0) |
213 | if (hint >= zones.count) |
214 | hint = 0; |
214 | hint = 0; |
215 | 215 | ||
216 | i = hint; |
216 | i = hint; |
217 | do { |
217 | do { |
218 | z = zones.info[i]; |
218 | z = zones.info[i]; |
Line 717... | Line 717... | ||
717 | pfn_t pfn; |
717 | pfn_t pfn; |
718 | 718 | ||
719 | ipl = interrupts_disable(); |
719 | ipl = interrupts_disable(); |
720 | spinlock_lock(&zones.lock); |
720 | spinlock_lock(&zones.lock); |
721 | 721 | ||
722 | if (z1 < 0 || z1 >= zones.count || z2 < 0 || z2 >= zones.count) |
722 | if ((z1 >= zones.count) || (z2 >= zones.count)) |
723 | goto errout; |
723 | goto errout; |
724 | /* We can join only 2 zones with none existing inbetween */ |
724 | /* We can join only 2 zones with none existing inbetween */ |
725 | if (z2-z1 != 1) |
725 | if (z2-z1 != 1) |
726 | goto errout; |
726 | goto errout; |
727 | 727 |