26 |
#include <sys/types.h> |
#include <sys/types.h> |
27 |
#include <l4.h> |
#include <l4.h> |
28 |
#include <hurd/types.h> |
#include <hurd/types.h> |
29 |
|
#include <hurd/physmem.h> |
|
|
|
|
/* Memory control object. */ |
|
|
typedef hurd_cap_handle_t hurd_pm_control_t; |
|
|
|
|
|
/* Container. */ |
|
|
typedef hurd_cap_handle_t hurd_pm_container_t; |
|
|
|
|
|
/* A limited access capability for a container. */ |
|
|
typedef hurd_cap_handle_t hurd_pm_container_access_t; |
|
|
|
|
|
/* If an error occurs allocating a frame, return what has succeeded so |
|
|
far and return the error code for the failing index. */ |
|
|
#define HURD_PM_CONT_ALLOC_PARTIAL (1 << 0) |
|
|
/* Do not fail if the specified identifier is already in use. |
|
|
Instead, deallocate the current frame and allocate a new one in its |
|
|
place. This is useful only to shortcut explicit deallocation |
|
|
requests; using it to avoid EEXIST error messages will lead to |
|
|
problems as it suggests that the client is not keep track of |
|
|
frames. */ |
|
|
#define HURD_PM_CONT_ALLOC_SQUASH (1 << 1) |
|
|
/* Allocate extra frames if needed. */ |
|
|
#define HURD_PM_CONT_ALLOC_EXTRA (1 << 2) |
|
|
/* Only allocate frames suitable for DMA. */ |
|
|
#define HURD_PM_CONT_ALLOC_DMA (1 << 3) |
|
30 |
|
|
31 |
/* Create a container in *CONTAINER managed by the physical memory |
/* Create a container in *CONTAINER managed by the physical memory |
32 |
server from the contol memory capability CONTROL. */ |
server from the contol memory capability CONTROL. */ |
36 |
/* Create a limited access capability for container CONTAINER, return |
/* Create a limited access capability for container CONTAINER, return |
37 |
in *ACCESS. */ |
in *ACCESS. */ |
38 |
extern error_t hurd_pm_container_share (hurd_pm_container_t container, |
extern error_t hurd_pm_container_share (hurd_pm_container_t container, |
39 |
hurd_pm_container_access_t *access); |
hurd_pm_container_t *access); |
40 |
|
|
41 |
/* Allocate SIZE bytes of physical memory (which must be a multiple of |
/* Allocate SIZE bytes of physical memory (which must be a multiple of |
42 |
the page size) according to the flags FLAGS into container |
the page size) according to the flags FLAGS into container |
69 |
extern error_t hurd_pm_container_deallocate (hurd_pm_container_t container, |
extern error_t hurd_pm_container_deallocate (hurd_pm_container_t container, |
70 |
uintptr_t start, uintptr_t size); |
uintptr_t start, uintptr_t size); |
71 |
|
|
72 |
/* Map the frames in container CONTAINER starting at offset OFFSET |
/* Map the COUNT bytes of physical memory in container CONTAINER |
73 |
with size SIZE at virtual memory address VADDR of the calling task |
starting at byte INDEX at virtual memory address VADDR of the |
74 |
with access rights RIGHTS. */ |
calling task according to the flags FLAGS. |
75 |
|
|
76 |
|
If INDEX does not refer to the start of base page aligned memory in |
77 |
|
CONTAINER, EINVAL is returned. If SIZE is not a multiple of the |
78 |
|
base page size, EINVAL is returned. If VADDR is not aligned on a |
79 |
|
multiple of the base page size, EINVAL is returned. |
80 |
|
|
81 |
|
If an address to map has no memory associated with it, ENOENT is |
82 |
|
returned. |
83 |
|
|
84 |
|
If AMOUNT is not-NULL, *AMOUNT is set to the number of bytes |
85 |
|
actually mapped. */ |
86 |
extern error_t hurd_pm_container_map (hurd_pm_container_t container, |
extern error_t hurd_pm_container_map (hurd_pm_container_t container, |
87 |
l4_word_t offset, size_t size, |
l4_word_t index, size_t size, |
88 |
uintptr_t vaddr, l4_word_t rights); |
uintptr_t vaddr, l4_word_t flags, |
89 |
|
size_t *amount); |
90 |
|
|
91 |
/* Logically copy COUNT bytes from container SRC_CONTAINER starting at |
/* Logically copy COUNT bytes from container SRC_CONTAINER starting at |
92 |
byte SRC_START to container DEST_CONTAINER starting at byte |
byte SRC_START to container DEST_CONTAINER starting at byte |
93 |
DEST_START. On return, *AMOUNT contains the number of bytes copied |
DEST_START. On return, *AMOUNT contains the number of bytes |
94 |
when an error occurred (if any). |
successfully copied. |
95 |
|
|
96 |
If copying would overwrite frames in DEST_CONTAINER and FLAGS |
If copying would overwrite frames in DEST_CONTAINER and FLAGS |
97 |
contains HURD_PM_CONT_ALLOC_SQUASH, the frames are implicitly |
contains HURD_PM_CONT_ALLOC_SQUASH, the frames are implicitly |
98 |
deallocated, otherwise EEXIST is returned. |
deallocated, otherwise EEXIST is returned. |
99 |
|
|
100 |
If an address to copy has no memory associated with it, ESRCH is |
If an address to copy has no memory associated with it, ENOENT is |
101 |
returned. |
returned. |
102 |
|
|
103 |
SRC_START and DEST_START must correspond to the start of a base |
SRC_START and DEST_START must correspond to the start of a base |