Changeset 677a6d5 in mainline


Ignore:
Timestamp:
2006-01-08T16:24:32Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f275cb3
Parents:
59adc2b
Message:

Memory management work.
Pass address space identifier to functions in page_operations to support single global page hash table.

Files:
1 added
12 edited

Legend:

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

    r59adc2b r677a6d5  
    5757                 */
    5858                for (cur = 0; cur < last_frame; cur += FRAME_SIZE) {
    59                         page_mapping_insert(PA2KA(cur), cur, PAGE_CACHEABLE | PAGE_EXEC, KA2PA(dba));
     59                        page_mapping_insert(PA2KA(cur), 0, cur, PAGE_CACHEABLE | PAGE_EXEC, KA2PA(dba));
    6060                }
    6161
  • arch/ia32/src/drivers/ega.c

    r59adc2b r677a6d5  
    3030#include <putchar.h>
    3131#include <mm/page.h>
     32#include <mm/asid.h>
    3233#include <arch/mm/page.h>
    3334#include <synch/spinlock.h>
     
    5960        __u8 hi, lo;
    6061
    61         page_mapping_insert(PA2KA(VIDEORAM), VIDEORAM, PAGE_NOT_CACHEABLE, 0);
     62        page_mapping_insert(PA2KA(VIDEORAM), ASID_KERNEL, VIDEORAM, PAGE_NOT_CACHEABLE, 0);
    6263        outb(0x3d4,0xe);
    6364        hi = inb(0x3d5);
  • arch/ia32/src/mm/page.c

    r59adc2b r677a6d5  
    3232#include <mm/frame.h>
    3333#include <mm/page.h>
     34#include <mm/asid.h>
    3435#include <arch/types.h>
    3536#include <config.h>
     
    6162                 */
    6263                for (cur = 0; cur < last_frame; cur += FRAME_SIZE)
    63                         page_mapping_insert(PA2KA(cur), cur, PAGE_CACHEABLE, KA2PA(dba));
     64                        page_mapping_insert(PA2KA(cur), ASID_KERNEL, cur, PAGE_CACHEABLE, KA2PA(dba));
    6465
    6566                exc_register(14, "page_fault", page_fault);
  • arch/ia32/src/smp/smp.c

    r59adc2b r677a6d5  
    4444#include <mm/page.h>
    4545#include <mm/heap.h>
     46#include <mm/asid.h>
    4647#include <print.h>
    4748#include <memstr.h>
     
    6465
    6566        if (config.cpu_count > 1) {             
    66                 page_mapping_insert((__address)l_apic, (__address)l_apic,
     67                page_mapping_insert((__address)l_apic, ASID_KERNEL, (__address)l_apic,
    6768                                  PAGE_NOT_CACHEABLE, 0);
    68                 page_mapping_insert((__address) io_apic,
     69                page_mapping_insert((__address) io_apic, ASID_KERNEL,
    6970                                  (__address) io_apic,
    7071                                  PAGE_NOT_CACHEABLE, 0);
  • arch/mips32/src/mm/tlb.c

    r59adc2b r677a6d5  
    337337         * Handler cannot succeed if badvaddr has no mapping.
    338338         */
    339         pte = page_mapping_find(badvaddr, 0);
     339        pte = page_mapping_find(badvaddr, VM->asid, 0);
    340340        if (!pte) {
    341341                printf("No such mapping.\n");
  • genarch/src/acpi/acpi.c

    r59adc2b r677a6d5  
    3030#include <genarch/acpi/madt.h>
    3131#include <arch/bios/bios.h>
    32 
     32#include <mm/asid.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, (__address) sdt, PAGE_NOT_CACHEABLE, 0);
     82        page_mapping_insert((__address) sdt, ASID_KERNEL, (__address) sdt, PAGE_NOT_CACHEABLE, 0);
    8383        map_structure((__address) sdt, sdt->length);
    8484}
  • genarch/src/mm/page_ht.c

    r59adc2b r677a6d5  
    3030#include <mm/page.h>
    3131#include <mm/frame.h>
     32#include <arch/mm/asid.h>
    3233#include <arch/types.h>
    3334#include <typedefs.h>
    3435#include <arch/asm.h>
    3536
    36 static void ht_mapping_insert(__address page, __address frame, int flags, __address root);
    37 static pte_t *ht_mapping_find(__address page, __address root);
     37static void ht_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root);
     38static pte_t *ht_mapping_find(__address page, asid_t asid, __address root);
    3839
    3940page_operations_t page_ht_operations = {
     
    4849 *
    4950 * @param page Virtual address of the page to be mapped.
     51 * @param asid Address space to which page belongs.
    5052 * @param frame Physical address of memory frame to which the mapping is done.
    5153 * @param flags Flags to be used for mapping.
    5254 * @param root Explicit PTL0 address.
    5355 */
    54 void ht_mapping_insert(__address page, __address frame, int flags, __address root)
     56void ht_mapping_insert(__address page,  asid_t asid, __address frame, int flags, __address root)
    5557{
    5658}
     
    6163 *
    6264 * @param page Virtual page.
     65 * @param asid Address space to wich page belongs.
    6366 * @param root PTL0 address if non-zero.
    6467 *
    6568 * @return NULL if there is no such mapping; entry from PTL3 describing the mapping otherwise.
    6669 */
    67 pte_t *ht_mapping_find(__address page, __address root)
     70pte_t *ht_mapping_find(__address page, asid_t asid, __address root)
    6871{
    6972        return NULL;
  • genarch/src/mm/page_pt.c

    r59adc2b r677a6d5  
    3131#include <mm/frame.h>
    3232#include <arch/mm/page.h>
     33#include <arch/mm/asid.h>
    3334#include <arch/types.h>
    3435#include <typedefs.h>
     
    3637#include <memstr.h>
    3738
    38 static void pt_mapping_insert(__address page, __address frame, int flags, __address root);
    39 static pte_t *pt_mapping_find(__address page, __address root);
     39static void pt_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root);
     40static pte_t *pt_mapping_find(__address page, asid_t asid, __address root);
    4041
    4142page_operations_t page_pt_operations = {
     
    5051 *
    5152 * @param page Virtual address of the page to be mapped.
     53 * @param asid Ignored.
    5254 * @param frame Physical address of memory frame to which the mapping is done.
    5355 * @param flags Flags to be used for mapping.
    5456 * @param root Explicit PTL0 address.
    5557 */
    56 void pt_mapping_insert(__address page, __address frame, int flags, __address root)
     58void pt_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root)
    5759{
    5860        pte_t *ptl0, *ptl1, *ptl2, *ptl3;
     
    9799 *
    98100 * @param page Virtual page.
     101 * @param asid Ignored.
    99102 * @param root PTL0 address if non-zero.
    100103 *
    101104 * @return NULL if there is no such mapping; entry from PTL3 describing the mapping otherwise.
    102105 */
    103 pte_t *pt_mapping_find(__address page, __address root)
     106pte_t *pt_mapping_find(__address page, asid_t asid, __address root)
    104107{
    105108        pte_t *ptl0, *ptl1, *ptl2, *ptl3;
  • generic/include/mm/page.h

    r59adc2b r677a6d5  
    3030#define __PAGE_H__
    3131
     32#include <arch/mm/asid.h>
    3233#include <arch/types.h>
    3334#include <typedefs.h>
     
    5758
    5859struct page_operations {
    59         void (* mapping_insert)(__address page, __address frame, int flags, __address root);
    60         pte_t *(* mapping_find)(__address page, __address root);
     60        void (* mapping_insert)(__address page, asid_t asid, __address frame, int flags, __address root);
     61        pte_t *(* mapping_find)(__address page, asid_t asid, __address root);
    6162};
    6263typedef struct page_operations page_operations_t;
     
    6566
    6667extern void page_init(void);
    67 extern void page_mapping_insert(__address page, __address frame, int flags, __address root);
    68 extern pte_t *page_mapping_find(__address page, __address root);
     68extern void page_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root);
     69extern pte_t *page_mapping_find(__address page, asid_t asid, __address root);
    6970extern void map_structure(__address s, size_t size);
    7071
  • generic/src/mm/page.c

    r59adc2b r677a6d5  
    2828
    2929#include <mm/page.h>
     30#include <arch/mm/page.h>
     31#include <arch/mm/asid.h>
     32#include <mm/asid.h>
    3033#include <mm/frame.h>
    31 #include <arch/mm/page.h>
    3234#include <arch/types.h>
    3335#include <typedefs.h>
     
    3537#include <memstr.h>
    3638#include <debug.h>
     39#include <arch.h>
    3740
    3841/** Virtual operations for page subsystem. */
     
    4245{
    4346        page_arch_init();
    44         page_mapping_insert(0x0, 0x0, PAGE_NOT_PRESENT, 0);
     47        page_mapping_insert(0x0, 0, 0x0, PAGE_NOT_PRESENT, 0);
    4548}
    4649
     
    6265
    6366        for (i = 0; i < cnt; i++)
    64                 page_mapping_insert(s + i*PAGE_SIZE, s + i*PAGE_SIZE, PAGE_NOT_CACHEABLE, 0);
     67                page_mapping_insert(s + i*PAGE_SIZE, ASID_KERNEL, s + i*PAGE_SIZE, PAGE_NOT_CACHEABLE, 0);
    6568
    6669}
     
    7275 *
    7376 * @param page Virtual address of the page to be mapped.
     77 * @param asid Address space to wich page belongs.
    7478 * @param frame Physical address of memory frame to which the mapping is done.
    7579 * @param flags Flags to be used for mapping.
    7680 * @param root Explicit PTL0 address.
    7781 */
    78 void page_mapping_insert(__address page, __address frame, int flags, __address root)
     82void page_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root)
    7983{
    8084        ASSERT(page_operations);
    8185        ASSERT(page_operations->mapping_insert);
    8286       
    83         page_operations->mapping_insert(page, frame, flags, root);
     87        page_operations->mapping_insert(page, asid, frame, flags, root);
    8488}
    8589
     
    8993 *
    9094 * @param page Virtual page.
     95 * @param asid Address space to wich page belongs.
    9196 * @param root PTL0 address if non-zero.
    9297 *
    9398 * @return NULL if there is no such mapping; entry from PTL3 describing the mapping otherwise.
    9499 */
    95 pte_t *page_mapping_find(__address page, __address root)
     100pte_t *page_mapping_find(__address page,  asid_t asid, __address root)
    96101{
    97102        ASSERT(page_operations);
    98103        ASSERT(page_operations->mapping_find);
    99104
    100         return page_operations->mapping_find(page, root);
     105        return page_operations->mapping_find(page, asid, root);
    101106}
  • generic/src/mm/vm.c

    r59adc2b r677a6d5  
    163163        ASSERT(m->ptl0);
    164164        for (i=0; i<a->size; i++)
    165                 page_mapping_insert(a->address + i*PAGE_SIZE, a->mapping[i], flags, (__address) m->ptl0);
     165                page_mapping_insert(a->address + i*PAGE_SIZE, m->asid, a->mapping[i], flags, (__address) m->ptl0);
    166166               
    167167        spinlock_unlock(&a->lock);
     
    181181        ASSERT(m->ptl0);
    182182        for (i=0; i<a->size; i++)               
    183                 page_mapping_insert(a->address + i*PAGE_SIZE, 0, PAGE_NOT_PRESENT, (__address) m->ptl0);
     183                page_mapping_insert(a->address + i*PAGE_SIZE, 0, 0, PAGE_NOT_PRESENT, (__address) m->ptl0);
    184184       
    185185        spinlock_unlock(&a->lock);
  • test/mm/mapping1/test.c

    r59adc2b r677a6d5  
    3030#include <mm/page.h>
    3131#include <mm/frame.h>
     32#include <mm/asid.h>
    3233#include <arch/mm/page.h>
    3334#include <arch/types.h>
     
    5657       
    5758        printf("Mapping virtual address %P to physical address %P.\n", PAGE0, KA2PA(frame0));
    58         page_mapping_insert(PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE, 0);
     59        page_mapping_insert(PAGE0, ASID_KERNEL, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE, 0);
    5960        printf("Mapping virtual address %P to physical address %P.\n", PAGE1, KA2PA(frame1));   
    60         page_mapping_insert(PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE, 0);
     61        page_mapping_insert(PAGE1, ASID_KERNEL, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE, 0);
    6162       
    6263        printf("Value at virtual address %P is %L.\n", PAGE0, v0 = *((__u32 *) PAGE0));
Note: See TracChangeset for help on using the changeset viewer.