1*f46fb125Sjoerg /* $NetBSD: SYS.h,v 1.12 2012/02/27 12:26:21 joerg Exp $ */ 2ce0bb6e8Sragge /* 3ce0bb6e8Sragge * Copyright (c) 1983, 1993 4ce0bb6e8Sragge * The Regents of the University of California. All rights reserved. 5ce0bb6e8Sragge * 6ce0bb6e8Sragge * Redistribution and use in source and binary forms, with or without 7ce0bb6e8Sragge * modification, are permitted provided that the following conditions 8ce0bb6e8Sragge * are met: 9ce0bb6e8Sragge * 1. Redistributions of source code must retain the above copyright 10ce0bb6e8Sragge * notice, this list of conditions and the following disclaimer. 11ce0bb6e8Sragge * 2. Redistributions in binary form must reproduce the above copyright 12ce0bb6e8Sragge * notice, this list of conditions and the following disclaimer in the 13ce0bb6e8Sragge * documentation and/or other materials provided with the distribution. 14eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors 15ce0bb6e8Sragge * may be used to endorse or promote products derived from this software 16ce0bb6e8Sragge * without specific prior written permission. 17ce0bb6e8Sragge * 18ce0bb6e8Sragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19ce0bb6e8Sragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20ce0bb6e8Sragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21ce0bb6e8Sragge * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22ce0bb6e8Sragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23ce0bb6e8Sragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24ce0bb6e8Sragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25ce0bb6e8Sragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26ce0bb6e8Sragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27ce0bb6e8Sragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28ce0bb6e8Sragge * SUCH DAMAGE. 29ce0bb6e8Sragge * 30ce0bb6e8Sragge * @(#)SYS.h 8.1 (Berkeley) 6/4/93 31ce0bb6e8Sragge */ 32ce0bb6e8Sragge 3341056da8Sjtc #include <machine/asm.h> 34ce0bb6e8Sragge #include <sys/syscall.h> 35ce0bb6e8Sragge 36787e823fSmatt #define CERROR _C_LABEL(__cerror) 37787e823fSmatt #define CURBRK _C_LABEL(__curbrk) 38787e823fSmatt 3992d8b1e9Swiz #ifdef __STDC__ 4041056da8Sjtc #define SYSTRAP(x) chmk $ SYS_ ## x 4192d8b1e9Swiz #else 4292d8b1e9Swiz #define SYSTRAP(x) chmk $ SYS_/**/x 4392d8b1e9Swiz #endif 44ce0bb6e8Sragge 452913a7a8Skleink #define _SYSCALL_NOERROR(x,y) \ 4641056da8Sjtc ENTRY(x,0); \ 472913a7a8Skleink SYSTRAP(y) 482913a7a8Skleink 492913a7a8Skleink #define _SYSCALL(x,y) \ 50787e823fSmatt .p2align 2; \ 51ae4364e1Smatt err: nop; nop; jmp CERROR+2; \ 522913a7a8Skleink _SYSCALL_NOERROR(x,y); \ 53cf2842a1Smatt jcs err+2 5441056da8Sjtc 5541056da8Sjtc #define SYSCALL_NOERROR(x) \ 562913a7a8Skleink _SYSCALL_NOERROR(x,x) 5741056da8Sjtc 582913a7a8Skleink #define SYSCALL(x) \ 592913a7a8Skleink _SYSCALL(x,x) 602913a7a8Skleink 612913a7a8Skleink #define PSEUDO_NOERROR(x,y) \ 622913a7a8Skleink _SYSCALL_NOERROR(x,y); \ 63787e823fSmatt ret; \ 64787e823fSmatt END(x) 6541056da8Sjtc 6641056da8Sjtc #define PSEUDO(x,y) \ 672913a7a8Skleink _SYSCALL(x,y); \ 68787e823fSmatt ret; \ 69787e823fSmatt END(x) 7041056da8Sjtc 712913a7a8Skleink #define RSYSCALL_NOERROR(x) \ 722913a7a8Skleink PSEUDO_NOERROR(x,x) 732913a7a8Skleink 742913a7a8Skleink #define RSYSCALL(x) \ 752913a7a8Skleink PSEUDO(x,x) 762913a7a8Skleink 77ac8c1c29Sthorpej #ifdef WEAK_ALIAS 78ac8c1c29Sthorpej #define WSYSCALL(weak,strong) \ 79ac8c1c29Sthorpej WEAK_ALIAS(weak,strong); \ 80ac8c1c29Sthorpej PSEUDO(strong,weak) 81ac8c1c29Sthorpej #else 82ac8c1c29Sthorpej #define WSYSCALL(weak,strong) \ 83ac8c1c29Sthorpej PSEUDO(weak,weak) 84ac8c1c29Sthorpej #endif 85ac8c1c29Sthorpej 86ce0bb6e8Sragge #define ASMSTR .asciz 87ce0bb6e8Sragge 88*f46fb125Sjoerg .protected CERROR 89ae4364e1Smatt .globl CERROR 90