SYS.h (6d91b5a8) | SYS.h (83762a71) |
---|---|
1/* $OpenBSD: SYS.h,v 1.1 2021/04/28 15:16:26 drahn Exp $ */ | 1/* $OpenBSD: SYS.h,v 1.2 2023/12/10 16:45:50 deraadt Exp $ */ |
2 3/* 4 * Copyright (c) 2016 Dale Rahn <drahn@openbsd.org> 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 */ 28 29#include <machine/asm.h> 30#include <sys/syscall.h> 31 | 2 3/* 4 * Copyright (c) 2016 Dale Rahn <drahn@openbsd.org> 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 */ 28 29#include <machine/asm.h> 30#include <sys/syscall.h> 31 |
32#define SYSTRAP(x) \ 33 li t0, SYS_ ## x ;\ 34 ecall ;\ | 32#define PINSYSCALL(sysno, label) \ 33 .pushsection .openbsd.syscalls,"",@progbits ;\ 34 .long label ;\ 35 .long sysno ;\ 36 .popsection 37 38#define SYSTRAP(x) \ 39 li t0, SYS_ ## x ;\ 4099: ecall ;\ 41 PINSYSCALL(SYS_ ## x, 99b) |
35 /* XXX fence */ 36 | 42 /* XXX fence */ 43 |
37#define DL_SYSCALL(n) \ 38 .global __CONCAT(_dl_,n) ;\ 39 .type __CONCAT(_dl_,n)%function ;\ 40__CONCAT(_dl_,n): ;\ 41 RETGUARD_SETUP(__CONCAT(_dl_,n), x15) ;\ 42 SYSTRAP(n) ;\ 43 beqz t0, 1f ;\ 44 sub a0, zero, a0 /* r0 = -errno */ ;\ 451: ;\ 46 RETGUARD_CHECK(__CONCAT(_dl_,n), x15) ;\ | 44#define DL_SYSCALL(n) \ 45 .global __CONCAT(_dl_,n) ;\ 46 .type __CONCAT(_dl_,n)%function ;\ 47__CONCAT(_dl_,n): ;\ 48 RETGUARD_SETUP(__CONCAT(_dl_,n), x15) ;\ 49 SYSTRAP(n) ;\ 50 beqz t0, 1f ;\ 51 sub a0, zero, a0 /* r0 = -errno */ ;\ 521: ;\ 53 RETGUARD_CHECK(__CONCAT(_dl_,n), x15) ;\ |
47 ret | 54 ret |