Deleted Added
sdiff udiff text old ( 178580 ) new ( 209231 )
full compact
1/* $NetBSD: SYS.h,v 1.18 2003/10/29 12:28:33 pooka Exp $ */
2/* $FreeBSD: head/lib/libc/mips/SYS.h 178580 2008-04-26 12:08:02Z imp $ */
3
4/*-
5 * Copyright (c) 1996 Jonathan Stone
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:

--- 63 unchanged lines hidden (view full) ---

74 * If compiling for shared libs, Emit sysV ABI PIC segment pseudo-ops.
75 *
76 * i) Emit .abicalls before .LEAF entrypoint, and .cpload/.cprestore after.
77 * ii) Do interprocedure jumps indirectly via t9, with the side-effect of
78 * preserving the callee's entry address in t9.
79 */
80#ifdef __ABICALLS__
81 .abicalls
82# define PIC_PROLOGUE(x,sr) .set noreorder; .cpload sr; .set reorder
83# define PIC_CALL(l,sr) la sr, _C_LABEL(l); jr sr
84#else
85# define PIC_PROLOGUE(x,sr)
86# define PIC_CALL(l,sr) j _C_LABEL(l)
87#endif
88
89# define SYSTRAP(x) li v0, SYS_ ## x; syscall;
90
91/*
92 * Do a syscall that cannot fail (sync, get{p,u,g,eu,eg)id)
93 */
94#define RSYSCALL_NOERROR(x) \
95 PSEUDO_NOERROR(x)
96
97/*
98 * Do a normal syscall.
99 */
100#define RSYSCALL(x) \
101 PSEUDO(x)
102
103/*
104 * Do a renamed or pseudo syscall (e.g., _exit()), where the entrypoint
105 * and syscall name are not the same.
106 */
107#define PSEUDO_NOERROR(x) \
108LEAF(__sys_ ## x); \
109 .weak _C_LABEL(x); \
110 _C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x)); \
111 .weak _C_LABEL(__CONCAT(_,x)); \
112 _C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
113 SYSTRAP(x); \
114 j ra; \
115 END(__sys_ ## x)
116
117#define PSEUDO(x) \
118LEAF(__sys_ ## x); \
119 .weak _C_LABEL(x); \
120 _C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x)); \
121 .weak _C_LABEL(__CONCAT(_,x)); \
122 _C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
123 PIC_PROLOGUE(x,t9); \
124 SYSTRAP(x); \
125 bne a3,zero,err; \
126 j ra; \
127err: \
128 PIC_CALL(__cerror,t9); \
129 END(__sys_ ## x)