Changeset 20d50a1 in mainline for generic/include/mm/as.h


Ignore:
Timestamp:
2006-01-13T13:02:45Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f9425006
Parents:
0369911
Message:

Memory management work.

  • vm.* → as.* (as like address space is, imho, more fitting)
  • Don't do TLB shootdown on vm_install(). Some architectures only need to call tlb_invalidate_asid().
  • Don't allocate all frames for as_area in as_area_create(), but let them be allocated on-demand by as_page_fault().
  • Add high-level page fault handler as_page_fault().
  • Add as_area_load_mapping().
File:
1 moved

Legend:

Unmodified
Added
Removed
  • generic/include/mm/as.h

    r0369911 r20d50a1  
    2727 */
    2828
    29 #ifndef __VM_H__
    30 #define __VM_H__
     29#ifndef __AS_H__
     30#define __AS_H__
    3131
    3232#include <arch/mm/page.h>
    33 #include <arch/mm/vm.h>
     33#include <arch/mm/as.h>
    3434#include <arch/mm/asid.h>
    3535#include <arch/types.h>
     
    4949#define UDATA_ADDRESS   UDATA_ADDRESS_ARCH
    5050
    51 enum vm_type {
    52         VMA_TEXT = 1, VMA_DATA, VMA_STACK
     51enum as_area_type {
     52        AS_AREA_TEXT = 1, AS_AREA_DATA, AS_AREA_STACK
    5353};
    5454
    55 /*
    56  * Each vm_area_t structure describes one continuous area of virtual memory.
    57  * In the future, it should not be difficult to support shared areas of vm.
     55/** Address space area structure.
     56 *
     57 * Each as_area_t structure describes one contiguous area of virtual memory.
     58 * In the future, it should not be difficult to support shared areas.
    5859 */
    59 struct vm_area {
     60struct as_area {
    6061        SPINLOCK_DECLARE(lock);
    6162        link_t link;
    62         vm_type_t type;
    63         int size;
    64         __address address;
    65         __address *mapping;
     63        as_area_type_t type;
     64        size_t size;            /**< Size of this area. */
     65        __address base;         /**< Base address of this area. */
     66        index_t *mapping;       /**< Map of physical frame numbers mapped to virtual page numbers in this area. */
    6667};
    6768
    68 /*
    69  * vm_t contains the list of vm_areas of userspace accessible
     69/** Address space structure.
     70 *
     71 * as_t contains the list of as_areas of userspace accessible
    7072 * pages for one or more tasks. Ranges of kernel memory pages are not
    7173 * supposed to figure in the list as they are shared by all tasks and
    7274 * set up during system initialization.
    7375 */
    74 struct vm {
     76struct as {
    7577        SPINLOCK_DECLARE(lock);
    76         link_t vm_area_head;
     78        link_t as_area_head;
    7779        pte_t *ptl0;
    78         asid_t asid;
     80        asid_t asid;                    /**< Address space identifier. */
    7981};
    8082
    81 extern vm_t * vm_create(pte_t *ptl0);
    82 extern void vm_destroy(vm_t *m);
     83extern as_t * as_create(pte_t *ptl0);
     84extern as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base);
     85extern void as_area_load_mapping(as_area_t *a, index_t *pfn);
     86extern int as_page_fault(__address page);
     87extern void as_install(as_t *m);
    8388
    84 extern vm_area_t *vm_area_create(vm_t *m, vm_type_t type, size_t size, __address addr);
    85 extern void vm_area_destroy(vm_area_t *a);
    86 
    87 extern void vm_area_map(vm_area_t *a, vm_t *m);
    88 extern void vm_area_unmap(vm_area_t *a, vm_t *m);
    89 
    90 extern void vm_install(vm_t *m);
    91 extern void vm_uninstall(vm_t *m);
     89/*
     90 * Each architecture should implement this function.
     91 * Its main purpose is to do TLB purges according
     92 * to architecture's requirements. Note that
     93 * some architectures invalidate their TLB automatically
     94 * on hardware address space switch (e.g. ia32 and
     95 * amd64).
     96 */
     97#ifndef as_install_arch
     98extern void as_install_arch(as_t *as);
     99#endif /* !def as_install_arch */
    92100
    93101#endif
Note: See TracChangeset for help on using the changeset viewer.