Changeset fc1e4f6 in mainline


Ignore:
Timestamp:
2006-01-31T00:44:08Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ef67bab
Parents:
6a3c9a7
Message:

Change page_mapping_find/insert interfaces to take as_t * as first argument
and not asid_t as second argument. This change was necessitated by the
removal of mapping array from as_area_t and the fact that an address
space doesn't have an ASID when it is created.

Files:
15 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/src/mm/page.c

    r6a3c9a7 rfc1e4f6  
    3232#include <mm/page.h>
    3333#include <mm/frame.h>
    34 #include <mm/asid.h>
     34#include <mm/as.h>
    3535#include <arch/interrupt.h>
    3636#include <arch/asm.h>
     
    5858                 */
    5959                for (cur = 0; cur < last_frame; cur += FRAME_SIZE) {
    60                         page_mapping_insert(PA2KA(cur), ASID_KERNEL, cur, PAGE_CACHEABLE | PAGE_EXEC, KA2PA(dba));
     60                        page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, PAGE_CACHEABLE | PAGE_EXEC, KA2PA(dba));
    6161                }
    6262
  • arch/ia32/src/drivers/ega.c

    r6a3c9a7 rfc1e4f6  
    3030#include <putchar.h>
    3131#include <mm/page.h>
    32 #include <mm/asid.h>
     32#include <mm/as.h>
    3333#include <arch/mm/page.h>
    3434#include <synch/spinlock.h>
     
    6060        __u8 hi, lo;
    6161
    62         page_mapping_insert(PA2KA(VIDEORAM), ASID_KERNEL, VIDEORAM, PAGE_NOT_CACHEABLE, 0);
     62        page_mapping_insert(AS_KERNEL, PA2KA(VIDEORAM), VIDEORAM, PAGE_NOT_CACHEABLE, 0);
    6363        outb(0x3d4,0xe);
    6464        hi = inb(0x3d5);
  • arch/ia32/src/mm/page.c

    r6a3c9a7 rfc1e4f6  
    3232#include <mm/frame.h>
    3333#include <mm/page.h>
    34 #include <mm/asid.h>
     34#include <mm/as.h>
    3535#include <arch/types.h>
    3636#include <config.h>
     
    6262                 */
    6363                for (cur = 0; cur < last_frame; cur += FRAME_SIZE)
    64                         page_mapping_insert(PA2KA(cur), ASID_KERNEL, cur, PAGE_CACHEABLE, KA2PA(dba));
     64                        page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, PAGE_CACHEABLE, KA2PA(dba));
    6565
    6666                exc_register(14, "page_fault", page_fault);
  • arch/ia32/src/smp/smp.c

    r6a3c9a7 rfc1e4f6  
    4545#include <mm/page.h>
    4646#include <mm/heap.h>
    47 #include <mm/asid.h>
     47#include <mm/as.h>
    4848#include <print.h>
    4949#include <memstr.h>
     
    6666
    6767        if (config.cpu_count > 1) {             
    68                 page_mapping_insert((__address)l_apic, ASID_KERNEL, (__address)l_apic,
     68                page_mapping_insert(AS_KERNEL, (__address) l_apic, (__address) l_apic,
    6969                                  PAGE_NOT_CACHEABLE, 0);
    70                 page_mapping_insert((__address) io_apic, ASID_KERNEL,
    71                                   (__address) io_apic,
     70                page_mapping_insert(AS_KERNEL, (__address) io_apic, (__address) io_apic,
    7271                                  PAGE_NOT_CACHEABLE, 0);
    7372        }
  • arch/mips32/src/mm/tlb.c

    r6a3c9a7 rfc1e4f6  
    340340         * Check if the mapping exists in page tables.
    341341         */     
    342         pte = page_mapping_find(badvaddr, AS->asid, 0);
     342        pte = page_mapping_find(AS, badvaddr, 0);
    343343        if (pte && pte->lo.v) {
    344344                /*
     
    357357                         * The mapping ought to be in place.
    358358                         */
    359                         pte = page_mapping_find(badvaddr, AS->asid, 0);
     359                        pte = page_mapping_find(AS, badvaddr, 0);
    360360                        ASSERT(pte && pte->lo.v);
    361361                        return pte;
  • genarch/include/mm/page_pt.h

    r6a3c9a7 rfc1e4f6  
    8888extern page_operations_t page_pt_operations;
    8989
    90 extern void page_mapping_insert_pt(__address page, __address frame, int flags, __address root);
    91 extern pte_t *page_mapping_find_pt(__address page, __address root);
     90extern void page_mapping_insert_pt(as_t *as, __address page, __address frame, int flags, __address root);
     91extern pte_t *page_mapping_find_pt(as_t *as, __address page, __address root);
    9292
    9393#endif
  • genarch/src/acpi/acpi.c

    r6a3c9a7 rfc1e4f6  
    3030#include <genarch/acpi/madt.h>
    3131#include <arch/bios/bios.h>
    32 #include <mm/asid.h>
     32#include <mm/as.h>
    3333#include <mm/page.h>
    3434#include <print.h>
     
    8080static void map_sdt(struct acpi_sdt_header *sdt)
    8181{
    82         page_mapping_insert((__address) sdt, ASID_KERNEL, (__address) sdt, PAGE_NOT_CACHEABLE, 0);
     82        page_mapping_insert(AS_KERNEL, (__address) sdt, (__address) sdt, PAGE_NOT_CACHEABLE, 0);
    8383        map_structure((__address) sdt, sdt->length);
    8484}
  • genarch/src/mm/page_ht.c

    r6a3c9a7 rfc1e4f6  
    3131#include <mm/frame.h>
    3232#include <mm/heap.h>
     33#include <mm/as.h>
    3334#include <arch/mm/asid.h>
    3435#include <arch/types.h>
     
    5354pte_t *page_ht = NULL;
    5455
    55 static void ht_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root);
    56 static pte_t *ht_mapping_find(__address page, asid_t asid, __address root);
     56static void ht_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root);
     57static pte_t *ht_mapping_find(as_t *as, __address page, __address root);
    5758
    5859page_operations_t page_ht_operations = {
     
    6869 * chain.
    6970 *
     71 * @param as Address space to which page belongs. Must be locked prior the call.
    7072 * @param page Virtual address of the page to be mapped.
    71  * @param asid Address space to which page belongs.
    7273 * @param frame Physical address of memory frame to which the mapping is done.
    7374 * @param flags Flags to be used for mapping.
    7475 * @param root Ignored.
    7576 */
    76 void ht_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root)
     77void ht_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root)
    7778{
    7879        pte_t *t, *u;
     
    8182        ipl = interrupts_disable();
    8283        spinlock_lock(&page_ht_lock);
    83        
    84         t = HT_HASH(page, asid);
     84
     85        t = HT_HASH(page, as->asid);
    8586        if (!HT_SLOT_EMPTY(t)) {
    8687       
     
    9293                do {
    9394                        u = t;
    94                         if (HT_COMPARE(page, asid, t)) {
     95                        if (HT_COMPARE(page, as->asid, t)) {
    9596                                /*
    9697                                 * Nothing to do,
     
    110111        }
    111112       
    112         HT_SET_RECORD(t, page, asid, frame, flags);
     113        HT_SET_RECORD(t, page, as->asid, frame, flags);
    113114        HT_SET_NEXT(t, NULL);
    114115       
     
    123124 * Interrupts must be disabled.
    124125 *
     126 * @param as Address space to wich page belongs. Must be locked prior the call.
    125127 * @param page Virtual page.
    126  * @param asid Address space to wich page belongs.
    127128 * @param root Ignored.
    128129 *
    129130 * @return NULL if there is no such mapping; requested mapping otherwise.
    130131 */
    131 pte_t *ht_mapping_find(__address page, asid_t asid, __address root)
     132pte_t *ht_mapping_find(as_t *as, __address page, __address root)
    132133{
    133134        pte_t *t;
    134135       
    135136        spinlock_lock(&page_ht_lock);
    136         t = HT_HASH(page, asid);
     137        t = HT_HASH(page, as->asid);
    137138        if (!HT_SLOT_EMPTY(t)) {
    138                 while (!HT_COMPARE(page, asid, t) && HT_GET_NEXT(t))
     139                while (!HT_COMPARE(page, as->asid, t) && HT_GET_NEXT(t))
    139140                        t = HT_GET_NEXT(t);
    140                 t = HT_COMPARE(page, asid, t) ? t : NULL;
     141                t = HT_COMPARE(page, as->asid, t) ? t : NULL;
    141142        } else {
    142143                t = NULL;
  • genarch/src/mm/page_pt.c

    r6a3c9a7 rfc1e4f6  
    3131#include <mm/frame.h>
    3232#include <arch/mm/page.h>
    33 #include <arch/mm/asid.h>
     33#include <arch/mm/as.h>
    3434#include <arch/types.h>
    3535#include <typedefs.h>
     
    3737#include <memstr.h>
    3838
    39 static void pt_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root);
    40 static pte_t *pt_mapping_find(__address page, asid_t asid, __address root);
     39static void pt_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root);
     40static pte_t *pt_mapping_find(as_t *as, __address page, __address root);
    4141
    4242page_operations_t page_pt_operations = {
     
    5050 * using 'flags'.
    5151 *
     52 * @param as Ignored.
    5253 * @param page Virtual address of the page to be mapped.
    53  * @param asid Ignored.
    5454 * @param frame Physical address of memory frame to which the mapping is done.
    5555 * @param flags Flags to be used for mapping.
    5656 * @param root Explicit PTL0 address.
    5757 */
    58 void pt_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root)
     58void pt_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root)
    5959{
    6060        pte_t *ptl0, *ptl1, *ptl2, *ptl3;
     
    9898 * Find mapping for virtual page.
    9999 *
     100 * @param as Ignored.
    100101 * @param page Virtual page.
    101  * @param asid Ignored.
    102102 * @param root PTL0 address if non-zero.
    103103 *
    104104 * @return NULL if there is no such mapping; entry from PTL3 describing the mapping otherwise.
    105105 */
    106 pte_t *pt_mapping_find(__address page, asid_t asid, __address root)
     106pte_t *pt_mapping_find(as_t *as, __address page, __address root)
    107107{
    108108        pte_t *ptl0, *ptl1, *ptl2, *ptl3;
  • generic/include/mm/as.h

    r6a3c9a7 rfc1e4f6  
    4949#define UDATA_ADDRESS   UDATA_ADDRESS_ARCH
    5050
    51 #define AS_KERNEL       (1<<0)          /**< Kernel address space. */
     51#define FLAG_AS_KERNEL  (1<<0)          /**< Kernel address space. */
    5252
    5353enum as_area_type {
     
    8585};
    8686
    87 extern as_t * as_create(pte_t *ptl0, int flags);
     87extern as_t *AS_KERNEL;
     88
     89extern as_t *as_create(pte_t *ptl0, int flags);
    8890extern as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base);
    8991extern void as_set_mapping(as_t *as, __address page, __address frame);
  • generic/include/mm/page.h

    r6a3c9a7 rfc1e4f6  
    6262/** Operations to manipulate page mappings. */
    6363struct page_operations {
    64         void (* mapping_insert)(__address page, asid_t asid, __address frame, int flags, __address root);
    65         pte_t *(* mapping_find)(__address page, asid_t asid, __address root);
     64        void (* mapping_insert)(as_t *as, __address page, __address frame, int flags, __address root);
     65        pte_t *(* mapping_find)(as_t *as, __address page, __address root);
    6666};
    6767typedef struct page_operations page_operations_t;
     
    7070
    7171extern void page_init(void);
    72 extern void page_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root);
    73 extern pte_t *page_mapping_find(__address page, asid_t asid, __address root);
     72extern void page_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root);
     73extern pte_t *page_mapping_find(as_t *as, __address page, __address root);
    7474extern void map_structure(__address s, size_t size);
    7575
  • generic/src/main/main.c

    r6a3c9a7 rfc1e4f6  
    7878size_t init_size = 0;
    7979
     80/** Kernel address space. */
     81as_t *AS_KERNEL = NULL;
     82
    8083void main_bsp(void);
    8184void main_ap(void);
     
    153156         */
    154157        exc_init();
    155        
     158
     159        /*
     160         * Memory management subsystems initialization.
     161         */     
    156162        arch_pre_mm_init();
    157163        early_heap_init(config.heap_addr, config.heap_size + config.heap_delta);
     
    186192         * Create kernel address space.
    187193         */
    188         as = as_create(GET_PTL0_ADDRESS(), AS_KERNEL);
     194        as = as_create(GET_PTL0_ADDRESS(), FLAG_AS_KERNEL);
    189195        if (!as)
    190196                panic("can't create kernel address space\n");
  • generic/src/mm/as.c

    r6a3c9a7 rfc1e4f6  
    7777                list_initialize(&as->as_area_head);
    7878
    79                 if (flags & AS_KERNEL)
     79                if (flags & FLAG_AS_KERNEL)
    8080                        as->asid = ASID_KERNEL;
    8181                else
     
    187187         */
    188188       
    189         page_mapping_insert(page, as->asid, frame, get_area_flags(area), (__address) as->ptl0);
     189        page_mapping_insert(as, page, frame, get_area_flags(area), (__address) as->ptl0);
    190190       
    191191        spinlock_unlock(&area->lock);
     
    267267         * inserted into page tables.
    268268         */
    269         page_mapping_insert(page, AS->asid, frame, get_area_flags(area), (__address) AS->ptl0);
     269        page_mapping_insert(AS, page, frame, get_area_flags(area), (__address) AS->ptl0);
    270270       
    271271        spinlock_unlock(&area->lock);
  • generic/src/mm/page.c

    r6a3c9a7 rfc1e4f6  
    3434#include <arch/mm/page.h>
    3535#include <arch/mm/asid.h>
    36 #include <mm/asid.h>
     36#include <mm/as.h>
    3737#include <mm/frame.h>
    3838#include <arch/types.h>
     
    4949{
    5050        page_arch_init();
    51         page_mapping_insert(0x0, 0, 0x0, PAGE_NOT_PRESENT, 0);
     51        page_mapping_insert(AS_KERNEL, 0x0, 0x0, PAGE_NOT_PRESENT, 0);
    5252}
    5353
     
    6969
    7070        for (i = 0; i < cnt; i++)
    71                 page_mapping_insert(s + i*PAGE_SIZE, ASID_KERNEL, s + i*PAGE_SIZE, PAGE_NOT_CACHEABLE, 0);
     71                page_mapping_insert(AS_KERNEL, s + i*PAGE_SIZE, s + i*PAGE_SIZE, PAGE_NOT_CACHEABLE, 0);
    7272
    7373}
     
    7878 * using 'flags'. Allocate and setup any missing page tables.
    7979 *
     80 * @param as Address space to wich page belongs. Must be locked prior the call.
    8081 * @param page Virtual address of the page to be mapped.
    81  * @param asid Address space to wich page belongs.
    8282 * @param frame Physical address of memory frame to which the mapping is done.
    8383 * @param flags Flags to be used for mapping.
    8484 * @param root Explicit PTL0 address.
    8585 */
    86 void page_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root)
     86void page_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root)
    8787{
    8888        ASSERT(page_operations);
    8989        ASSERT(page_operations->mapping_insert);
    9090       
    91         page_operations->mapping_insert(page, asid, frame, flags, root);
     91        page_operations->mapping_insert(as, page, frame, flags, root);
    9292}
    9393
     
    9696 * Find mapping for virtual page.
    9797 *
     98 * @param as Address space to wich page belongs must be locked prior the call.
    9899 * @param page Virtual page.
    99  * @param asid Address space to wich page belongs.
    100100 * @param root PTL0 address if non-zero.
    101101 *
    102102 * @return NULL if there is no such mapping; requested mapping otherwise.
    103103 */
    104 pte_t *page_mapping_find(__address page,  asid_t asid, __address root)
     104pte_t *page_mapping_find(as_t *as, __address page, __address root)
    105105{
    106106        ASSERT(page_operations);
    107107        ASSERT(page_operations->mapping_find);
    108108
    109         return page_operations->mapping_find(page, asid, root);
     109        return page_operations->mapping_find(as, page, root);
    110110}
  • test/mm/mapping1/test.c

    r6a3c9a7 rfc1e4f6  
    3030#include <mm/page.h>
    3131#include <mm/frame.h>
    32 #include <mm/asid.h>
     32#include <mm/as.h>
    3333#include <arch/mm/page.h>
    3434#include <arch/types.h>
     
    5757       
    5858        printf("Mapping virtual address %P to physical address %P.\n", PAGE0, KA2PA(frame0));
    59         page_mapping_insert(PAGE0, ASID_KERNEL, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE, 0);
     59        page_mapping_insert(AS_KERNEL, PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE, 0);
    6060        printf("Mapping virtual address %P to physical address %P.\n", PAGE1, KA2PA(frame1));   
    61         page_mapping_insert(PAGE1, ASID_KERNEL, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE, 0);
     61        page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE, 0);
    6262       
    6363        printf("Value at virtual address %P is %L.\n", PAGE0, v0 = *((__u32 *) PAGE0));
Note: See TracChangeset for help on using the changeset viewer.