Changeset c23502d in mainline
- Timestamp:
- 2006-03-15T23:54:19Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2d5a54f3
- Parents:
- 649799a
- Location:
- generic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/include/mm/as.h
r649799a rc23502d 49 49 #define FLAG_AS_KERNEL (1 << 0) /**< Kernel address space. */ 50 50 51 enum as_area_type { 52 AS_AREA_TEXT = 1, AS_AREA_DATA, AS_AREA_STACK 53 }; 51 /** Address space area flags. */ 52 #define AS_AREA_READ 1 53 #define AS_AREA_WRITE 2 54 #define AS_AREA_EXEC 4 54 55 55 56 /** Address space area structure. … … 61 62 SPINLOCK_DECLARE(lock); 62 63 link_t link; 63 as_area_type_t type;64 int flags; 64 65 size_t size; /**< Size of this area in multiples of PAGE_SIZE. */ 65 66 __address base; /**< Base address of this area. */ … … 104 105 extern void as_init(void); 105 106 extern as_t *as_create(int flags); 106 extern as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base);107 extern as_area_t *as_area_create(as_t *as, int flags, size_t size, __address base); 107 108 extern __address as_remap(as_t *as, __address address, size_t size, int flags); 108 109 extern void as_set_mapping(as_t *as, __address page, __address frame); -
generic/src/lib/elf.c
r649799a rc23502d 156 156 { 157 157 as_area_t *a; 158 int i, type= 0;158 int i, flags = 0; 159 159 size_t segment_size; 160 160 __u8 *segment; … … 172 172 return EE_MEMORY; 173 173 174 if (entry->p_flags & PF_X) { 175 type = AS_AREA_TEXT; 176 } else if (entry->p_flags & PF_W) { 177 type = AS_AREA_DATA; 178 } else { 179 return EE_UNSUPPORTED; 180 } 174 if (entry->p_flags & PF_X) 175 flags |= AS_AREA_EXEC; 176 if (entry->p_flags & PF_W) 177 flags |= AS_AREA_WRITE; 178 if (entry->p_flags & PF_R) 179 flags |= AS_AREA_READ; 181 180 182 181 /* … … 195 194 segment = ((void *) elf) + entry->p_offset; 196 195 197 a = as_area_create(as, type, SIZE2FRAMES(entry->p_memsz), entry->p_vaddr);196 a = as_area_create(as, flags, SIZE2FRAMES(entry->p_memsz), entry->p_vaddr); 198 197 if (!a) 199 198 return EE_IRRECOVERABLE; -
generic/src/mm/as.c
r649799a rc23502d 120 120 * 121 121 * @param as Target address space. 122 * @param type Type ofarea.122 * @param flags Flags of the area. 123 123 * @param size Size of area in multiples of PAGE_SIZE. 124 124 * @param base Base address of area. … … 126 126 * @return Address space area on success or NULL on failure. 127 127 */ 128 as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base)128 as_area_t *as_area_create(as_t *as, int flags, size_t size, __address base) 129 129 { 130 130 ipl_t ipl; … … 146 146 147 147 link_initialize(&a->link); 148 a-> type = type;148 a->flags = flags; 149 149 a->size = size; 150 150 a->base = base; … … 327 327 int flags; 328 328 329 switch (a->type) { 330 case AS_AREA_TEXT: 331 flags = PAGE_EXEC | PAGE_READ | PAGE_USER | PAGE_PRESENT | PAGE_CACHEABLE; 332 break; 333 case AS_AREA_DATA: 334 case AS_AREA_STACK: 335 flags = PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_PRESENT | PAGE_CACHEABLE; 336 break; 337 default: 338 panic("unexpected as_area_type_t %d", a->type); 339 } 329 flags = PAGE_USER | PAGE_PRESENT | PAGE_CACHEABLE; 330 331 if (a->flags & AS_AREA_READ) 332 flags |= PAGE_READ; 333 334 if (a->flags & AS_AREA_WRITE) 335 flags |= PAGE_WRITE; 336 337 if (a->flags & AS_AREA_EXEC) 338 flags |= PAGE_EXEC; 340 339 341 340 return flags; -
generic/src/proc/task.c
r649799a rc23502d 123 123 * Create the data as_area. 124 124 */ 125 a = as_area_create(as, AS_AREA_ STACK, 1, USTACK_ADDRESS);125 a = as_area_create(as, AS_AREA_READ | AS_AREA_WRITE, 1, USTACK_ADDRESS); 126 126 127 127 thread_ready(t);
Note:
See TracChangeset
for help on using the changeset viewer.