# MIPS/IRIX  ISA/ABI
# Used to configure dwarfdump printing of .debug_frame and
# .eh_frame.

# Any number of abi's can be described. Only one can be selected
# in a given darfdump run (see dwarfdump options)
#  Available commands are
# beginabi:  <abiname>
# reg: <regname> <dwarf regnumber>
# frame_interface: <integer value 2 or 3>
# cfa_reg:  <number>
# initial_reg_value:  <number: normally 1034 or 1035 >
# reg_table_size: <size of table>
# endabi:  <abiname>
#
# Symbolic names do not work here, use literal numbers
# where applicable (in C standard decimal, octal (leading 0) or
# hexadecimal <leading 0x>).
#
# Whitespace is required to separate command: from operands and
# operands from each other on a line.
#
# There is no ordering required within a beginabi/endabi pair.
# As many ABIs as required may be listed.
# dwarfdump will choose exactly one abi to dump frame information.
#


# Here using MIPS abi as an example to describe
# the format. The MIPS/IRIX ABI is built-in to dwarfdump, so this one
# is not really required.
# Begin with abi name (use here and on dwarfdump command line).
beginabi: mips

# Instructs dwarfdump to default to the older frame interface.
# Use value 3 to use the newer interface.
# The '2' interface is supported but deprecated (deprecated
# because it cannot work with all popular ABIs: mixing
# the cfa-rule into the table column set was not a good idea
# but it is part of the MIPS/IRIX standard usage).
frame_interface: 2

# If (and only if) using  frame_interface: 2 tell dwarfdump
# what table colum that DW_FRAME_CFA_COL is.
# If using frame_interface: 3 cfa_reg: should be 
#  DW_FRAME_CFA_COL3 (1036)
cfa_reg: 0

# For MIPS, the same as DW_FRAME_SAME_VAL (1035).
# For other ISA/ABIs 1034 (DW_FRAME_UNDEFINED_VAL) might be better.
# Depends on the ABI convention, if set wrong way too many
# regs will be listed in the frame output.
# This instructs  dwarfdump  to set libdwarf to this value,
# overriding the libdwarf default.
# If initial_reg_value not set the libdwarf default is used
# (see libdwarf.h DW_FRAME_REG_INITIAL_VALUE).
initial_reg_value:  1035  # DW_FRAME_SAME_VAL

# Built in to frame_interface: 2 as 66.
reg_table_size: 66


# Only name registers for wich a r4 (for example) is not what you
# want to  see
# No particular order  of the reg: lines required.
reg: cfa 0   # Used with MIPS/IRIX original DWARF2 interface
reg: r1/at 1
reg: r2/v0 2 
reg: r3/v1 3
reg: r4/a0  4
reg: r5/a1  5
reg: r6/a2  6
reg: r7/a3  7
reg: r8/t0  8
reg: r9/t1  9
reg: r10/t2 10
reg: r11/t3 11
reg: r12/t4 12
reg: r13/t5 13
reg: r14/t6 14
reg: r15/t7 15
reg: r16/s0 16
reg: r17/s1 17
reg: r18/s2 18
reg: r19/s3 19
reg: r20/s4 20
reg: r21/s5 21
reg: r22/s6 22
reg: r23/s7 23
reg: r24/t8 24
reg: r25/t9 25
reg: r26/k0 26
reg: r27/k1 27
reg: r28/gp 28
reg: r29/sp 29
reg: r30/s8 30
reg: r31  31

reg: $f0 32
reg: $f1 33
reg: $f2  34
reg: $f3 35
reg: $f4 36
reg: $f5 37
reg: $f6 38
reg: $f7 39
reg: $f8 40
reg: $f9 41
reg: $f10 42
reg: $f11 43
reg: $f12 44
reg: $f13 45
reg: $f14  46
reg: $f15 47
reg: $f16 48
reg: $f17 49
reg: $f18 50
reg: $f19 51
reg: $f20 52
reg: $f21 53
reg: $f22 54
reg: $f23 55
reg: $f24 56
reg: $f25 57
reg: $f26 58
reg: $f27 59
reg: $f28 60
reg: $f29 61
reg: $f30 62
reg: $f31 63
reg: ra  64
reg: slk 65


# End of abi definition.
endabi: mips






# MIPS/IRIX  ISA/ABI for testing libdwarf.
beginabi: mips-simple
frame_interface: 2
reg_table_size: 66
cfa_reg: 0
initial_reg_value:  1035

reg: cfa 0   # Used with MIPS/IRIX original DWARF2 interface
reg: ra  64
reg: slk 65

# End of abi definition.
endabi: mips-simple

# MIPS/IRIX  ISA/ABI for testing  the new frame interface
# with libdwarf.
beginabi: mips-simple3
frame_interface: 3

# When using frame_interface: 3 the size of the register table
# is not fixed. It can be as large as needed. 
reg_table_size: 66
cfa_reg: 1036  # DW_FRAME_CFA_COL3
initial_reg_value:  1035

# No cfa as a 'normal' register. 
# Rule 0 is just register 0, which is not used
# in frame descriptions.
# (so cfa does not have a number here, and dwarfdump gives
# it the name 'cfa' automatically).
reg: ra  64
reg: slk 65
# End of abi definition.
endabi: mips-simple3


