1*04459484Sderaadt /* $OpenBSD: SYS.h,v 1.6 2023/12/11 22:29:24 deraadt Exp $ */ 2d6979ba5Sderaadt 3d6979ba5Sderaadt /* 4d6979ba5Sderaadt * Copyright (c) 1999 Dale Rahn 5d6979ba5Sderaadt * 6d6979ba5Sderaadt * Redistribution and use in source and binary forms, with or without 7d6979ba5Sderaadt * modification, are permitted provided that the following conditions 8d6979ba5Sderaadt * are met: 9d6979ba5Sderaadt * 1. Redistributions of source code must retain the above copyright 10d6979ba5Sderaadt * notice, this list of conditions and the following disclaimer. 11d6979ba5Sderaadt * 2. Redistributions in binary form must reproduce the above copyright 12d6979ba5Sderaadt * notice, this list of conditions and the following disclaimer in the 13d6979ba5Sderaadt * documentation and/or other materials provided with the distribution. 14d6979ba5Sderaadt * 15d6979ba5Sderaadt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 16d6979ba5Sderaadt * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17d6979ba5Sderaadt * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18d6979ba5Sderaadt * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 19d6979ba5Sderaadt * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20d6979ba5Sderaadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21d6979ba5Sderaadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22d6979ba5Sderaadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23d6979ba5Sderaadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24d6979ba5Sderaadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25d6979ba5Sderaadt * SUCH DAMAGE. 26d6979ba5Sderaadt * 27d6979ba5Sderaadt */ 28d6979ba5Sderaadt 29d6979ba5Sderaadt #include <sys/syscall.h> 30d6979ba5Sderaadt #include <machine/asm.h> 31d6979ba5Sderaadt 3283762a71Sderaadt #define PINSYSCALL(sysno, label) \ 3383762a71Sderaadt .pushsection .openbsd.syscalls,"",@progbits ;\ 34*04459484Sderaadt .p2align 2 ;\ 3583762a71Sderaadt .long label ;\ 3683762a71Sderaadt .long sysno ;\ 3783762a71Sderaadt .popsection 3883762a71Sderaadt 39d6979ba5Sderaadt #define DL_SYSCALL(n) \ 40d6979ba5Sderaadt ENTRY(_dl_##n) \ 4115572fcfSgkoehler RETGUARD_SETUP(_dl_##n, %r11, %r12) ;\ 42d6979ba5Sderaadt li 0, SYS_##n ;\ 4383762a71Sderaadt 99: sc ;\ 4483762a71Sderaadt PINSYSCALL(SYS_##n, 99b) ;\ 45d6979ba5Sderaadt cmpwi 0, 0 ;\ 46d2c5a474Sgkoehler beq+ .L_end##n ;\ 476e31582aSguenther neg 3, 3 ;\ 48d2c5a474Sgkoehler .L_end##n: ;\ 4915572fcfSgkoehler RETGUARD_CHECK(_dl_##n, %r11, %r12) ;\ 50d6979ba5Sderaadt blr 51