| |||
Home > Compiler-specific Features > Keywords and operators > __svc |
The __svc
keyword declares a SuperVisor
Call (SVC) function taking up to four integer-like arguments
and returning up to four results in a value_in_regs structure.
__svc
is a function qualifier. It affects
the type of a function.
__svc(int svc_num
) return-type function-name([argument-list]);
Where:
svc_num
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.
This causes function invocations to be compiled inline as an AAPCS-compliant operation that behaves similarly to a normal call to a function.
The __value_in_regs
qualifier can be used
to specify that a small structure of up to 16 bytes is returned
in registers, rather than by the usual structure-passing mechanism defined
in the AAPCS.
__svc(42) void terminate_1(intprocnum
); // terminate_1 returns no results __svc(42) int terminate_2(intprocnum
); // terminate_2 returns one result typedef struct res_type { int res_1; int res_2; int res_3; int res_4; } res_type; __svc(42) __value_in_regs res_type terminate_3(intprocnum
); // terminate_3 returns more than // one result
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.
SVC in the Assembler Guide.