Debian Codegraph @

tapset/linux/i386/aux_syscalls.stp

raw
1 # arch-specific requests of ptrace ___________________________
2 # = like tapset/x86_64/syscalls.stp but without PTRACE_ARCH_PRCTL
3 #
4 %{
5 #ifndef PTRACE_SYSEMU
6 # define PTRACE_SYSEMU 31
7 #endif
8 #ifndef PTRACE_SYSEMU_SINGLESTEP
9 # define PTRACE_SYSEMU_SINGLESTEP 32
10 #endif
11 #ifndef PTRACE_SINGLEBLOCK
12 # define PTRACE_SINGLEBLOCK 33
13 #endif
14
15 // Get _stp_val_array and _stp_lookup_* definitions.
16 #include "linux/syscalls-common.h"
17
18 static const _stp_val_array _stp_arch_ptrace_request_list[] = {
19 V(PTRACE_GETREGS),
20 V(PTRACE_SETREGS),
21 V(PTRACE_GETFPREGS),
22 V(PTRACE_SETFPREGS),
23 V(PTRACE_GETFPXREGS),
24 V(PTRACE_SETFPXREGS),
25 V(PTRACE_OLDSETOPTIONS),
26 V(PTRACE_GET_THREAD_AREA),
27 V(PTRACE_SET_THREAD_AREA),
28 V(PTRACE_SYSEMU),
29 V(PTRACE_SYSEMU_SINGLESTEP),
30 V(PTRACE_SINGLEBLOCK),
31 {0, NULL}
32 };
33 %}
34
35 function __arch_ptrace_request_str:string(request:long)
36 %{ /* pure */
37 _stp_lookup_str(_stp_arch_ptrace_request_list,
38 (unsigned long)STAP_ARG_request, STAP_RETVALUE,
39 MAXSTRINGLEN);
40 %}
41
42 function _arch_ptrace_argstr:string(request:long, pid:long, addr:long,
43 data:long)
44 {
45 if (request == @const("PTRACE_GETREGS")
46 || request == @const("PTRACE_SETREGS")
47 || request == @const("PTRACE_GETFPREGS")
48 || request == @const("PTRACE_SETFPREGS")
49 || request == @const("PTRACE_GETFPXREGS")
50 || request == @const("PTRACE_SETFPXREGS"))
51 return sprintf("%s, %d, %#x, %p",
52 __arch_ptrace_request_str(request), pid,
53 addr, data)
54 if (request == @const("PTRACE_SYSEMU")
55 || request == @const("PTRACE_SYSEMU_SINGLESTEP")
56 || request == @const("PTRACE_SINGLEBLOCK"))
57 return sprintf("%s, %d, %#x, %s",
58 __arch_ptrace_request_str(request), pid,
59 addr, _signal_name (data))
60 if (request == @const("PTRACE_OLDSETOPTIONS"))
61 return sprintf("PTRACE_OLDSETOPTIONS, %d, %#x, %s", pid,
62 addr, _ptrace_options_str(data))
63 if (request == @const("PTRACE_GET_THREAD_AREA")
64 || request == @const("PTRACE_SET_THREAD_AREA"))
65 return sprintf("%s, %d, %d, %p",
66 __arch_ptrace_request_str(request), pid,
67 __int32(addr), data)
68 }
69
70 function _ptrace_return_arch_prctl_addr:long(request:long, addr:long, data:long)
71 {
72 return 0
73 }
74
75 %{
76 #include <asm/ldt.h>
77 %}
78
79 function _struct_user_desc_u:string(uaddr:long)
80 %{ /* pure */
81 struct user_desc ud;
82 char *ptr = (char *)(uintptr_t)STAP_ARG_uaddr;
83 if (ptr == NULL)
84 strlcpy (STAP_RETVALUE, "NULL", MAXSTRINGLEN);
85 else
86 {
87 if (_stp_copy_from_user((char*)&ud, ptr,
88 sizeof(struct user_desc)) == 0)
89 {
90 snprintf(STAP_RETVALUE, MAXSTRINGLEN,
91 "{entry_number=%u, base_addr=%lu, limit=%u, seg_32bit=%u, contents=%u, "
92 "read_exec_only=%u, limit_in_pages=%u, seg_not_present=%u, useable=%u}",
93 ud.entry_number, (unsigned long)ud.base_addr, ud.limit, ud.seg_32bit, ud.contents,
94 ud.read_exec_only, ud.limit_in_pages, ud.seg_not_present, ud.useable);
95 }
96 else
97 {
98 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "0x%lx",
99 (unsigned long)ptr);
100 }
101 }
102 %}
103