|
|
|
Location:
e32std.h
Link against: euser.lib
RChunk
Supported from 5.0
Provides a handle to a chunk.
The chunk itself is a Kernel object.
|
Defined in RChunk:
Adjust(), AdjustDoubleEnded(), Base(), Bottom(), CreateDoubleEndedGlobal(), CreateDoubleEndedLocal(), CreateGlobal(), CreateLocal(), CreateLocalCode(), IsReadable(), IsWritable(), MaxSize(), Open(), OpenGlobal(), Read(), Read(), Read(), Read(), ReserveAt(), Size(), Top(), Write(), Write()
Inherited from RHandleBase:
Close(),
Duplicate(),
Handle(),
SetHandle()
TInt CreateLocal(TInt aSize,TInt aMaxSize,TOwnerType aType=EOwnerProcess);
Creates a local chunk.
The chunk is local to the process creating it; i.e. it is private to the process creating it and is not intended for access by other user processes.
aMaxSize specifies the maximum size of the chunk
and aSize specifies the number of bytes to be committed on
creation of the chunk. Both values are rounded up to the next nearest processor
page boundary value if they are not already on a processor page
boundary.
The committed region always starts at the bottom of the reserved region.
By default, ownership of this chunk handle is vested in the
current process. Ownership of the chunk handle can be vested in the current
thread by passing EOwnerThread as the third parameter to this
function.
|
|
TInt CreateLocalCode(TInt aSize,TInt aMaxSize,TOwnerType aType=EOwnerProcess);
Supported from 7.0
Creates a user writable chunk that is marked by the Kernel as containing code.
The chunk is local to the process creating it, i.e. it is private to the process creating it and is not intended for access by other user processes.
The chunk is allocated at a globally unique virtual address which is allocated from the top of virtual address space.
On systems using a Harvard cache, this type of chunk removes the need to flush the instruction cache (I-Cache) on a context switch. However, the instruction Translation Look-aside Buffer (ITLB) still needs to be flushed when switching to or from a process with one of these chunks in its address space.
|
|
TInt CreateGlobal(const TDesC& aName,TInt aSize,TInt aMaxSize,TOwnerType aType=EOwnerProcess);
Creates a global chunk.
The chunk is global; i.e. it is visible to all processes and is intended for access by other user processes.
aMaxSize specifies the maximum size of the chunk
and aSize specifies the number of bytes to be committed on
creation of the chunk. Both values are rounded up to the next nearest processor
page boundary value ,if they are not already on a processor page boundary
value.
The committed region always starts at the bottom of the reserved region.
The descriptor aName contains the name to be
assigned to this global chunk.
By default, ownership of this chunk handle is vested in the
current process. Ownership of the chunk handle can be vested in the current
thread by passing EOwnerThread as the third parameter to this
function.
|
|
TInt CreateDoubleEndedLocal(TInt aInitialBottom, TInt aInitialTop,TInt aMaxSize,TOwnerType aType=EOwnerProcess);
Creates a local, double ended, chunk.
The chunk is local to the process creating it; i.e. it is private to the process creating it and is not intended for access by other user processes.
The committed region of a double ended chunk can be any contiguous subset of the reserved region.
aMaxSize specifies the maximum size of the
chunk.
The difference between aInitialTop and
aInitialBottom gives the number of bytes to be committed, on
creation of the chunk; aInitialBottom gives the offset of the
bottom of the committed region from the base of the chunk's reserved region;
aInitialTop gives the offset of the top of the committed region
from the base of the chunk's reserved region.
Both aInitialBottom and aInitialTop
are rounded up to the next nearest processor page boundary value, if they are
not already on a processor page boundary value.
By default, ownership of this chunk handle is vested in the
current process. Ownership of the chunk handle can be vested in the current
thread by passing EOwnerThread as the third parameter to this
function.
Note that:
the lowest valid address in a double ended chunk is the
sum of the base of the chunk's reserved region plus the adjusted value of
aInitialBottom
the highest valid address in a double ended chunk is the
the sum of the base of the chunk's reserved region plus the adjusted value of
aInitialTop - 1.
|
|
TInt CreateDoubleEndedGlobal(const TDesC& aName,TInt aInitialBottom,TInt aInitialTop,TInt aMaxSize,TOwnerType aType=EOwnerProcess);
Creates a global, double ended, chunk.
The chunk is global; i.e. it is visible to all processes and is intended for access by other user processes.
The committed region of a double ended chunk can be any contiguous subset of the reserved region.
aMaxSize specifies the maximum size of the
chunk.
The difference between aInitialTop and
aInitialBottom gives the number of bytes to be committed, on
creation of the chunk; aInitialBottom gives the offset of the
bottom of the committed region from the base of the chunk's reserved region;
aInitialTop gives the offset of the top of the committed region
from the base of the chunk's reserved region.
Both aInitialBottom and aInitialTop
are rounded up to the next nearest processor page boundary value, if they are
not already on a processor page boundary value.
The descriptor aName contains the name to be
assigned to this global chunk.
By default, ownership of this chunk handle is vested in the
current process. Ownership of the chunk handle can be vested in the current
thread by passing EOwnerThread as the third parameter to this
function.
Note that:
the lowest valid address in a double ended chunk is the
sum of the base of the chunk's reserved region plus the adjusted value of
aInitialBottom
the highest valid address in a double ended chunk is the
the sum of the base of the chunk's reserved region plus the adjusted value of
aInitialTop - 1.
|
|
TInt OpenGlobal(const TDesC& aName,TBool isReadOnly,TOwnerType aType=EOwnerProcess);
Opens a handle to a specific named global chunk.
Full read/write access can be allowed or access can be limited to read only.
By default, ownership of this process handle is vested in the
current process, but can be vested in the current thread by passing
EOwnerThread as the second parameter to this function.
Arguments
|
|
TInt Open(const TFindChunk& aFind,TOwnerType aType=EOwnerProcess);
Opens a handle to the global chunk found using a
TFindChunk object.
A TFindChunk object is used to find all chunks
whose full names match a specified pattern.
By default, ownership of this chunk handle is vested in the
current process, but can be vested in the current thread by passing
EOwnerThread as the second parameter to this function.
|
|
TInt Adjust(TInt aNewSize) const;
Changes the number of bytes committed to the chunk.
This value is always rounded up to the next nearest processor page boundary.
|
|
TInt AdjustDoubleEnded(TInt aBottom, TInt aTop) const;
Changes the number of bytes and the position of this double ended chunk's committed region.
The difference between aTop and
aBottom gives the new size of the committed region;
aBottom gives the offset of the bottom of the committed region
from the base of the chunk's reserved region.
Both aBottom and aTop are rounded up
to the next nearest processor page boundary.
The function fails if this chunk is not a double ended chunk;
for a standard chunk, use the Adjust() function.
Note that if the initial and final committed regions intersect, the contents of the intersection are unchanged. Other parts of the committed region have undefined contents.
Note also that:
the lowest valid address in a double ended chunk is the
sum of the base of the chunk's reserved region plus the adjusted value of
aBottom
the highest valid address in a double ended chunk is the
the sum of the base of the chunk's reserved region plus the adjusted value of
aTop - 1.
|
|
TInt ReserveAt(TUint8* aAddr) const;
Withdrawn in 6.0
Forces allocation of the reserved region of this chunk at the specified linear address.
|
|
TUint8* Base() const;
Returns a pointer to the base of the chunk's reserved region.
|
TInt Size() const;
Returns the current size of this chunk's committed region to this chunk.
|
TInt MaxSize() const;
Returns the maximum size of this chunk. This maximum size of this chunk is set when the chunk is created.
|
TInt Bottom() const;
Returns the offset of the bottom of the double ended chunk's committed region from the base of the chunk's reserved region.
Note that the lowest valid address in a double ended chunk is
the sum of the base of the chunk's reserved region plus the value of
Bottom().
|
TInt Top() const;
Returns the offset of the top of the double ended chunk's committed region from the base of the chunk's reserved region.
Note that the highest valid address in a double ended chunk is
the the sum of the base of the chunk's reserved region plus the value of
Top() - 1.
|
TBool IsReadable() const;
Is the chunk mapped into its process address space?
|
TBool IsWritable() const;
Is the chunk mapped into its process address space and writable?
|
void Read(TInt aPos,TDes8& aDes) const;
Withdrawn in 6.0
Reads data from the chunk into an 8 bit descriptor.
The data is read from the location at offset aPos
from the bottom of the chunk's committed region and copied into the descriptor
aDes.
By default, the number of bytes of data read from the chunk is
the size of the descriptor. However if the number of bytes of data available in
the chunk's committed region is less than the size of aDes, then
this smaller number of bytes is taken. The number of bytes of data available in
the chunk is calculated as the difference between the size of the chunk's
committed region and the value of aPos.
Notes:
The current thread is panicked with KERN-EXEC 6 if
aPos is negative.
The current thread is panicked with KERN-EXEC 6 if
aPos is greater than or equal to the current number of bytes
committed to the chunk (the value returned by the Size() member
function).
|
void Read(TInt aPos,TDes16& aDes) const;
Withdrawn in 6.0
Reads data from the chunk into a 16 bit descriptor.
The data is read from the location at offset aPos
from the bottom of the chunk's committed region and copied into the descriptor
aDes.
By default, the number of double-bytes of data read from the
chunk is the size of the descriptor. However if the number of double-bytes of
data available in the chunk's committed region is less than the size of
aDes, then this smaller number of bytes is taken. The number of
bytes of data available in the chunk is calculated as the difference between
the size of the chunk's committed region and the value of
aPos.
Notes:
The number of bytes read is guaranteed to be an even number and, if necessary, rounded down to the next even number.
The current thread is panicked with KERN-EXEC 6 if
aPos is negative.
The current thread is panicked with KERN-EXEC 6 if
aPos is greater than or equal to the current number of bytes
committed to the chunk (the value returned by the Size() member
function).
|
void Read(TInt aPos,TDes8& aDes,TInt aLength) const;
Withdrawn in 6.0
Reads 8 bit data from the chunk, specifying the length to which the target descriptor is to be re-sized.
The data is read from the location at offset aPos
from the bottom of the chunk's committed region and copied into the descriptor
aDes.
By default the number of bytes of data read from the chunk is
the (new) size of the descriptor. However if the number of bytes of data
available in the chunk's committed region is less than the size of the
descriptor, then this smaller number of bytes is taken. The number of bytes of
data available in the chunk is calculated as the difference between the size of
the chunk's committed region and the value of aPos.
Notes:
The current thread is panicked with KERN-EXEC 6 if
aPos is negative.
The current thread is panicked with KERN-EXEC 6 if
aPos is greater than or equal to the current number of bytes
committed to the chunk (the value returned by the Size() member
function).
|
void Read(TInt aPos,TDes16& aDes,TInt aLength) const;
Withdrawn in 6.0
Reads 16 bit data from the chunk, specifying the length to which the target descriptor is to be re-sized.
The data is read from the location at offset aPos
from the bottom of the chunk's committed region and copied into the descriptor
aDes.
By default the number of double-bytes of data read from the
chunk is the (new) size of the descriptor. However if the amount of data
available in the chunk's committed region is less than the size of the
descriptor, then this smaller number of bytes is taken. The number of bytes of
data available in the chunk is calculated as the difference between the size of
the chunk's committed region and the value of aPos.
Notes:
The number of bytes read is guaranteed to be an even number and, if necessary, rounded down to the next even number.
The current thread is panicked with KERN-EXEC 6 if
aPos is negative.
The current thread is panicked with KERN-EXEC 6 if
aPos is greater than or equal to the current number of bytes
committed to the chunk (the value returned by the Size() member
function).
|
void Write(TInt aPos,const TDesC8& aDes) const;
Withdrawn in 6.0
Writes 8 bit data into the chunk.
The data is taken from the descriptor aDes and
written into the chunk, starting at offset aPos from the bottom of
the chunk's committed region. The number of bytes of data written is the size
of the descriptor aDes.
Note:
The current thread is panicked with KERN-EXEC 7 if
aPos is negative.
The current thread is panicked with KERN-EXEC 7 if
aPos is greater than or equal to the current number of bytes
committed to the chunk (the value returned by the Size() member
function).
The current thread is panicked with KERN-EXEC 7 if
aPos plus the size of the descriptor aDes is greater
than the current number of bytes committed to the chunk (the value returned by
the Size() member function).
|
void Write(TInt aPos,const TDesC16& aDes) const;
Withdrawn in 6.0
Writes 16 bit data into the chunk.
The data is taken from the descriptor aDes and
written into the chunk, starting at offset aPos from the bottom of
the chunk's committed region. The number of bytes of data written is the size
of the descriptor aDes.
Note:
The current thread is panicked with KERN-EXEC 7 if
aPos is negative.
The current thread is panicked with KERN-EXEC 7 if
aPos is greater than or equal to the current number of bytes
committed to the chunk (the value returned by the Size() member
function).
The current thread is panicked with KERN-EXEC 7 if
aPos plus the size of the descriptor aDes is greater
than the current number of bytes committed to the chunk (the value returned by
the Size() member function).
|