jehanne/sys/src/lib/jehanne/syscallc.rc.template

61 lines
1.6 KiB
Plaintext

/*
* This file is part of Jehanne.
*
* Copyright (C) 2022 Giacomo Tesio <giacomo@tesio.it>
*
* Jehanne is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Jehanne is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
*/
/* automatically generated by syscallc.rc.template */
#define PORTABLE_SYSCALLS
#include <u.h>
#! fn setClobbers {
#! if( ! ~ $"CLOBBERS *"memory" && ~ $1 *'*' && ! ~ $1 const*) {
#! CLOBBERS=$CLOBBERS', "memory"'
#! }
#! }
#! ifs='
#! '
#! CONFIGURATION=`{sed -n '/^$/!{/^#/!p}' $JEHANNE/sys/src/sysconf/syscalls.rc.confs}
#! for (line in $CONFIGURATION){
#! eval $line
#! ID='$'$ID
#! CLOBBERS='"cc", "rcx", "r11"'
#! CALLARGS=$ARGS(1)^' a1'
#! setClobbers $ARGS(1)
#! if( ! ~ 1 $#ARGS){
#! for(idx in `{seq 2 $#ARGS}){
#! CALLARGS=$CALLARGS^', '^$ARGS($idx)^' a'^$idx
#! setClobbers $ARGS($idx)
#! }
#! }
#pragma weak sys_$NAME
$RET
sys_$NAME^($CALLARGS)
{
register $RET __ret asm ("rax");
__asm__ __volatile__ (
"movq %%rcx, %%r10" "\n\t"
"movq $ID, %%rax" "\n\t"
"syscall"
: "=r" (__ret)
: /* args are ready */
: $CLOBBERS
);
return __ret;
}
#! }