35.3.7.1. UNCONDITIONAL JUMPS AND CALLS ON SPARC
SPARC format 1
+-----------------------+
| 21..30 01 |
| 29..0 disp30 |
+-----------------------+
Operation Description
call Call and Link
call label
r15 <- PC (Link Address)
[Out Register 7]
PC <- PC + (4 * sign_ext(disp30))
SPARC format 3
+-----------------------+-----------------------+
| 31..30 10 | 31..30 10 |
| 29..25 rd | 29..25 rd |
| 24..19 op3 | 24..19 op3 |
| 18..14 rs1 | 18..14 rs1 |
| 13 i=0 | 13 i=1 |
| 12..5 -- | 12..0 simm13 |
| 4..0 rs2 | |
+-----------------------+-----------------------+
Operation op3 Description
jmpl 11 1000 Jump and Link
jmpl address,reg(rd)
rd <- PC
if (i = 0)
{
PC <- reg(rs1) + reg(rs2)
} else {
PC <- reg(rs1) + sign_extend(simm12)
}
Note: JUMPL with rd = 0 can be used for return from subroutine.
(Typical Return address is r[31]+8 if a nonleaf routine
(i.e. routine, which used SAVE instruction is entered by CALL),
or r[15]+8 if this is leaf routine, if entered by CALL or JMPL
with rd = 15.
SPARC format 3
+-----------------------+-----------------------+
| 31..30 10 | 31..30 10 |
| 29..25 --- | 29..25 --- |
| 24..19 op3 | 24..19 op3 |
| 18..14 rs1 | 18..14 rs1 |
| 13 i=0 | 13 i=1 |
| 12..5 -- | 12..0 simm13 |
| 4..0 rs2 | |
+-----------------------+-----------------------+
Operation op3 description
return 11 1001 Return
return address
if (i = 0)
{
PC <- r[rs1] + r[rs2]
} else {
PC <- r[rs1] + sign_ext(simm13)
}
SPARC format 3
+-----------------------+-----------------------+
| 31..30 10 | 31..30 10 |
| 29..25 rd | 29..25 rd |
| 24..19 op3 | 24..19 op3 |
| 18..14 rs1 | 18..14 rs1 |
| 13 i=0 | 13 i=1 |
| 12..5 -- | 12..0 simm13 |
| 4..0 rs2 | |
+-----------------------+-----------------------+
Operation op3 Description
save 11 1100 Save caller's registers window
restore 11 1101 Restore caller's registers window
save reg(rs1),reg(rs2),reg(rd)
restore reg(rs1),simm13,reg(rd)
Note:
Save instruction:
"out" registers become "in" registers
"out" and "local" become zero or value from executing process
restor instruction:
"in" register become "out" registers
TO DO: Insert Here Description of Register Windows on SPARC
SPARC Format 3
+-----------------------+
| 31..30 10 |
| 29..25 fcn |
| 24..19 op3 |
| 18..0 -- |
+-----------------------+
Operation op3 fcn Description
saved 11 0001 0 Window has been saved
restored 11 0001 1 Window has been restored
saved << No operand(s) >>
restored << No operand(s) >>
Modify saved/restored counters
// ----------------------------------------------------------------------
Index Prev Next