Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 68 lines (55 sloc) 1.402 kb
d9db53c @kakaroto Add hypercall tracer to the dump_syscalls payload
authored
1 /*
2 * hvsc_handler.S -- PS3 Jailbreak payload : hook for tracing hypercalls
3 *
4 * Copyright (C) Youness Alaoui (KaKaRoTo)
5 *
6 * This software is distributed under the terms of the GNU General Public
7 * License ("GPL") version 3, as published by the Free Software Foundation.
8 *
9 */
10
66af857 @kakaroto Add proper ifndef/define/endif to all .h.S files
authored
11 #ifndef __HVSC_HANDLER_H_S__
12 #define __HVSC_HANDLER_H_S__
13
53d96ca @kakaroto Port all payloads to the new pl3.h.S framework
authored
14 #include "trace_helpers.h.S"
66af857 @kakaroto Add proper ifndef/define/endif to all .h.S files
authored
15
2276ccf @kakaroto Factor out the code to hook the hvsc instructions into its own file
authored
16 hvsc_handler:
d9db53c @kakaroto Add hypercall tracer to the dump_syscalls payload
authored
17 mflr %r0
18 stdu %r1, -0x100(%r1)
7ea72e1 @kakaroto squash with hvsc opt
authored
19 std %r30, 0xC0(%r1)
20 std %r31, 0xC8(%r1)
2b8d4c6 @kakaroto optimize hv+sc tracers
authored
21 // Some functions calling hvsc do not modify the stack, so writing to
22 // 0x10(%r1) means we overwrite their own stored LR. So we need to store
23 // our LR inside the allocated stack. It breaks the 'backtrace' but
24 // we have no choice
d9db53c @kakaroto Add hypercall tracer to the dump_syscalls payload
authored
25 std %r0, 0xF0(%r1)
26
2b8d4c6 @kakaroto optimize hv+sc tracers
authored
27 li %r31, 0
f62a68f @kakaroto Optimizing the code
authored
28
2b8d4c6 @kakaroto optimize hv+sc tracers
authored
29 /* do not log some hypercall that just flood the network */
30 cmplwi %r11, 9 // lv1_pause
f62a68f @kakaroto Optimizing the code
authored
31 beq hvsc_call
2b8d4c6 @kakaroto optimize hv+sc tracers
authored
32 cmplwi %r11, 30 // lv1_end_of_interrupt_ext
f62a68f @kakaroto Optimizing the code
authored
33 beq hvsc_call
2b8d4c6 @kakaroto optimize hv+sc tracers
authored
34 cmplwi %r11, 31 // lv1_did_update_interrupt_mask
f62a68f @kakaroto Optimizing the code
authored
35 beq hvsc_call
36 cmplwi %r11, 24 // lv1_send_event_locally
37 beq hvsc_call
d9db53c @kakaroto Add hypercall tracer to the dump_syscalls payload
authored
38
2b8d4c6 @kakaroto optimize hv+sc tracers
authored
39 li %r31, 1
d9db53c @kakaroto Add hypercall tracer to the dump_syscalls payload
authored
40
f62a68f @kakaroto Optimizing the code
authored
41 bl store_regs
42 mr %r30, %r11
2b8d4c6 @kakaroto optimize hv+sc tracers
authored
43 li %r12, 0x10
44 bl send_trace
45 bl load_regs
f62a68f @kakaroto Optimizing the code
authored
46
d9db53c @kakaroto Add hypercall tracer to the dump_syscalls payload
authored
47 hvsc_call:
48 sc 1
2b8d4c6 @kakaroto optimize hv+sc tracers
authored
49
50 cmplwi %r31, 0
2276ccf @kakaroto Factor out the code to hook the hvsc instructions into its own file
authored
51 beq l_hvsc_handler_return
2b8d4c6 @kakaroto optimize hv+sc tracers
authored
52
53 bl store_regs
54 mr %r11, %r30
55 li %r12, 0x11
56 bl send_trace
57 bl load_regs
7ea72e1 @kakaroto squash with hvsc opt
authored
58
2276ccf @kakaroto Factor out the code to hook the hvsc instructions into its own file
authored
59 l_hvsc_handler_return:
7ea72e1 @kakaroto squash with hvsc opt
authored
60 ld %r30, 0xC0(%r1)
61 ld %r31, 0xC8(%r1)
d9db53c @kakaroto Add hypercall tracer to the dump_syscalls payload
authored
62 ld %r0, 0xF0(%r1)
63 addi %r1, %r1, 0x100
64 mtlr %r0
af4621f @kakaroto Add a hypercall tracer payload
authored
65 blr
66af857 @kakaroto Add proper ifndef/define/endif to all .h.S files
authored
66
67 #endif /* __HVSC_HANDLER_H_S__ */
Something went wrong with that request. Please try again.