Changeset 77147d6 in mainline for generic/src/main/kinit.c


Ignore:
Timestamp:
2006-01-15T21:16:06Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d2ab23
Parents:
44c259c
Message:

interface change: as_area_load_mapping → as_area_set_mapping (set single page mapping)
map init directly from the physical frames it is loaded in

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/main/kinit.c

    r44c259c r77147d6  
    7272        as_t *as;
    7373        as_area_t *a;
    74         __address frame;
    75         index_t pfn[1];
     74        index_t frame, frames;
     75        index_t pfn;
    7676        task_t *u;
    7777
     
    134134        if ((t = thread_create(kconsole, "kconsole", TASK, 0)))
    135135                thread_ready(t);
    136         else panic("thread_create/kconsole\n");
     136        else
     137                panic("thread_create/kconsole\n");
    137138
    138139        interrupts_enable();
     
    142143                 * Create the first user task.
    143144                 */
     145               
     146                if (KA2PA(config.init_addr) % FRAME_SIZE)
     147                        panic("config.init_addr is not frame aligned");
     148               
    144149                as = as_create(NULL);
    145150                if (!as)
     
    154159                /*
    155160                 * Create the text as_area and copy the userspace code there.
    156                  */     
    157                 a = as_area_create(as, AS_AREA_TEXT, 1, UTEXT_ADDRESS);
     161                 */
     162               
     163                frame = KA2PA(config.init_addr) / FRAME_SIZE;
     164                frames = config.init_size / FRAME_SIZE;
     165                if (config.init_size % FRAME_SIZE > 0)
     166                        frames++;
     167               
     168                a = as_area_create(as, AS_AREA_TEXT, frames, UTEXT_ADDRESS);
    158169                if (!a)
    159170                        panic("as_area_create: text\n");
    160171               
    161                 // FIXME: Better way to initialize static code/data
    162                 frame = frame_alloc(0, ONE_FRAME, NULL);
    163                 memcpy((void *) PA2KA(frame), (void *) config.init_addr, config.init_size < PAGE_SIZE ? config.init_size : PAGE_SIZE);
    164                
    165                 pfn[0] = frame / FRAME_SIZE;
    166                 as_area_load_mapping(a, pfn);
     172                for (pfn = 0; pfn < frames; pfn++)
     173                        as_area_set_mapping(a, pfn, frame + pfn);
    167174       
    168175                /*
Note: See TracChangeset for help on using the changeset viewer.