ENTRY — Subroutine Entry

Instruction Word

Slot
Inst
6
3
6
2
6
1
6
0
5
9
5
8
5
7
5
6
5
5
5
4
5
3
5
2
5
1
5
0
4
9
4
8
4
7
4
6
4
5
4
4
4
3
4
2
4
1
4
0
3
9
3
8
3
7
3
6
3
5
3
4
3
3
3
2
3
1
3
0
2
9
2
8
2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0
1
9
1
8
1
7
1
6
1
5
1
4
1
3
1
2
1
1
1
0
9876543210
Format x24 - 24 bit(s) 0
ENTRY 00110110
s 3210
s 3210
imm12 1
1
1
0
9876543210

Assembler Syntax

ENTRY as, 0..32760

Description

(please consult the Xtensa ® Instruction Set Architecture Reference Manual for any cross references and additional information)

ENTRY is intended to be the first instruction of all subroutines called with CALL4, CALL8, CALL12, CALLX4, CALLX8, or CALLX12. This instruction is not intended to be used by a routine called by CALL0 or CALLX0.

ENTRY serves two purposes:

  1. First, it increments the register window pointer (WindowBase) by the amount requested by the caller (as recorded in the PS.CALLINC field).
  2. Second, it copies the stack pointer from caller to callee and allocates the callee's stack frame. The as operand specifies the stack pointer register; it must specify one of a0..a3 or the operation of ENTRY is undefined. It is read before the window is moved, the stack frame size is subtracted, and then the as register in the moved window is written.

The stack frame size is specified as the 12-bit unsigned imm12 field in units of eight bytes. The size is zero-extended, shifted left by 3, and subtracted from the caller's stack pointer to get the callee's stack pointer. Therefore, stack frames up to 32760 bytes can be specified. The initial stack frame size must be a constant, but subsequently the MOVSP instruction can be used to allocate dynamically-sized objects on the stack, or to further extend a constant stack frame larger than 32760 bytes.

The windowed subroutine call protocol is described in .

ENTRY is undefined if PS.WOE is 0 or if PS.EXCM is 1. Some implementations raise an illegal instruction exception in these cases, as a debugging aid.

Operation

WindowCheck (00, PS.CALLINC, 00)
if as > 3 | PS.WOE = 0 | PS.EXCM = 1 then
	-- undefined operation
	-- may raise illegal instruction exception
else
	AR[PS.CALLINC||s1..0] ← AR[s] − (017||imm12||03)
	WindowBase ← WindowBase + (02||PS.CALLINC)
	WindowStartWindowBase ← 1
endif

Exceptions

EveryInstR Group (see EveryInstR Group:)

Implementation Pipeline

In Out
PSCALLINC Rstage, PSEXCM Rstage, PSWOE Rstage, WindowBase Rstage, WindowStart Rstage, ars Estage WindowBase Rstage, WindowStart Rstage, ars_entry Estage