1/** 2 * \file 3 * \brief User-side system call implementation 4 */ 5 6/* 7 * Copyright (c) 2007-2016, ETH Zurich. 8 * Copyright (c) 2015, Hewlett Packard Enterprise Development LP. 9 * All rights reserved. 10 * 11 * This file is distributed under the terms in the attached LICENSE file. 12 * If you do not find this file, copies can be found by writing to: 13 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 14 */ 15 16#ifndef ARCH_AARCH64_BARRELFISH_SYSCALL_H 17#define ARCH_AARCH64_BARRELFISH_SYSCALL_H 18 19#include <barrelfish_kpi/syscalls.h> // for struct sysret. 20 21/** 22 * \brief the actual syscall function 23 * 24 * the arguments are left in the registers x0-x11 25 * the return value is stored in x0 and x1 when returning from the syscall 26 */ 27struct sysret 28syscall(uint64_t num, uint64_t arg1, uint64_t arg2, uint64_t arg3, 29 uint64_t arg4, uint64_t arg5, uint64_t arg6, uint64_t arg7, 30 uint64_t arg8, uint64_t arg9, uint64_t arg10, uint64_t arg11); 31 32 33// 34// System call argument 0 is encoded thus: 35// 36// arg[3:0] = syscall ordinal (e.g. SYSCALL_YIELD) 37// arg[7:4] = number of system call arguments (for sanity checking) 38// arg[31:8] = SYSCALL_INVOKE arguments | do_not_care 39// 40 41//C_ASSERT(SYSCALL_COUNT <= 0xf); 42#define sysord(a,n) (a) | ((n) << 4) 43 44// The following macros add the argument count to arg0 45 46#define syscall12(a,b,c,d,e,f,g,h,i,j,k,l) \ 47 syscall(sysord(a,12),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l)) 48 49#define syscall11(a,b,c,d,e,f,g,h,i,j,k) \ 50 syscall(sysord(a,11),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),0) 51 52#define syscall10(a,b,c,d,e,f,g,h,i,j) \ 53 syscall(sysord(a,10),(b),(c),(d),(e),(f),(g),(h),(i),(j),0,0) 54 55#define syscall9(a,b,c,d,e,f,g,h,i) \ 56 syscall(sysord(a,9),(b),(c),(d),(e),(f),(g),(h),(i),0,0,0) 57 58#define syscall8(a,b,c,d,e,f,g,h) \ 59 syscall(sysord(a,8),(b),(c),(d),(e),(f),(g),(h),0,0,0,0) 60 61#define syscall7(a,b,c,d,e,f,g) \ 62 syscall(sysord(a,7),(b),(c),(d),(e),(f),(g),0,0,0,0,0) 63 64#define syscall6(a,b,c,d,e,f) \ 65 syscall(sysord(a,6),(b),(c),(d),(e),(f),0,0,0,0,0,0) 66 67#define syscall5(a,b,c,d,e) \ 68 syscall(sysord(a,5),(b),(c),(d),(e),0,0,0,0,0,0,0) 69 70#define syscall4(a,b,c,d) \ 71 syscall(sysord(a,4),(b),(c),(d),0,0,0,0,0,0,0,0) 72 73#define syscall3(a,b,c) \ 74 syscall(sysord(a,3),(b),(c),0,0,0,0,0,0,0,0,0) 75 76#define syscall2(a,b) \ 77 syscall(sysord(a,2),(b),0,0,0,0,0,0,0,0,0,0) 78 79#define syscall1(a) \ 80 syscall(sysord(a,1),0,0,0,0,0,0,0,0,0,0,0) 81 82#endif 83