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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

222 CHAPTER 5. T-KERNEL/SM<br />

5.2 Address Space Management Functions<br />

Memory access privilege is held as access privilege information for each task. Essentially access privilege<br />

information indicates the right to access at the protection level immediately before an extended SVC is<br />

called. If, for example, a task is running at protection level 3 when it calls an extended SVC, its access<br />

privilege information indicates the right to access at protection level 3. Since the protection level when<br />

an extended SVC is executing is protection level 0, in the case of nested calling of an extended SVC<br />

from another extended SVC, access privilege information in the extended SVC for which a nested call<br />

was made indicates the right to access at protection level 0.<br />

Memory access privilege information is set as follows.<br />

• Immediately after a task is started, its access privilege is that designated when the task was<br />

created.<br />

• When an extended SVC is called, the access privilege at the protection level at which it was<br />

running at the time of the call is set.<br />

• Upon return from the extended SVC, the access privilege reverts to that at the time the extended<br />

SVC was called.<br />

• Executing SetTaskSpace() copies the current access privilege of the target task to the invoking<br />

task.<br />

5.2.1 Address Space Configuration<br />

• ER SetTaskSpace( ID tskid )<br />

Assigns to the invoking task the task space and access privilege information of the task designated<br />

in tskid. As a result, both the invoking task and target task have the same task space and access<br />

privilege information.<br />

Note that this copying of task space information applies only at the time the function is called; if<br />

thereafter the task designated in tskid switches to a different address space and its access privilege<br />

changes, the invoking task is not affected by those changes (its address space and access privilege<br />

do not change accordingly). If the invoking task is calling an extended SVC, on return from the<br />

extended SVC its access privilege reverts to that prior to calling the extended SVC. Its task space,<br />

however, does not revert.<br />

The task ID of the invoking task cannot be designated in tskid. However, if TSK SELF is used to<br />

designate the invoking task, access privilege is set to the currently running protection level; task<br />

space is not switched in this case.<br />

E ID<br />

E NOEXS<br />

E OBJ<br />

tskid is invalid<br />

Object does not exist (the task designated in tskid does not exist)<br />

Invoking task designated by other than TSK SELF<br />

5.2.2 Address Space Checking<br />

The following functions check whether access is allowed to the designated memory space, based on the<br />

current access privilege information. If access cannot be made (no privilege or the memory does not<br />

exist), they return error code E MACV.<br />

—R Check for read access privilege.<br />

—RW Check for read and write access privilege.<br />

—RE Check for read and execute access privilege.<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!