Changeset 2e9eae2 in mainline for generic/src
- Timestamp:
- 2006-06-23T16:03:53Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 757551a3
- Parents:
- a832dd7
- Location:
- generic/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/console/klog.c
ra832dd7 r2e9eae2 59 59 void *faddr; 60 60 61 faddr = (void *)PFN2ADDR(frame_alloc(KLOG_ORDER, FRAME_ATOMIC));61 faddr = frame_alloc(KLOG_ORDER, FRAME_ATOMIC); 62 62 if (!faddr) 63 63 panic("Cannot allocate page for klog"); -
generic/src/cpu/cpu.c
ra832dd7 r2e9eae2 72 72 73 73 for (i=0; i < config.cpu_count; i++) { 74 cpus[i].stack = (__u8 *) PA2KA(PFN2ADDR(frame_alloc(STACK_FRAMES, FRAME_KA | FRAME_PANIC)));74 cpus[i].stack = (__u8 *) frame_alloc(STACK_FRAMES, FRAME_KA | FRAME_PANIC); 75 75 76 76 cpus[i].id = i; -
generic/src/mm/as.c
ra832dd7 r2e9eae2 1497 1497 node = list_get_instance(cur, btree_node_t, leaf_link); 1498 1498 for (i = 0; i < node->keys; i++) 1499 frame_free( ADDR2PFN((__address) node->value[i]));1499 frame_free((__address) node->value[i]); 1500 1500 } 1501 1501 -
generic/src/mm/backend_anon.c
ra832dd7 r2e9eae2 106 106 } 107 107 if (allocate) { 108 frame = PFN2ADDR(frame_alloc(ONE_FRAME, 0));108 frame = (__address) frame_alloc(ONE_FRAME, 0); 109 109 memsetb(PA2KA(frame), FRAME_SIZE, 0); 110 110 … … 133 133 * the different causes 134 134 */ 135 frame = PFN2ADDR(frame_alloc(ONE_FRAME, 0));135 frame = (__address)frame_alloc(ONE_FRAME, 0); 136 136 memsetb(PA2KA(frame), FRAME_SIZE, 0); 137 137 } … … 159 159 void anon_frame_free(as_area_t *area, __address page, __address frame) 160 160 { 161 frame_free( ADDR2PFN(frame));161 frame_free(frame); 162 162 } 163 163 -
generic/src/mm/backend_elf.c
ra832dd7 r2e9eae2 135 135 */ 136 136 if (entry->p_flags & PF_W) { 137 frame = PFN2ADDR(frame_alloc(ONE_FRAME, 0));137 frame = (__address)frame_alloc(ONE_FRAME, 0); 138 138 memcpy((void *) PA2KA(frame), (void *) (base + i*FRAME_SIZE), FRAME_SIZE); 139 139 … … 154 154 * and cleared. 155 155 */ 156 frame = PFN2ADDR(frame_alloc(ONE_FRAME, 0));156 frame = (__address)frame_alloc(ONE_FRAME, 0); 157 157 memsetb(PA2KA(frame), FRAME_SIZE, 0); 158 158 … … 171 171 */ 172 172 size = entry->p_filesz - (i<<PAGE_WIDTH); 173 frame = PFN2ADDR(frame_alloc(ONE_FRAME, 0));173 frame = (__address)frame_alloc(ONE_FRAME, 0); 174 174 memsetb(PA2KA(frame) + size, FRAME_SIZE - size, 0); 175 175 memcpy((void *) PA2KA(frame), (void *) (base + i*FRAME_SIZE), size); … … 219 219 * Free the frame with the copy of writable segment data. 220 220 */ 221 frame_free( ADDR2PFN(frame));221 frame_free(frame); 222 222 } 223 223 } else { … … 227 227 * In any case, a frame needs to be freed. 228 228 */ 229 frame_free( ADDR2PFN(frame));229 frame_free(frame); 230 230 } 231 231 } -
generic/src/mm/frame.c
ra832dd7 r2e9eae2 929 929 * @param pzone Preferred zone 930 930 * 931 * @return Allocated frame.932 * 933 */ 934 pfn_tframe_alloc_generic(__u8 order, int flags, int *status, int *pzone)931 * @return Physical address of the allocated frame. 932 * 933 */ 934 void * frame_alloc_generic(__u8 order, int flags, int *status, int *pzone) 935 935 { 936 936 ipl_t ipl; … … 972 972 if (status) 973 973 *status = FRAME_NO_MEMORY; 974 return NULL;974 return 0; 975 975 } 976 976 … … 987 987 if (status) 988 988 *status = FRAME_OK; 989 return v; 989 990 if (flags & FRAME_KA) 991 return (void *)PA2KA(PFN2ADDR(v)); 992 return (void *)PFN2ADDR(v); 990 993 } 991 994 … … 996 999 * If it drops to zero, move the frame structure to free list. 997 1000 * 998 * @param pfn Frame numberof the frame to be freed.999 */ 1000 void frame_free( pfn_t pfn)1001 * @param Frame Physical Address of of the frame to be freed. 1002 */ 1003 void frame_free(__address frame) 1001 1004 { 1002 1005 ipl_t ipl; 1003 1006 zone_t *zone; 1007 pfn_t pfn = ADDR2PFN(frame); 1004 1008 1005 1009 ipl = interrupts_disable(); -
generic/src/mm/slab.c
ra832dd7 r2e9eae2 163 163 int i; 164 164 int status; 165 pfn_t pfn;166 165 int zone=0; 167 166 168 pfn = frame_alloc_rc_zone(cache->order, FRAME_KA | flags, &status, &zone); 169 data = (void *) PA2KA(PFN2ADDR(pfn)); 167 data = frame_alloc_rc_zone(cache->order, FRAME_KA | flags, &status, &zone); 170 168 if (status != FRAME_OK) { 171 169 return NULL; … … 174 172 slab = slab_alloc(slab_extern_cache, flags); 175 173 if (!slab) { 176 frame_free( ADDR2PFN(KA2PA(data)));174 frame_free(KA2PA(data)); 177 175 return NULL; 178 176 } … … 184 182 /* Fill in slab structures */ 185 183 for (i=0; i < (1 << cache->order); i++) 186 frame_set_parent( pfn+i, slab, zone);184 frame_set_parent(ADDR2PFN(KA2PA(data))+i, slab, zone); 187 185 188 186 slab->start = data; … … 205 203 static count_t slab_space_free(slab_cache_t *cache, slab_t *slab) 206 204 { 207 frame_free( ADDR2PFN(KA2PA(slab->start)));205 frame_free(KA2PA(slab->start)); 208 206 if (! (cache->flags & SLAB_CACHE_SLINSIDE)) 209 207 slab_free(slab_extern_cache, slab); -
generic/src/proc/thread.c
ra832dd7 r2e9eae2 125 125 { 126 126 thread_t *t = (thread_t *)obj; 127 pfn_t pfn;128 127 int status; 129 128 … … 143 142 #endif 144 143 145 pfn= frame_alloc_rc(STACK_FRAMES, FRAME_KA | kmflags,&status);144 t->kstack = frame_alloc_rc(STACK_FRAMES, FRAME_KA | kmflags,&status); 146 145 if (status) { 147 146 #ifdef ARCH_HAS_FPU … … 151 150 return -1; 152 151 } 153 t->kstack = (__u8 *)PA2KA(PFN2ADDR(pfn));154 152 155 153 return 0; … … 161 159 thread_t *t = (thread_t *)obj; 162 160 163 frame_free( ADDR2PFN(KA2PA(t->kstack)));161 frame_free(KA2PA(t->kstack)); 164 162 #ifdef ARCH_HAS_FPU 165 163 if (t->saved_fpu_context) -
generic/src/time/clock.c
ra832dd7 r2e9eae2 80 80 void *faddr; 81 81 82 faddr = (void *)PFN2ADDR(frame_alloc(0, FRAME_ATOMIC));82 faddr = frame_alloc(0, FRAME_ATOMIC); 83 83 if (!faddr) 84 84 panic("Cannot allocate page for clock");
Note:
See TracChangeset
for help on using the changeset viewer.