遇到一点IA64的汇编,实在不懂,想 请教大家:
1. 汇编语言子函数的NESTED_SETUP (2,6,8,0)什么意思?
2. ld8都是存的是什么,[r8], 8的如何改变的?
3. save和restore是如何实现的?
//
// Note: use of NESTED_SETUP requires number of locals (l) >= 3
//
#define NESTED_SETUP(i, l, o, r) \
alloc loc1=ar##.##pfs,i,l,o,r ;\
mov loc0=b0
#define NESTED_RETURN mov b0 = loc0; \
\
mov ar##.##pfs = loc1;; \
br##.##ret##.##dpnt b0;;
// void AsmLLCALLEX (UINTN FunctionAddr, UINTN StackPointer)
PROCEDURE_ENTRY(AsmLLCALLEX)
NESTED_SETUP (2,6,8,0)
// NESTED_SETUP uses loc0 and loc1 for context save
//
// Save a copy of the VM stack pointer
//
mov r8 = in1;;
//
// Copy stack arguments from stack into registers.
// Assume worst case and copy 8.
//
ld8 out0 = [r8], 8;;
ld8 out1 = [r8], 8;;
ld8 out2 = [r8], 8;;
ld8 out3 = [r8], 8;;
ld8 out4 = [r8], 8;;
ld8 out5 = [r8], 8;;
ld8 out6 = [r8], 8;;
ld8 out7 = [r8], 8;;
//
// Save the original stack pointer
//
mov loc2 = r12;
//
// Save the gp
//
or loc3 = r1, r0
//
// Set the new aligned stack pointer. Reserve space for the required
// 16-bytes of scratch area as well.
//
add r12 = 48, in1
//
// Now call the function. Load up the function address from the descriptor
// pointed to by in0. Then get the gp from the descriptor at the following
// address in the descriptor.
//
ld8 r31 = [in0], 8;;
ld8 r30 = [in0];;
mov b1 = r31
mov r1 = r30
(p0) br.call.dptk.many b0 = b1;;
//
// Restore the original stack pointer and gp
//
mov r12 = loc2
or r1 = loc3, r0
//
// Now return
//
NESTED_RETURN
PROCEDURE_EXIT(AsmLLCALLEX)