beginabi: ia64
frame_interface: 3
initial_reg_value: 1034  # DW_FRAME_UNDEFINED_VAL
cfa_reg: 1036  # DW_FRAME_CFA_COL3
reg_table_size: 695

# The following register names are not necessarily correct...
# Register indexes r32-r127 not used.
reg: f0 128
# ...
reg: f127 255
reg: b0 321
reg: b1 322
reg: b2 323
reg: b3 324
reg: b4 325
reg: b5 326
reg: b6 327
reg: b7 328
reg: vfp 329
reg: vrap 330
reg: pr 331
reg: ip 332
reg: psr 333
reg: cfm 334
reg: k0 335
reg: k1 336
reg: k2 337
reg: k3 338
reg: k4 339
reg: k5 340
reg: k6 341
reg: k7 342
reg: rsc  350 
reg: bsp 351 
reg: bspstore 352 
reg: rnat 353
reg: fcr 355
reg: eflag 358
reg: csd 359
reg: ssd 360 
reg: cflg 361
reg:  fsr 362
reg: fir 363
reg:  fdr 364
reg: pfs 398 
reg: lc 399
reg: ec 400

endabi: ia64


beginabi: x86
frame_interface: 3
initial_reg_value: 1035  # DW_FRAME_SAME_VAL
reg_table_size: 66  # more than large enough, hopefully.
cfa_reg: 1036  # DW_FRAME_CFA_COL3

# The following register names are not necessarily correct...
reg: eax 0
reg: ecx 1    
reg: edx 2
reg: ebx 3
reg: esp 4
reg: ebp 5
reg: esi 6
reg: edi 7
reg: eip 8
reg: eflags 9

reg: trapno 10
reg: st0 11
reg: st1 12
reg: st2 13
reg: st3 14
reg: st4 15
reg: st5 16
reg: st6 17
reg: st7 18
# 19 is ? 20 is ?
reg: xmm0  21
reg: xmm1  22 
reg: xmm2  23
reg: xmm3  24
reg: xmm4  25
reg: xmm5  26
reg: xmm6  27
reg: xmm7  28

reg: mm0  29
reg: mm1  30
reg: mm2  31
reg: mm3  32
reg: mm4  33
reg: mm5  34
reg: mm6  35
reg: mm7  36

reg: fcw  37
reg: fsw  38
reg: mxcsr 39

reg: es 40
reg: cs 41
reg: ss 42
reg: ds 43
reg: fs 44
reg: gs 45
# 46 47 are ?
reg: tr 48
reg: ldtr 49


endabi: x86


beginabi: x86_64
frame_interface: 3
initial_reg_value: 1035  # DW_FRAME_SAME_VAL
reg_table_size: 66  # more than large enough, hopefully.
cfa_reg: 1036  # DW_FRAME_CFA_COL3

# The following register names are not necessarily correct...
reg: rax 0
reg: rdx 1    
reg: rcx 2
reg: rbx 3
reg: rsi 4
reg: rdi 5
reg: rbp 6
reg: rsp 7
reg: r8 8
reg: r9 9
reg: r10 10
reg: r11 11
reg: r12 12
reg: r13 13
reg: r14 14
reg: r15 15
reg: rip 16
reg: xmm0 17
reg: xmm1 18
reg: xmm2 19
reg: xmm3 20
reg: xmm4 21
reg: xmm5 22
reg: xmm6 23
reg: xmm7 24
reg: xmm8 25
reg: xmm9 26
reg: xmm10 27
reg: xmm11 28
reg: xmm12 29
reg: xmm13 30
reg: xmm14 31
reg: xmm15 32

reg: st0 33
reg: st1 34
reg: st2 35
reg: st3 36
reg: st4 37
reg: st5 38
reg: st6 39
reg: st7 40

reg: mm0 41
reg: mm1 42
reg: mm2 43
reg: mm3 44
reg: mm4 45
reg: mm5 46
reg: mm6 47
reg: mm7 48

reg: rflags 49
reg: es 50
reg: cs 51
reg: ss 52
reg: ds 53
reg: fs 54
reg: gs 55
# 56, 57 are ?
reg: fs.base 58
reg: gs.base 59
# 60 61 are ?
reg: tr 62
reg: ldtr 63

endabi: x86_64

beginabi: m68k
frame_interface: 3
initial_reg_value: 1035  # DW_FRAME_SAME_VAL
reg_table_size: 66  # more than large enough, hopefully.
cfa_reg: 1036  # DW_FRAME_CFA_COL3

reg: d0 0
reg: d1 1
reg: d2 2
reg: d3 3
reg: d4 4
reg: d5 5
reg: d6 6
reg: d7 7

reg: a0 8
reg: a1 9
reg: a2 10
reg: a3 11
reg: a4 12
reg: a5 13
reg: a6 14
reg: sp 15

reg: fp0 16
reg: fp1 17
reg: fp2 18
reg: fp3 19
reg: fp4 20
reg: fp5 21
reg: fp6 22
reg: pc 23

endabi: m68k

# 'Generic 1000 register abi'.
# This is useful as a 'general' ABI settings for
# cpus using up to 1000 registers. The register names
# show as a number, like  'r991'.
beginabi: generic
frame_interface: 3
initial_reg_value: 1035  # DW_FRAME_SAME_VAL
cfa_reg: 1036  # DW_FRAME_CFA_COL3
reg_table_size: 1000
reg: r0 0
endabi: generic
