mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-28 01:28:53 +00:00
hw_x86_64: Add syscall helper macros
The macros are used to assign syscall arguments to specific registers. Using the AMD64 parameter passing convention avoids additional copying of variables since the C++ function parameters are already in the right registers.
This commit is contained in:
parent
3e779e3ca1
commit
04ad1340d5
@ -17,6 +17,38 @@
|
||||
|
||||
using namespace Kernel;
|
||||
|
||||
/************************************
|
||||
** Helper macros for kernel calls **
|
||||
************************************/
|
||||
|
||||
/**
|
||||
* Assign argument registers according to AMD64 parameter passing
|
||||
* convention to avoid additional register copy operations.
|
||||
*/
|
||||
|
||||
#define CALL_1_FILL_ARG_REGS \
|
||||
register Call_arg arg_0_reg asm("rdi") = arg_0;
|
||||
|
||||
#define CALL_2_FILL_ARG_REGS \
|
||||
CALL_1_FILL_ARG_REGS \
|
||||
register Call_arg arg_1_reg asm("rsi") = arg_1;
|
||||
|
||||
#define CALL_3_FILL_ARG_REGS \
|
||||
CALL_2_FILL_ARG_REGS \
|
||||
register Call_arg arg_2_reg asm("rdx") = arg_2;
|
||||
|
||||
#define CALL_4_FILL_ARG_REGS \
|
||||
CALL_3_FILL_ARG_REGS \
|
||||
register Call_arg arg_3_reg asm("rcx") = arg_3;
|
||||
|
||||
#define CALL_5_FILL_ARG_REGS \
|
||||
CALL_4_FILL_ARG_REGS \
|
||||
register Call_arg arg_4_reg asm("r8") = arg_4;
|
||||
|
||||
#define CALL_6_FILL_ARG_REGS \
|
||||
CALL_5_FILL_ARG_REGS \
|
||||
register Call_arg arg_5_reg asm("r9") = arg_5;
|
||||
|
||||
|
||||
/******************
|
||||
** Kernel calls **
|
||||
|
Loading…
Reference in New Issue
Block a user