Changeset 77147d6 in mainline


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

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • contrib/conf/dot.bochsrc

    r44c259c r77147d6  
    131131# supported on Windows 95 and 98.
    132132#=======================================================================
    133 floppya: 1_44=image.bin, status=inserted
     133floppya: 1_44=image.boot, status=inserted
    134134#floppya: 1_44=/dev/fd0, status=inserted
    135135
  • contrib/conf/simics.conf

    r44c259c r77147d6  
    1313@if not "memory_megs"             in dir(): memory_megs = 256
    1414
    15 @if not "floppy_image"            in dir(): floppy_image = "image.bin"
     15@if not "floppy_image"            in dir(): floppy_image = "image.boot"
    1616@if not "use_voodoo3_pci"         in dir(): use_voodoo3_pci = 1
    1717@if not "use_voodoo3_agp"         in dir(): use_voodoo3_agp = 0
  • generic/include/mm/as.h

    r44c259c r77147d6  
    8383extern as_t * as_create(pte_t *ptl0);
    8484extern as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base);
    85 extern void as_area_load_mapping(as_area_t *a, index_t *pfn);
     85extern void as_area_set_mapping(as_area_t *a, index_t vpn, index_t pfn);
    8686extern int as_page_fault(__address page);
    8787extern void as_install(as_t *m);
  • 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                /*
  • generic/src/mm/as.c

    r44c259c r77147d6  
    143143                         * Frames will be allocated on-demand by
    144144                         * as_page_fault() or preloaded by
    145                          * as_area_load_mapping().
     145                         * as_area_set_mapping().
    146146                         */
    147147                        a->mapping[i] = UNALLOCATED_PFN;
     
    169169 * Initialize a->mapping.
    170170 *
    171  * @param a Target address space area.
    172  * @param pfn Array of frame numbers. Number of elements must match with a->mapping.
    173  */
    174 void as_area_load_mapping(as_area_t *a, index_t *pfn)
    175 {
     171 * @param a   Target address space area.
     172 * @param vpn Page number relative to area start.
     173 * @param pfn Frame number to map.
     174 */
     175void as_area_set_mapping(as_area_t *a, index_t vpn, index_t pfn)
     176{
     177        ASSERT(vpn < a->size);
     178        ASSERT(a->mapping[vpn] == UNALLOCATED_PFN);
     179        ASSERT(pfn != UNALLOCATED_PFN);
     180       
    176181        ipl_t ipl;
    177         int i;
    178182       
    179183        ipl = interrupts_disable();
    180184        spinlock_lock(&a->lock);
    181 
    182         for (i = 0; i < a->size; i++) {
    183                 ASSERT(a->mapping[i] == UNALLOCATED_PFN);
    184                 ASSERT(pfn[i] != UNALLOCATED_PFN);
    185                 a->mapping[i] = pfn[i];
    186         }
     185       
     186        a->mapping[vpn] = pfn;
    187187       
    188188        spinlock_unlock(&a->lock);
     
    254254                area->mapping[vpn] = frame / FRAME_SIZE;
    255255                ASSERT(area->mapping[vpn] != UNALLOCATED_PFN);
    256         } else {
     256        } else
    257257                frame = area->mapping[vpn] * FRAME_SIZE;
    258         }
    259258       
    260259        switch (area->type) {
Note: See TracChangeset for help on using the changeset viewer.