30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.2. ADDRESS SPACE MANAGEMENT FUNCTIONS 223<br />

• ER ChkSpaceR( VP addr, INT len )<br />

• ER ChkSpaceRW( VP addr, INT len )<br />

• ER ChkSpaceRE( VP addr, INT len )<br />

Checks access privilege to the memory space of len bytes from location addr.<br />

• INT ChkSpaceBstrR( UB *str, INT max )<br />

• INT ChkSpaceBstrRW( UB *str, INT max )<br />

Checks access privilege to the memory space from str up to the string termination (’\0’) or up to<br />

the number of characters (bytes) designated in max, whichever comes first. If max = 0 is set, max<br />

is ignored and privilege is checked up to the string termination.<br />

If access is allowed, the length of the string (in bytes) is returned. If the string termination occurred<br />

up to the string length indicated in max, the length to the character before ’\0’ is returned; if max<br />

characters occurred before the string termination, max is returned.<br />

• INT ChkSpaceTstrR( TC *str, INT max )<br />

• INT ChkSpaceTstrRW( TC *str, INT max )<br />

typedef UH TC; /* TRON character code */<br />

#define TNULL((TC)0) /* TRON code string termination */<br />

Checks access privilege to the memory space from str up to the TRON Code string termination<br />

(TNULL) or up to the number of characters (TC count) designated in max, whichever comes first.<br />

If max = 0 is set, max is ignored and privilege is checked up to the string termination.<br />

If access is allowed, the length of the string (TC count) is returned. If the string termination<br />

occurred up to the string length indicated in max, the length to the character before TNULL is<br />

returned; if max characters occurred before the string termination, max is returned.<br />

str must be an even-numbered address.<br />

5.2.3 Lock Address Space<br />

Generally memory is made resident or nonresident a page at a time and is managed in page units. For<br />

this reason, in many cases the OS does not check for matching of locked and unlocked spaces. It is<br />

the responsibility of the calling side to make sure the same spaces are designated in lock and unlock<br />

operations.<br />

• ER LockSpace( VP addr, INT len )<br />

Locks (makes resident) the memory space of len bytes from location addr.<br />

E MACV<br />

The memory does not exist<br />

• ER UnlockSpace( VP addr, INT len )<br />

Unlocks (makes nonresident) the memory space of len bytes from location addr. If the same space<br />

was locked more than once, it is not unlocked until the number of unlock operations equals the<br />

number of lock operations.<br />

Note that it is not possible to unlock just part of a locked space.<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!