Subversion Repositories HelenOS-historic

Rev

Rev 1358 | Rev 1387 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1358 Rev 1380
Line 42... Line 42...
42
#include <arch/mm/as.h>
42
#include <arch/mm/as.h>
43
#include <arch/mm/asid.h>
43
#include <arch/mm/asid.h>
44
#include <arch/types.h>
44
#include <arch/types.h>
45
#include <typedefs.h>
45
#include <typedefs.h>
46
#include <synch/spinlock.h>
46
#include <synch/spinlock.h>
-
 
47
#include <synch/mutex.h>
47
#include <adt/list.h>
48
#include <adt/list.h>
48
#include <adt/btree.h>
49
#include <adt/btree.h>
49
 
50
 
50
/** Defined to be true if user address space and kernel address space shadow each other. */
51
/** Defined to be true if user address space and kernel address space shadow each other. */
51
#define KERNEL_ADDRESS_SPACE_SHADOWED   KERNEL_ADDRESS_SPACE_SHADOWED_ARCH
52
#define KERNEL_ADDRESS_SPACE_SHADOWED   KERNEL_ADDRESS_SPACE_SHADOWED_ARCH
Line 64... Line 65...
64
 
65
 
65
/** Address space area attributes. */
66
/** Address space area attributes. */
66
#define AS_AREA_ATTR_NONE   0
67
#define AS_AREA_ATTR_NONE   0
67
#define AS_AREA_ATTR_PARTIAL    1   /* Not fully initialized area. */
68
#define AS_AREA_ATTR_PARTIAL    1   /* Not fully initialized area. */
68
 
69
 
69
#define AS_PF_FAULT     0   /**< The page fault was not resolved by asp_page_fault(). */
70
#define AS_PF_FAULT     0   /**< The page fault was not resolved by as_page_fault(). */
70
#define AS_PF_OK        1   /**< The page fault was resolved by as_page_fault(). */
71
#define AS_PF_OK        1   /**< The page fault was resolved by as_page_fault(). */
71
#define AS_PF_DEFER     2   /**< The page fault was caused by memcpy_from_uspace(). */
72
#define AS_PF_DEFER     2   /**< The page fault was caused by memcpy_from_uspace()
-
 
73
                         or memcpy_to_uspace(). */
72
 
74
 
73
/** Address space area structure.
75
/** Address space area structure.
74
 *
76
 *
75
 * Each as_area_t structure describes one contiguous area of virtual memory.
77
 * Each as_area_t structure describes one contiguous area of virtual memory.
76
 * In the future, it should not be difficult to support shared areas.
78
 * In the future, it should not be difficult to support shared areas.
77
 */
79
 */
78
struct as_area {
80
struct as_area {
79
    SPINLOCK_DECLARE(lock);
81
    mutex_t lock;
80
    int flags;      /**< Flags related to the memory represented by the address space area. */
82
    int flags;      /**< Flags related to the memory represented by the address space area. */
81
    int attributes;     /**< Attributes related to the address space area itself. */
83
    int attributes;     /**< Attributes related to the address space area itself. */
82
    count_t pages;      /**< Size of this area in multiples of PAGE_SIZE. */
84
    count_t pages;      /**< Size of this area in multiples of PAGE_SIZE. */
83
    __address base;     /**< Base address of this area. */
85
    __address base;     /**< Base address of this area. */
84
};
86
};
Line 89... Line 91...
89
 * pages for one or more tasks. Ranges of kernel memory pages are not
91
 * pages for one or more tasks. Ranges of kernel memory pages are not
90
 * supposed to figure in the list as they are shared by all tasks and
92
 * supposed to figure in the list as they are shared by all tasks and
91
 * set up during system initialization.
93
 * set up during system initialization.
92
 */
94
 */
93
struct as {
95
struct as {
94
    /** Protected by asidlock. Must be acquired before as->lock. */
96
    /** Protected by asidlock. */
95
    link_t inactive_as_with_asid_link;
97
    link_t inactive_as_with_asid_link;
96
 
98
 
97
    SPINLOCK_DECLARE(lock);
99
    mutex_t lock;
98
 
100
 
99
    /** Number of processors on wich is this address space active. */
101
    /** Number of processors on wich is this address space active. */
100
    count_t refcount;
102
    count_t refcount;
101
 
103
 
102
    /** B+tree of address space areas. */
104
    /** B+tree of address space areas. */