beautypg.com

Stacks, System stack and user stack, Figure 7.4 system stack and user stack – Renesas 70 User Manual

Page 150: 2 stacks

background image

Chapter 7 Application Creation Guide

- 140 -

7.2 Stacks

7.2.1

System Stack and User Stack

The MR308 provides two types of stacks: system stack and user stack.

User Stack

One user stack is provided for each task. Therefore, when writing applications with the MR308, it is
necessary to furnish the stack area for each task.

System Stack

This stack is used within the MR308 (during service call processing). When a service call is issued
from a task, the MR308 switches the stack from the user stack to the system stack (See Figure 7.4).

The system stack use the interrupt stack(ISP).

Task

MR308 system call processing

User Stack

User Stack

System Stack

Save Registers

Stack switching

System call

processing

Task selection

Stack switching

Restore Registers

XXX_XXX( )

Figure 7.4 System Stack and User Stack

Switchover from user stack to system stack occurs when an interrupt of vector numbers 0 to 31 or 247 to 255 is
generated. Consequently, all stacks used by the interrupt handler are the system stack.