The probed function was built with the gcc \-mregparm=n option.
(The i386 kernel is built with \-mregparm=3, so systemtap considers
regparm(3) the default for kernel functions on that architecture.)
+Only valid on i386 and x86_64 (when probing 32bit applications).
+Produces an error on other architectures.
For some architectures, the *_arg functions may reject unusually high
values of n.
function fastcall() %{ /* pure */ %}
-function regparm() %{
+function regparm(n:long) %{
snprintf(CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
"regparm is invalid on arm.");
CONTEXT->last_error = CONTEXT->error_buffer;
+%{
+/* Set to include regparm field in probe context in translate.cxx. */
+#ifndef STAP_NEED_REGPARM
+#define STAP_NEED_REGPARM 1
+#endif
+%}
+
global _reg_offsets, _stp_regs_registered, _sp_offset, _ss_offset
function test_x86_gs:long() %{ /* pure */
function fastcall() %{ /* pure */ %}
-function regparm() %{
+function regparm(n:long) %{
snprintf(CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
"regparm is invalid on powerpc.");
CONTEXT->last_error = CONTEXT->error_buffer;
function fastcall() %{ /* pure */ %}
-function regparm() %{
+function regparm(n:long) %{
snprintf(CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
"regparm is invalid on s390.");
CONTEXT->last_error = CONTEXT->error_buffer;
+%{
+/* Set to include regparm field in probe context in translate.cxx. */
+#ifndef STAP_NEED_REGPARM
+#define STAP_NEED_REGPARM 1
+#endif
+%}
+
global _reg_offsets, _r32_offsets, _stp_regs_registered
function _stp_register_regs() {
o->newline() << "c->pi = 0;";
o->newline() << "c->pi_longs = 0;";
o->newline() << "c->regflags = 0;";
+ o->newline() << "#ifdef STAP_NEED_REGPARM"; // i386 or x86_64 register.stp
o->newline() << "c->regparm = 0;";
+ o->newline() << "#endif";
o->newline() << "c->marker_name = NULL;";
o->newline() << "c->marker_format = NULL;";
o->newline() << "static atomic_t skipped_count_uprobe_reg = ATOMIC_INIT (0);";
o->newline() << "static atomic_t skipped_count_uprobe_unreg = ATOMIC_INIT (0);";
- // Defines for the regsflags field. Maybe merge with regparm field?
+ // Defines for the regsflags field.
// _STP_REGS_USER regsflags bit to indicate regs fully from user.
o->newline();
o->newline() << "#define _STP_REGS_USER_FLAG 1";
o->newline() << "struct kretprobe_instance *pi;";
o->newline() << "int pi_longs;"; // int64_t count in pi->data, the rest is string_t
o->newline() << "int regflags;"; // status of pt_regs regs field.
+ o->newline() << "#ifdef STAP_NEED_REGPARM"; // i386 or x86_64 register.stp
o->newline() << "int regparm;";
+ o->newline() << "#endif";
o->newline() << "va_list *mark_va_list;";
o->newline() << "const char * marker_name;";
o->newline() << "const char * marker_format;";