Changeset 80d301ab in mainline for kernel/arch/ia32/src/mm/page.c


Ignore:
Timestamp:
2011-11-17T12:45:37Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9d4e170
Parents:
ce940da
Message:

Add amd64 and ia32 support for frame_low/high_arch_init().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/mm/page.c

    rce940da r80d301ab  
    4949#include <print.h>
    5050#include <interrupt.h>
     51#include <macros.h>
    5152
    5253void page_arch_init(void)
     
    5556        int flags;
    5657       
    57         if (config.cpu_active == 1) {
    58                 page_mapping_operations = &pt_mapping_operations;
     58        if (config.cpu_active > 1) {
     59                /* Fast path for non-boot CPUs */
     60                write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
     61                paging_on();
     62                return;
     63        }
     64
     65        page_mapping_operations = &pt_mapping_operations;
    5966       
    60                 /*
    61                  * PA2KA(identity) mapping for all frames until last_frame.
    62                  */
    63                 page_table_lock(AS_KERNEL, true);
    64                 for (cur = 0; cur < last_frame; cur += FRAME_SIZE) {
    65                         flags = PAGE_CACHEABLE | PAGE_WRITE;
    66                         if ((PA2KA(cur) >= config.base) && (PA2KA(cur) < config.base + config.kernel_size))
    67                                 flags |= PAGE_GLOBAL;
    68                         page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
    69                 }
    70                 page_table_unlock(AS_KERNEL, true);
     67        /*
     68         * PA2KA(identity) mapping for all frames until last_frame.
     69         */
     70        page_table_lock(AS_KERNEL, true);
     71        for (cur = 0; cur < min(config.identity_size, last_frame);
     72            cur += FRAME_SIZE) {
     73                flags = PAGE_CACHEABLE | PAGE_WRITE;
     74                if ((PA2KA(cur) >= config.base) && (PA2KA(cur) <
     75                    config.base + config.kernel_size))
     76                        flags |= PAGE_GLOBAL;
     77                page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
     78        }
     79        page_table_unlock(AS_KERNEL, true);
    7180               
    72                 exc_register(14, "page_fault", true, (iroutine_t) page_fault);
    73                 write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
    74         } else
    75                 write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
     81        exc_register(14, "page_fault", true, (iroutine_t) page_fault);
     82        write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
    7683       
    7784        paging_on();
Note: See TracChangeset for help on using the changeset viewer.