Changeset c23502d in mainline


Ignore:
Timestamp:
2006-03-15T23:54:19Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2d5a54f3
Parents:
649799a
Message:

Support only anonymous address space areas.

Location:
generic
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • generic/include/mm/as.h

    r649799a rc23502d  
    4949#define FLAG_AS_KERNEL      (1 << 0)    /**< Kernel address space. */
    5050
    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
    5455
    5556/** Address space area structure.
     
    6162        SPINLOCK_DECLARE(lock);
    6263        link_t link;
    63         as_area_type_t type;
     64        int flags;
    6465        size_t size;            /**< Size of this area in multiples of PAGE_SIZE. */
    6566        __address base;         /**< Base address of this area. */
     
    104105extern void as_init(void);
    105106extern 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);
     107extern as_area_t *as_area_create(as_t *as, int flags, size_t size, __address base);
    107108extern __address as_remap(as_t *as, __address address, size_t size, int flags);
    108109extern void as_set_mapping(as_t *as, __address page, __address frame);
  • generic/src/lib/elf.c

    r649799a rc23502d  
    156156{
    157157        as_area_t *a;
    158         int i, type = 0;
     158        int i, flags = 0;
    159159        size_t segment_size;
    160160        __u8 *segment;
     
    172172                return EE_MEMORY;
    173173       
    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;
    181180
    182181        /*
     
    195194                segment = ((void *) elf) + entry->p_offset;
    196195
    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);
    198197        if (!a)
    199198                return EE_IRRECOVERABLE;
  • generic/src/mm/as.c

    r649799a rc23502d  
    120120 *
    121121 * @param as Target address space.
    122  * @param type Type of area.
     122 * @param flags Flags of the area.
    123123 * @param size Size of area in multiples of PAGE_SIZE.
    124124 * @param base Base address of area.
     
    126126 * @return Address space area on success or NULL on failure.
    127127 */
    128 as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base)
     128as_area_t *as_area_create(as_t *as, int flags, size_t size, __address base)
    129129{
    130130        ipl_t ipl;
     
    146146       
    147147        link_initialize(&a->link);                     
    148         a->type = type;
     148        a->flags = flags;
    149149        a->size = size;
    150150        a->base = base;
     
    327327        int flags;
    328328
    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;
    340339       
    341340        return flags;
  • generic/src/proc/task.c

    r649799a rc23502d  
    123123         * Create the data as_area.
    124124         */
    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);
    126126       
    127127        thread_ready(t);
Note: See TracChangeset for help on using the changeset viewer.