SEGMENT_ATTACH
Purpose
segment_attach attaches a memory segment
to the running task's address space.
Synopsis
#include <types.h>
#include <stub.h>
int segment_attach(Capability
*segment, Dwrd *base);
Parameters
-
segment: the capability for the
segment to be attached;
-
base: the offset in bytes in the
address space of the running task where the segment is to be attached to.
Description
segment_attach attaches the memory
segment designated by segment at the address base in the
address space of the running task.
The area pointed by base must be free in the
address space, i. e., no previous segment_attach. Besides, it must
be large enough to hold the entire segment. If this conditions do not hold,
segment_attach fails.
If you do not care about where the segment
will be attached, specify a base equal to 0 and let the kernel choose
the address. In this case, base is also an output parameter and
will point to the attached segment.
Return Values
On success, segment_attach returns
0 and base contains the address where the segment has been attached.
On fail, segment_attach returns a negative
value indicating one of the following errors:
See Also
segment_create,
segment_destroy, segment_status,
segment_detach, segment_resize
Notes
Due to the way ix86 handles paging, a segment
is allway attached to a 4 Mbytes multiple address.