You copied the Doc URL to your clipboard.


The __svc_indirect_r7 keyword behaves like __svc_indirect, but uses r7 instead of r12.

__svc_indirect_r7 is a function qualifier. It affects the type of a function.


__svc_indirect_r7(int svc_num)
        return-type function-name(int real_num[, argument-list]);



Is the immediate value used in the SVC instruction.

It is an expression evaluating to an integer in the range:

  • 0 to 224-1 (a 24-bit value) in an ARM instruction

  • 0-255 (an 8-bit value) in a 16-bit Thumb instruction.


Is the value passed in r7 to the handler to determine the function to perform.


Thumb applications on ARM Linux use __svc_indirect_r7 to make kernel syscalls.

You can also use this feature to implement indirect SVCs.


long __svc_indirect_r7(0) \
        SVC_write(unsigned, int fd, const char * buf, size_t count);
#define write(fd, buf, count) SVC_write(4, (fd), (buf), (count))


write(fd, buf, count);

compiles to SVC #0 with r0 = fd, r1 = buf, r2 = count, and r7 = 4.


When an ARM architecture variant or ARM architecture-based processor that does not support an SVC instruction is specified on the command line using the --cpu option, the compiler generates an error.

See also