PROCEDURE CALLS
7-4
7.1.2
Local Register and Stack Management
Global register g15 (FP) and local registers r0 (PFP), r1 (SP) and r2 (RIP) contain information to
link procedures together and link local registers to the procedure stack (
Figure 7-1
). The following
subsections describe this linkage information.
7.1.2.1
Frame Pointer
The frame pointer is the current stack frame’s first byte address. It is stored in global register g15,
the frame pointer (FP) register. The FP register is always reserved for the frame pointer; do not use
g15 for general storage.
Stack frame alignment is defined for each implementation of the i960 processor family, according
to an SALIGN parameter (see
section A.3, “Data and Data Structure Alignment” (pg. A-3)
). In the
i960 Jx processor, stacks are aligned on 16-byte boundaries (see
Figure 7-1
). When the processor
needs to create a new frame on a procedure call, it adds a padding area to the stack so that the new
frame starts on a 16-byte boundary.
7.1.2.2
Stack Pointer
The stack pointer is the byte-aligned address of the stack frame’s next unused byte. The stack
pointer value is stored in local register r1, the stack pointer (SP) register. The procedure stack
grows upward (i.e., toward higher addresses). When a stack frame is created, the processor
automatically adds 64 to the frame pointer value and stores the result in the SP register. This action
creates the register save area in the stack frame for the local registers.
The program must modify the SP register value when data is stored or removed from the stack.
The i960 architecture does not provide an explicit push or pop instruction to perform this action.
This is typically done by adding the size of all pushes to the stack in one operation.
7.1.2.3
Considerations When Pushing Data onto the Stack
Care should be taken in writing to the stack in the presence of unforeseen faults and interrupts. In
the general case, to ensure that the data written to the stack is not corrupted by a fault or interrupt
record, the SP should be incremented first to allocate the space, and then the data should be written
to the allocated space:
mov
sp,r4
addo
24,sp,sp
st
data,(r4)
...
st
data,20(r4)
Содержание i960 Jx
Страница 1: ...Release Date December 1997 Order Number 272483 002 i960 Jx Microprocessor Developer s Manual ...
Страница 24: ......
Страница 25: ...1 INTRODUCTION ...
Страница 26: ......
Страница 35: ...2 DATA TYPES AND MEMORY ADDRESSING MODES ...
Страница 36: ......
Страница 46: ......
Страница 47: ...3 PROGRAMMING ENVIRONMENT ...
Страница 48: ......
Страница 73: ...4 CACHE AND ON CHIP DATA RAM ...
Страница 74: ......
Страница 85: ...5 INSTRUCTION SET OVERVIEW ...
Страница 86: ......
Страница 111: ...6 INSTRUCTION SET REFERENCE ...
Страница 112: ......
Страница 195: ...INSTRUCTION SET REFERENCE 6 83 6 Opcode mov 5CCH REG movl 5DCH REG movt 5ECH REG movq 5FCH REG See Also LOAD STORE lda ...
Страница 233: ...7 PROCEDURE CALLS ...
Страница 234: ......
Страница 256: ......
Страница 257: ...8 FAULTS ...
Страница 258: ......
Страница 291: ...9 TRACING AND DEBUGGING ...
Страница 292: ......
Страница 309: ...10 TIMERS ...
Страница 310: ......
Страница 324: ......
Страница 325: ...11 INTERRUPTS ...
Страница 326: ......
Страница 369: ...12 INITIALIZATION AND SYSTEM REQUIREMENTS ...
Страница 370: ......
Страница 412: ......
Страница 413: ...13 MEMORY CONFIGURATION ...
Страница 414: ......
Страница 429: ...14 EXTERNAL BUS ...
Страница 430: ......
Страница 468: ......
Страница 469: ...15 TEST FEATURES ...
Страница 470: ......
Страница 493: ...A CONSIDERATIONS FOR WRITING PORTABLE CODE ...
Страница 494: ......
Страница 502: ......
Страница 503: ...B OPCODES AND EXECUTION TIMES ...
Страница 504: ......
Страница 515: ...C MACHINE LEVEL INSTRUCTION FORMATS ...
Страница 516: ......
Страница 523: ...D REGISTER AND DATA STRUCTURES ...
Страница 524: ......
Страница 550: ......
Страница 551: ...GLOSSARY ...
Страница 552: ......
Страница 561: ...INDEX ...
Страница 562: ......
Страница 578: ......