SEGMENT_CREATE

Purpose

segment_create creates a new memory segment. 

Synopsis

#include <types.h> 
#include <stub.h> 

int segment_create(Dwrd size, Capability *segment); 

Parameters

Description

segment_create creates a new memory segment that is size bytes long. The created segment is associated to a new capability that is returned through segment. 

To be written or read, a segment must first be attached to a task address space by calling segment_attach. 

Return Values

On success, segment_create returns 0 and segment contains a valid owner capability for the segment. 

On fail, segment_create returns a negative value indicating one of the following errors: 

See Also

segment_destroy, segment_status, segment_attach, segment_detach, segment_resize 

Notes

The current version restricts the maximum size for segments to 4 Mbytes. It is due to the way ix86 handles paging. To optimize the segment implementation, each new segment is associated to a ix86 page directory that can point up to 4 Mbytes.