11.12Sskrll/* $NetBSD: SYS.h,v 1.12 2020/05/05 20:43:47 skrll Exp $ */ 21.1Sfredette 31.1Sfredette/* $OpenBSD: SYS.h,v 1.9 2001/09/20 20:52:09 millert Exp $ */ 41.1Sfredette 51.1Sfredette/* 61.7Ssnj * Copyright (c) 1998-2002 Michael Shalayeff 71.1Sfredette * All rights reserved. 81.1Sfredette * 91.1Sfredette * Redistribution and use in source and binary forms, with or without 101.1Sfredette * modification, are permitted provided that the following conditions 111.1Sfredette * are met: 121.1Sfredette * 1. Redistributions of source code must retain the above copyright 131.1Sfredette * notice, this list of conditions and the following disclaimer. 141.1Sfredette * 2. Redistributions in binary form must reproduce the above copyright 151.1Sfredette * notice, this list of conditions and the following disclaimer in the 161.1Sfredette * documentation and/or other materials provided with the distribution. 171.1Sfredette * 181.1Sfredette * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 191.1Sfredette * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 201.1Sfredette * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 211.1Sfredette * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 221.1Sfredette * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 231.1Sfredette * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF MIND 241.1Sfredette * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 251.1Sfredette * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 261.1Sfredette * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 271.1Sfredette * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 281.1Sfredette */ 291.1Sfredette 301.1Sfredette#include <sys/syscall.h> 311.1Sfredette#include <machine/asm.h> 321.1Sfredette#include <machine/vmparam.h> 331.1Sfredette#include <machine/frame.h> 341.1Sfredette 351.6Sskrll#define SYSENTRY(x) LEAF_ENTRY(x) 361.5Sskrll#define SYSEXIT(x) EXIT(x) 371.1Sfredette 381.12Sskrll/* 391.12Sskrll * The restore of rp in the branch to __cerror delay slot is required 401.12Sskrll */ 411.5Sskrll#define SYSCALL(x) !\ 421.4Smatt stw %rp, HPPA_FRAME_ERP(%sr0,%sp) !\ 431.4Smatt ldil L%SYSCALLGATE, %r1 !\ 441.9Sskrll ble 4(%sr2, %r1) !\ 451.12Sskrll ldi __CONCAT(SYS_,x), %t1 !\ 461.12Sskrll comb,=,n %r0, %t1, 1f !\ 471.12Sskrll b __cerror !\ 481.12Sskrll1: !\ 491.11Sskrll ldw HPPA_FRAME_ERP(%sr0,%sp), %rp 501.5Sskrll 511.5Sskrll#define PSEUDO(x,y) !\ 521.6SskrllSYSENTRY(x) !\ 531.5Sskrll SYSCALL(y) !\ 541.5Sskrll bv %r0(%rp) !\ 551.11Sskrll nop !\ 561.5SskrllSYSEXIT(x) 571.1Sfredette 581.5Sskrll#define PSEUDO_NOERROR(x,y) !\ 591.6SskrllSYSENTRY(x) !\ 601.5Sskrll stw %rp, HPPA_FRAME_ERP(%sr0,%sp) !\ 611.5Sskrll ldil L%SYSCALLGATE, %r1 !\ 621.9Sskrll ble 4(%sr2, %r1) !\ 631.11Sskrll ldi __CONCAT(SYS_,y), %t1 !\ 641.5Sskrll ldw HPPA_FRAME_ERP(%sr0,%sp), %rp !\ 651.4Smatt bv %r0(%rp) !\ 661.11Sskrll nop !\ 671.5SskrllSYSEXIT(x) 681.1Sfredette 691.5Sskrll#define RSYSCALL(x) PSEUDO(x,x) 701.8Sskrll#define RSYSCALL_NOERROR(x) PSEUDO_NOERROR(x,x) 711.1Sfredette 721.1Sfredette#ifdef WEAK_ALIAS 731.1Sfredette#define WSYSCALL(weak,strong) !\ 741.1Sfredette WEAK_ALIAS(weak,strong) !\ 751.1Sfredette PSEUDO(strong,weak) 761.1Sfredette#else 771.1Sfredette#define WSYSCALL(weak,strong) !\ 781.1Sfredette PSEUDO(weak,weak) 791.1Sfredette#endif 801.12Sskrll 811.12Sskrll .global __cerror 821.12Sskrll .hidden __cerror 831.12Sskrll .import __cerror, code 84