Rev 824 | Rev 946 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 824 | Rev 852 | ||
---|---|---|---|
Line 134... | Line 134... | ||
134 | ipl = interrupts_disable(); |
134 | ipl = interrupts_disable(); |
135 | spinlock_lock(&zones.lock); |
135 | spinlock_lock(&zones.lock); |
136 | /* Try to merge */ |
136 | /* Try to merge */ |
137 | if (zones.count+1 == ZONES_MAX) |
137 | if (zones.count+1 == ZONES_MAX) |
138 | panic("Maximum zone(%d) count exceeded.", ZONES_MAX); |
138 | panic("Maximum zone(%d) count exceeded.", ZONES_MAX); |
139 | - | ||
140 | for (i=0; i < zones.count; i++) { |
139 | for (i=0; i < zones.count; i++) { |
141 | /* Check for overflow */ |
140 | /* Check for overflow */ |
142 | z = zones.info[zones.count]; |
141 | z = zones.info[i]; |
143 | if (overlaps(newzone->base,newzone->count, |
142 | if (overlaps(newzone->base,newzone->count, |
144 | z->base, z->count)) { |
143 | z->base, z->count)) { |
145 | printf("Zones overlap!\n"); |
144 | printf("Zones overlap!\n"); |
146 | return -1; |
145 | return -1; |
147 | } |
146 | } |
148 | if (z->base < newzone->base) |
147 | if (newzone->base < z->base) |
149 | break; |
148 | break; |
150 | } |
149 | } |
151 | /* Move other zones up */ |
150 | /* Move other zones up */ |
152 | for (j=i;j < zones.count;j++) |
151 | for (j=i;j < zones.count;j++) |
153 | zones.info[j+1] = zones.info[j]; |
152 | zones.info[j+1] = zones.info[j]; |
154 | - | ||
155 | zones.info[i] = newzone; |
153 | zones.info[i] = newzone; |
156 | zones.count++; |
154 | zones.count++; |
157 | - | ||
158 | spinlock_unlock(&zones.lock); |
155 | spinlock_unlock(&zones.lock); |
159 | interrupts_restore(ipl); |
156 | interrupts_restore(ipl); |
160 | 157 | ||
161 | return i; |
158 | return i; |
162 | } |
159 | } |
Line 841... | Line 838... | ||
841 | /* If confdata in zone, mark as unavailable */ |
838 | /* If confdata in zone, mark as unavailable */ |
842 | if (confframe >= start && confframe < start+count) |
839 | if (confframe >= start && confframe < start+count) |
843 | for (i=confframe; i<confframe+confcount; i++) { |
840 | for (i=confframe; i<confframe+confcount; i++) { |
844 | zone_mark_unavailable(z, i - z->base); |
841 | zone_mark_unavailable(z, i - z->base); |
845 | } |
842 | } |
846 | - | ||
847 | return znum; |
843 | return znum; |
848 | } |
844 | } |
849 | 845 | ||
850 | /***************************************/ |
846 | /***************************************/ |
851 | /* Frame functions */ |
847 | /* Frame functions */ |
Line 993... | Line 989... | ||
993 | spinlock_initialize(&zones.lock,"zones_glob_lock"); |
989 | spinlock_initialize(&zones.lock,"zones_glob_lock"); |
994 | } |
990 | } |
995 | /* Tell the architecture to create some memory */ |
991 | /* Tell the architecture to create some memory */ |
996 | frame_arch_init(); |
992 | frame_arch_init(); |
997 | if (config.cpu_active == 1) { |
993 | if (config.cpu_active == 1) { |
998 | frame_mark_unavailable(ADDR2PFN(KA2PA(config.base)), |
994 | pfn_t firstframe = ADDR2PFN(KA2PA(config.base)); |
999 | SIZE2FRAMES(config.kernel_size)); |
995 | pfn_t lastframe = ADDR2PFN(KA2PA(config.base+config.kernel_size)); |
- | 996 | frame_mark_unavailable(firstframe,lastframe-firstframe+1); |
|
1000 | if (config.init_size > 0) |
997 | if (config.init_size > 0) |
1001 | frame_mark_unavailable(ADDR2PFN(KA2PA(config.init_addr)), |
998 | frame_mark_unavailable(ADDR2PFN(KA2PA(config.init_addr)), |
1002 | SIZE2FRAMES(config.init_size)); |
999 | SIZE2FRAMES(config.init_size)); |
1003 | } |
1000 | } |
1004 | } |
1001 | } |