User’s Manual
C166S V1 SubSystem
Central Processing Unit
User’s Manual
3-50
V 1.6, 2001-08
3.5.1
Context Switch
An Interrupt Service Routine (ISR) or a task scheduler of an operating system usually
saves the contents of all used registers into the stack, and restores them before
returning. The more registers a routine uses, the more time is wasted by saving and
restoring.
The contents of the register bank are switched by changing the base address of the
memory-mapped GPR bank. The base address is given by the contents of the Context
Pointer (CP) register.
The Context Pointer
The CP register is not bit-addressable. It can be updated via any instruction capable of
modifying SFRs.
Note: It is the user’s responsibility to ensure that the physical GPR address specified via
CP register plus short GPR address must always be an RAM location. If this
condition is not met, unexpected results may occur. Do not set CP below the
DPRAM start address.
Note: Due to the internal instruction pipeline, a new CP value cannot be used for GPR
address calculations for the instruction immediately following the instruction
updating the CP register.
CP
Context Pointer
SFR(FE10
H
,08
H
)
Reset value: FC00
H
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
1
1
1
1
CP
0
r
r
r
r
rw
r
Field
Bits
Type Description
1
[15:12] r
CP always points in the DPRAM
CP
[11:1]
rw
Modifiable portion of register CP
Specifies the (word) base address of the current
memory-mapped register bank.
Note: When writing a value to register CP with
bits CP[11:9] = 000, bits CP[11:10] are
set to 11 by hardware.
0
[0]
r
CP is always word-aligned
Содержание C166S V1 SubSystem
Страница 10: ...User s Manual C166S V1 SubSystem User s Manual I 6 V 1 6 2001 08...
Страница 16: ...User s Manual C166S V1 SubSystem Introduction User s Manual 1 6 V 1 6 2001 08...
Страница 126: ...User s Manual C166S V1 SubSystem Central Processing Unit User s Manual 3 96 V 1 6 2001 08...
Страница 178: ...User s Manual C166S V1 SubSystem Memory Organization User s Manual 4 52 V 1 6 2001 08...
Страница 206: ...User s Manual C166S V1 SubSystem Instruction Set User s Manual 5 28 V 1 6 2001 08...
Страница 306: ...User s Manual C166S V1 SubSystem Detailed Instruction Set User s Manual 6 100 V 1 6 2001 08...
Страница 362: ...User s Manual C166S V1 SubSystem The External Bus Interface User s Manual 8 40 V 1 6 2001 08...
Страница 452: ...User s Manual C166S V1 SubSystem General Purpose Timer Unit User s Manual 12 44 V 1 6 2001 08...
Страница 454: ...User s Manual C166S V1 SubSystem Instruction Index User s Manual 13 2 V 1 6 2001 08...
Страница 459: ......