a5805e8345672b20fd8474b99e40c78add4bca15
[platform/upstream/libunwind.git] / src / ia64 / NOTES
1 - the frame state consists of the following:
2
3         - ip    current instruction pointer
4         - sp    current stack pointer value
5         - bsp   current backing store pointer
6         - cfm   current frame mask
7
8   these are derived from the next younger (more deeply nested) frame
9   as follows:
10
11         - ip  == saved return-link (may be b0 or an alternate branch-reg)
12         - sp  == if younger frame has a fixed-sized frame, sp + size-of-frame,
13                  else saved sp
14         - cfm == saved ar.pfs
15         - bsp == if ar.bsp has been saved, saved ar.bsp, otherwise,
16                  ar.bsp \ominus saved ar.pfs.pfm.sol
17
18 The unwind cursor should represent the machine state as it existed at
19 the address contained in register ip.  This state consists of the
20 *current* frame state and the save locations in the next younger
21 frame.
22
23 An unwind script current takes the old save locations and updates them
24 for the next older frame.  With the new setup, we need to update the
25 frame state first, without updating the other save locations.  For this
26 to work, we need the following info:
27
28         - save location of return-link
29         - save location of ar.pfs
30         - save location of bsp (if it has been saved)
31         - size of stack frame (fixed case) or save location of sp
32
33
34 setup:
35
36   func:   ...
37           ...
38           ...
39           br.call foo   <-- call site
40           ...           <-- ip
41           ...
42
43 initial state:
44
45         The unwind cursor represents the (preserved) machine state
46         as it existed at "ip".
47
48         Evaluating the unwind descriptors for "ip" yields the following
49         info:
50
51                 - frame size at call site (or previous sp)
52                 - what registers where saved where by func before
53                   the call site was reached
54
55
56         Note that there is some procedure info that needs to be obtained
57         for the new "ip" which is contained in the unwind descriptors.
58         Specifically, the following is needed:
59
60                         - procedure's start address
61                         - personality address
62                         - pointer to language-specific data area
63
64         This info is stored in a separate proc_info structure and needs
65         to be obtained right after running the unwind script for func.