Rev 977 | Rev 1044 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 977 | Rev 1026 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | 46 | ||
47 | #define USTACK_ADDRESS USTACK_ADDRESS_ARCH |
47 | #define USTACK_ADDRESS USTACK_ADDRESS_ARCH |
48 | 48 | ||
49 | #define FLAG_AS_KERNEL (1 << 0) /**< Kernel address space. */ |
49 | #define FLAG_AS_KERNEL (1 << 0) /**< Kernel address space. */ |
50 | 50 | ||
- | 51 | /** Address space area flags. */ |
|
51 | enum as_area_type { |
52 | #define AS_AREA_READ 1 |
52 | AS_AREA_TEXT = 1, AS_AREA_DATA, AS_AREA_STACK |
53 | #define AS_AREA_WRITE 2 |
53 | }; |
54 | #define AS_AREA_EXEC 4 |
54 | 55 | ||
55 | /** Address space area structure. |
56 | /** Address space area structure. |
56 | * |
57 | * |
57 | * Each as_area_t structure describes one contiguous area of virtual memory. |
58 | * 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. |
59 | * In the future, it should not be difficult to support shared areas. |
59 | */ |
60 | */ |
60 | struct as_area { |
61 | struct as_area { |
61 | SPINLOCK_DECLARE(lock); |
62 | SPINLOCK_DECLARE(lock); |
62 | link_t link; |
63 | link_t link; |
63 | as_area_type_t type; |
64 | int flags; |
64 | size_t size; /**< Size of this area in multiples of PAGE_SIZE. */ |
65 | size_t size; /**< Size of this area in multiples of PAGE_SIZE. */ |
65 | __address base; /**< Base address of this area. */ |
66 | __address base; /**< Base address of this area. */ |
66 | }; |
67 | }; |
67 | 68 | ||
68 | /** Address space structure. |
69 | /** Address space structure. |
Line 101... | Line 102... | ||
101 | extern spinlock_t as_lock; |
102 | extern spinlock_t as_lock; |
102 | extern link_t inactive_as_with_asid_head; |
103 | extern link_t inactive_as_with_asid_head; |
103 | 104 | ||
104 | extern void as_init(void); |
105 | extern void as_init(void); |
105 | extern as_t *as_create(int flags); |
106 | extern as_t *as_create(int flags); |
106 | extern as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base); |
107 | extern as_area_t *as_area_create(as_t *as, int flags, size_t size, __address base); |
107 | extern __address as_remap(as_t *as, __address address, size_t size, int flags); |
108 | extern __address as_remap(as_t *as, __address address, size_t size, int flags); |
108 | extern void as_set_mapping(as_t *as, __address page, __address frame); |
109 | extern void as_set_mapping(as_t *as, __address page, __address frame); |
109 | extern int as_page_fault(__address page); |
110 | extern int as_page_fault(__address page); |
110 | extern void as_switch(as_t *old, as_t *new); |
111 | extern void as_switch(as_t *old, as_t *new); |
111 | extern void as_free(as_t *as); |
112 | extern void as_free(as_t *as); |