Crash Dump Analysis: Sparc V9
Crash Dump Analysis: Sparc V9
Crash Dump Analysis: Sparc V9
SPARC V9
Jakub Jerm
Martin Dck
Crash Dump Analysis MFF UK SPARC V9 2
SPARC V9 overview
Big-endian
Crash Dump Analysis MFF UK SPARC V9 3
SPARC V9 overview (2)
Register windows
Processor supplements
Crash Dump Analysis MFF UK SPARC V9 5
SPARC V9 ABI
32 64-bit GPRs
r0 r31
r0 r7 g0 g7 (Globals)
r8 r15 o0 o7 (Outs)
Program counter
pc current instruction
ccr
Invariant:
NWINDOW 2
=
CANSAVE + CANRESTORE + OTHERWIN
Crash Dump Analysis MFF UK SPARC V9 11
Register Windows (4)
CANRESTORE CANRESTORE 1
on RESTORE
CANRESTORE CANRESTORE + 1
on SAVE
Simpler design
Poorer performance
Up to version 4.0.2
gcc -mflat
Crash Dump Analysis MFF UK SPARC V9 16
Flat Mode (2)
Informal classification
FPU instructions
Logical instructions
Synthetic instructions
SETHI
Crash Dump Analysis MFF UK SPARC V9 25
Common instructions (2)
CALL
Call function
%npc address
Bccond
Prediction bit
pt probably taken
Anul bit
BRrcond
rcond is [N]Z ([not] zero), LEZ (<= 0), LZ (< 0), GZ (>0),
GEZ (>= 0)
Prediction bit
pt probably taken
Anul bit
RET
Synthetic
RETL
Synthetic
SAVE
RESTORE
RESTORE %rs1,imm,%rd
like ADD
RETURN
NOP
No operation
MOV
Synthetic
Crash Dump Analysis MFF UK SPARC V9 31
Common instructions (8)
SETHI
Initial state
No instructions
executed
Inherited stack
pointer from
main()'s caller
Crash Dump Analysis MFF UK SPARC V9 38
Stack and Code Example (2)
main: save %sp, -0xc0, %sp
main+4: call -0x34 <foo>
main+8: mov %i0, %o0
main+0xc: ret
main+0x10: restore %g0, %o0, %o0
0xffffffff7ffffba0: 0
0xffffffff7ffffba8: 0
0xffffffff7ffffbb0: 0
0xffffffff7ffffbb8: 0
0xffffffff7ffffbc0: 0
0xffffffff7ffffbc8: 0
0xffffffff7ffffbd0: 0
0xffffffff7ffffbd8: 0
0xffffffff7ffffbe0: 1
0xffffffff7ffffbe8: 0xffffffff7ffffd18
0xffffffff7ffffbf0: 0xffffffff7ffffd28
0xffffffff7ffffbf8: test.sparc`environ
0xffffffff7ffffc00: 0x100000000
0xffffffff7ffffc08: 0x1c00
0xffffffff7ffffc10: 0xffffffff7ffff461
0xffffffff7ffffc18: _start+0x7c
0xffffffff7ffffc20: 4
0xffffffff7ffffc28: 0xffffffff7ffffd28
0xffffffff7ffffc30: 5
0xffffffff7ffffc38: 0xffffffff7ffffda8
0xffffffff7ffffc40: 0
0xffffffff7ffffc48: 0
0xffffffff7ffffc50: 0
0xffffffff7ffffc58: 0
0xffffffff7ffffc60: 1
Allocate a new
register window
192 bytes of
stack space
allocated
Old Outs
became new
Ins
Crash Dump Analysis MFF UK SPARC V9 39
Stack and Code Example (2)
main: save %sp, -0xc0, %sp
main+4: call -0x34 <foo>
main+8: mov %i0, %o0
main+0xc: ret
main+0x10: restore %g0, %o0, %o0
0xffffffff7ffffba0: 0
0xffffffff7ffffba8: 0
0xffffffff7ffffbb0: 0
0xffffffff7ffffbb8: 0
0xffffffff7ffffbc0: 0
0xffffffff7ffffbc8: 0
0xffffffff7ffffbd0: 0
0xffffffff7ffffbd8: 0
0xffffffff7ffffbe0: 1
0xffffffff7ffffbe8: 0xffffffff7ffffd18
0xffffffff7ffffbf0: 0xffffffff7ffffd28
0xffffffff7ffffbf8: test.sparc`environ
0xffffffff7ffffc00: 0x100000000
0xffffffff7ffffc08: 0x1c00
0xffffffff7ffffc10: 0xffffffff7ffff461
0xffffffff7ffffc18: _start+0x7c
0xffffffff7ffffc20: 4
0xffffffff7ffffc28: 0xffffffff7ffffd28
0xffffffff7ffffc30: 5
0xffffffff7ffffc38: 0xffffffff7ffffda8
0xffffffff7ffffc40: 0
0xffffffff7ffffc48: 0
0xffffffff7ffffc50: 0
0xffffffff7ffffc58: 0
0xffffffff7ffffc60: 1
Call foo()
No control
transfer yet
%o7 main+4
%npc foo
%pc main+8
Crash Dump Analysis MFF UK SPARC V9 40
Stack and Code Example (2)
main: save %sp, -0xc0, %sp
main+4: call -0x34 <foo>
main+8: mov %i0, %o0
main+0xc: ret
main+0x10: restore %g0, %o0, %o0
0xffffffff7ffffba0: 0
0xffffffff7ffffba8: 0
0xffffffff7ffffbb0: 0
0xffffffff7ffffbb8: 0
0xffffffff7ffffbc0: 0
0xffffffff7ffffbc8: 0
0xffffffff7ffffbd0: 0
0xffffffff7ffffbd8: 0
0xffffffff7ffffbe0: 1
0xffffffff7ffffbe8: 0xffffffff7ffffd18
0xffffffff7ffffbf0: 0xffffffff7ffffd28
0xffffffff7ffffbf8: test.sparc`environ
0xffffffff7ffffc00: 0x100000000
0xffffffff7ffffc08: 0x1c00
0xffffffff7ffffc10: 0xffffffff7ffff461
0xffffffff7ffffc18: _start+0x7c
0xffffffff7ffffc20: 4
0xffffffff7ffffc28: 0xffffffff7ffffd28
0xffffffff7ffffc30: 5
0xffffffff7ffffc38: 0xffffffff7ffffda8
0xffffffff7ffffc40: 0
0xffffffff7ffffc48: 0
0xffffffff7ffffc50: 0
0xffffffff7ffffc58: 0
0xffffffff7ffffc60: 1
Delay slot
instruction
Copy incoming
argument to
outgoing
argument
Crash Dump Analysis MFF UK SPARC V9 41
Stack and Code Example (2)
0xffffffff7ffffae0: 0
0xffffffff7ffffae8: 0
0xffffffff7ffffaf0: 0
0xffffffff7ffffaf8: 0
0xffffffff7ffffb00: 0
0xffffffff7ffffb08: 0
0xffffffff7ffffb10: 0
0xffffffff7ffffb18: 0
0xffffffff7ffffb20: 1
0xffffffff7ffffb28: 0
0xffffffff7ffffb30: 0
0xffffffff7ffffb38: 0
0xffffffff7ffffb40: 0
0xffffffff7ffffb48: 0
0xffffffff7ffffb50: 0xffffffff7ffff3a1
0xffffffff7ffffb58: main+4
0xffffffff7ffffb60: 0
0xffffffff7ffffb68: 0
0xffffffff7ffffb70: 0
0xffffffff7ffffb78: 0
0xffffffff7ffffb80: 0
0xffffffff7ffffb88: 0
0xffffffff7ffffb90: 0
0xffffffff7ffffb98: 0xffffffff7f736c90
0xffffffff7ffffba0: 0
0xffffffff7ffffba8: 0
0xffffffff7ffffbb0: 0
0xffffffff7ffffbb8: 0
0xffffffff7ffffbc0: 0
0xffffffff7ffffbc8: 0
0xffffffff7ffffbd0: 0
0xffffffff7ffffbd8: 0
0xffffffff7ffffbe0: 1
0xffffffff7ffffbe8: 0xffffffff7ffffd18
0xffffffff7ffffbf0: 0xffffffff7ffffd28
0xffffffff7ffffbf8: test.sparc`environ
0xffffffff7ffffc00: 0x100000000
0xffffffff7ffffc08: 0x1c00
0xffffffff7ffffc10: 0xffffffff7ffff461
0xffffffff7ffffc18: _start+0x7c
0xffffffff7ffffc20: 4
0xffffffff7ffffc28: 0xffffffff7ffffd28
0xffffffff7ffffc30: 5
0xffffffff7ffffc38: 0xffffffff7ffffda8
0xffffffff7ffffc40: 0
0xffffffff7ffffc48: 0
0xffffffff7ffffc50: 0
0xffffffff7ffffc58: 0
0xffffffff7ffffc60: 1
Allocate a new
register window
192 bytes of
stack space
allocated
Old Outs
became new
Ins
foo: save %sp, -0xc0, %sp
foo+4: call +0x10 <bar>
foo+8: mov %i0, %o0
foo+0xc: ret
foo+0x10: restore %g0, %o0, %o0
Crash Dump Analysis MFF UK SPARC V9 42
Stack and Code Example (2)
0xffffffff7ffffae0: 0
0xffffffff7ffffae8: 0
0xffffffff7ffffaf0: 0
0xffffffff7ffffaf8: 0
0xffffffff7ffffb00: 0
0xffffffff7ffffb08: 0
0xffffffff7ffffb10: 0
0xffffffff7ffffb18: 0
0xffffffff7ffffb20: 1
0xffffffff7ffffb28: 0
0xffffffff7ffffb30: 0
0xffffffff7ffffb38: 0
0xffffffff7ffffb40: 0
0xffffffff7ffffb48: 0
0xffffffff7ffffb50: 0xffffffff7ffff3a1
0xffffffff7ffffb58: main+4
0xffffffff7ffffb60: 0
0xffffffff7ffffb68: 0
0xffffffff7ffffb70: 0
0xffffffff7ffffb78: 0
0xffffffff7ffffb80: 0
0xffffffff7ffffb88: 0
0xffffffff7ffffb90: 0
0xffffffff7ffffb98: 0xffffffff7f736c90
0xffffffff7ffffba0: 0
0xffffffff7ffffba8: 0
0xffffffff7ffffbb0: 0
0xffffffff7ffffbb8: 0
0xffffffff7ffffbc0: 0
0xffffffff7ffffbc8: 0
0xffffffff7ffffbd0: 0
0xffffffff7ffffbd8: 0
0xffffffff7ffffbe0: 1
0xffffffff7ffffbe8: 0xffffffff7ffffd18
0xffffffff7ffffbf0: 0xffffffff7ffffd28
0xffffffff7ffffbf8: test.sparc`environ
0xffffffff7ffffc00: 0x100000000
0xffffffff7ffffc08: 0x1c00
0xffffffff7ffffc10: 0xffffffff7ffff461
0xffffffff7ffffc18: _start+0x7c
0xffffffff7ffffc20: 4
0xffffffff7ffffc28: 0xffffffff7ffffd28
0xffffffff7ffffc30: 5
0xffffffff7ffffc38: 0xffffffff7ffffda8
0xffffffff7ffffc40: 0
0xffffffff7ffffc48: 0
0xffffffff7ffffc50: 0
0xffffffff7ffffc58: 0
0xffffffff7ffffc60: 1
Call bar()
No control
transfer yet
%o7 foo+4
%npc bar
%pc foo+8
foo: save %sp, -0xc0, %sp
foo+4: call +0x10 <bar>
foo+8: mov %i0, %o0
foo+0xc: ret
foo+0x10: restore %g0, %o0, %o0
Crash Dump Analysis MFF UK SPARC V9 43
Stack and Code Example (2)
0xffffffff7ffffae0: 0
0xffffffff7ffffae8: 0
0xffffffff7ffffaf0: 0
0xffffffff7ffffaf8: 0
0xffffffff7ffffb00: 0
0xffffffff7ffffb08: 0
0xffffffff7ffffb10: 0
0xffffffff7ffffb18: 0
0xffffffff7ffffb20: 1
0xffffffff7ffffb28: 0
0xffffffff7ffffb30: 0
0xffffffff7ffffb38: 0
0xffffffff7ffffb40: 0
0xffffffff7ffffb48: 0
0xffffffff7ffffb50: 0xffffffff7ffff3a1
0xffffffff7ffffb58: main+4
0xffffffff7ffffb60: 0
0xffffffff7ffffb68: 0
0xffffffff7ffffb70: 0
0xffffffff7ffffb78: 0
0xffffffff7ffffb80: 0
0xffffffff7ffffb88: 0
0xffffffff7ffffb90: 0
0xffffffff7ffffb98: 0xffffffff7f736c90
0xffffffff7ffffba0: 0
0xffffffff7ffffba8: 0
0xffffffff7ffffbb0: 0
0xffffffff7ffffbb8: 0
0xffffffff7ffffbc0: 0
0xffffffff7ffffbc8: 0
0xffffffff7ffffbd0: 0
0xffffffff7ffffbd8: 0
0xffffffff7ffffbe0: 1
0xffffffff7ffffbe8: 0xffffffff7ffffd18
0xffffffff7ffffbf0: 0xffffffff7ffffd28
0xffffffff7ffffbf8: test.sparc`environ
0xffffffff7ffffc00: 0x100000000
0xffffffff7ffffc08: 0x1c00
0xffffffff7ffffc10: 0xffffffff7ffff461
0xffffffff7ffffc18: _start+0x7c
0xffffffff7ffffc20: 4
0xffffffff7ffffc28: 0xffffffff7ffffd28
0xffffffff7ffffc30: 5
0xffffffff7ffffc38: 0xffffffff7ffffda8
0xffffffff7ffffc40: 0
0xffffffff7ffffc48: 0
0xffffffff7ffffc50: 0
0xffffffff7ffffc58: 0
0xffffffff7ffffc60: 1
Delay slot
instruction
Copy incoming
argument to
outgoing
argument
foo: save %sp, -0xc0, %sp
foo+4: call +0x10 <bar>
foo+8: mov %i0, %o0
foo+0xc: ret
foo+0x10: restore %g0, %o0, %o0
Crash Dump Analysis MFF UK SPARC V9 44
Stack and Code Example (2)
0xffffffff7ffffae0: 0
0xffffffff7ffffae8: 0
0xffffffff7ffffaf0: 0
0xffffffff7ffffaf8: 0
0xffffffff7ffffb00: 0
0xffffffff7ffffb08: 0
0xffffffff7ffffb10: 0
0xffffffff7ffffb18: 0
0xffffffff7ffffb20: 1
0xffffffff7ffffb28: 0
0xffffffff7ffffb30: 0
0xffffffff7ffffb38: 0
0xffffffff7ffffb40: 0
0xffffffff7ffffb48: 0
0xffffffff7ffffb50: 0xffffffff7ffff3a1
0xffffffff7ffffb58: main+4
0xffffffff7ffffb60: 0
0xffffffff7ffffb68: 0
0xffffffff7ffffb70: 0
0xffffffff7ffffb78: 0
0xffffffff7ffffb80: 0
0xffffffff7ffffb88: 0
0xffffffff7ffffb90: 0
0xffffffff7ffffb98: 0xffffffff7f736c90
0xffffffff7ffffba0: 0
0xffffffff7ffffba8: 0
0xffffffff7ffffbb0: 0
0xffffffff7ffffbb8: 0
0xffffffff7ffffbc0: 0
0xffffffff7ffffbc8: 0
0xffffffff7ffffbd0: 0
0xffffffff7ffffbd8: 0
0xffffffff7ffffbe0: 1
0xffffffff7ffffbe8: 0xffffffff7ffffd18
0xffffffff7ffffbf0: 0xffffffff7ffffd28
0xffffffff7ffffbf8: test.sparc`environ
0xffffffff7ffffc00: 0x100000000
0xffffffff7ffffc08: 0x1c00
0xffffffff7ffffc10: 0xffffffff7ffff461
0xffffffff7ffffc18: _start+0x7c
0xffffffff7ffffc20: 4
0xffffffff7ffffc28: 0xffffffff7ffffd28
0xffffffff7ffffc30: 5
0xffffffff7ffffc38: 0xffffffff7ffffda8
0xffffffff7ffffc40: 0
0xffffffff7ffffc48: 0
0xffffffff7ffffc50: 0
0xffffffff7ffffc58: 0
0xffffffff7ffffc60: 1
Step through
and return from
bar()
foo: save %sp, -0xc0, %sp
foo+4: call +0x10 <bar>
foo+8: mov %i0, %o0
foo+0xc: ret
foo+0x10: restore %g0, %o0, %o0
Crash Dump Analysis MFF UK SPARC V9 45
Stack and Code Example (2)
0xffffffff7ffffae0: 0
0xffffffff7ffffae8: 0
0xffffffff7ffffaf0: 0
0xffffffff7ffffaf8: 0
0xffffffff7ffffb00: 0
0xffffffff7ffffb08: 0
0xffffffff7ffffb10: 0
0xffffffff7ffffb18: 0
0xffffffff7ffffb20: 1
0xffffffff7ffffb28: 0
0xffffffff7ffffb30: 0
0xffffffff7ffffb38: 0
0xffffffff7ffffb40: 0
0xffffffff7ffffb48: 0
0xffffffff7ffffb50: 0xffffffff7ffff3a1
0xffffffff7ffffb58: main+4
0xffffffff7ffffb60: 0
0xffffffff7ffffb68: 0
0xffffffff7ffffb70: 0
0xffffffff7ffffb78: 0
0xffffffff7ffffb80: 0
0xffffffff7ffffb88: 0
0xffffffff7ffffb90: 0
0xffffffff7ffffb98: 0xffffffff7f736c90
0xffffffff7ffffba0: 0
0xffffffff7ffffba8: 0
0xffffffff7ffffbb0: 0
0xffffffff7ffffbb8: 0
0xffffffff7ffffbc0: 0
0xffffffff7ffffbc8: 0
0xffffffff7ffffbd0: 0
0xffffffff7ffffbd8: 0
0xffffffff7ffffbe0: 1
0xffffffff7ffffbe8: 0xffffffff7ffffd18
0xffffffff7ffffbf0: 0xffffffff7ffffd28
0xffffffff7ffffbf8: test.sparc`environ
0xffffffff7ffffc00: 0x100000000
0xffffffff7ffffc08: 0x1c00
0xffffffff7ffffc10: 0xffffffff7ffff461
0xffffffff7ffffc18: _start+0x7c
0xffffffff7ffffc20: 4
0xffffffff7ffffc28: 0xffffffff7ffffd28
0xffffffff7ffffc30: 5
0xffffffff7ffffc38: 0xffffffff7ffffda8
0xffffffff7ffffc40: 0
0xffffffff7ffffc48: 0
0xffffffff7ffffc50: 0
0xffffffff7ffffc58: 0
0xffffffff7ffffc60: 1
Return from
foo()
No control
transfer yet
%npc %i7+8
%pc
foo+0x10
foo: save %sp, -0xc0, %sp
foo+4: call +0x10 <bar>
foo+8: mov %i0, %o0
foo+0xc: ret
foo+0x10: restore %g0, %o0, %o0
Crash Dump Analysis MFF UK SPARC V9 46
Stack and Code Example (2)
0xffffffff7ffffba0: 0
0xffffffff7ffffba8: 0
0xffffffff7ffffbb0: 0
0xffffffff7ffffbb8: 0
0xffffffff7ffffbc0: 0
0xffffffff7ffffbc8: 0
0xffffffff7ffffbd0: 0
0xffffffff7ffffbd8: 0
0xffffffff7ffffbe0: 1
0xffffffff7ffffbe8: 0xffffffff7ffffd18
0xffffffff7ffffbf0: 0xffffffff7ffffd28
0xffffffff7ffffbf8: test.sparc`environ
0xffffffff7ffffc00: 0x100000000
0xffffffff7ffffc08: 0x1c00
0xffffffff7ffffc10: 0xffffffff7ffff461
0xffffffff7ffffc18: _start+0x7c
0xffffffff7ffffc20: 4
0xffffffff7ffffc28: 0xffffffff7ffffd28
0xffffffff7ffffc30: 5
0xffffffff7ffffc38: 0xffffffff7ffffda8
0xffffffff7ffffc40: 0
0xffffffff7ffffc48: 0
0xffffffff7ffffc50: 0
0xffffffff7ffffc58: 0
0xffffffff7ffffc60: 1
Restore the
previous
register window
Return from
main()
No control
transfer yet
%npc %i7+8
%pc
main+0x10
Crash Dump Analysis MFF UK SPARC V9 48
Stack and Code Example (2)
main: save %sp, -0xc0, %sp
main+4: call -0x34 <foo>
main+8: mov %i0, %o0
main+0xc: ret
main+0x10: restore %g0, %o0, %o0
0xffffffff7ffffc60: 1
Restore the
previous
register window