xref: /openbsd-src/lib/libc/arch/riscv64/sys/sigprocmask.S (revision 0f2255fcf6ad0f8f9c3d05a414f4bbd17df168d1)
1*0f2255fcSdrahn/*	$OpenBSD: sigprocmask.S,v 1.2 2021/05/04 04:26:00 drahn Exp $	*/
27ecb72feSdrahn/*
37ecb72feSdrahn * Copyright (c) 2020 Brian Bamsch <bbamsch@google.com>
47ecb72feSdrahn * All rights reserved.
57ecb72feSdrahn *
67ecb72feSdrahn * Redistribution and use in source and binary forms, with or without
77ecb72feSdrahn * modification, are permitted provided that the following conditions
87ecb72feSdrahn * are met:
97ecb72feSdrahn * 1. Redistributions of source code must retain the above copyright
107ecb72feSdrahn *    notice, this list of conditions and the following disclaimer.
117ecb72feSdrahn * 2. Redistributions in binary form must reproduce the above copyright
127ecb72feSdrahn *    notice, this list of conditions and the following disclaimer in the
137ecb72feSdrahn *    documentation and/or other materials provided with the distribution.
147ecb72feSdrahn * 3. Neither the name of the copyright holder nor the names of contributors
157ecb72feSdrahn *    may be used to endorse or promote products derived from this software
167ecb72feSdrahn *    without specific prior written permission.
177ecb72feSdrahn *
187ecb72feSdrahn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
197ecb72feSdrahn * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
207ecb72feSdrahn * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
217ecb72feSdrahn * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE
227ecb72feSdrahn * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
237ecb72feSdrahn * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
247ecb72feSdrahn * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
257ecb72feSdrahn * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
267ecb72feSdrahn * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
277ecb72feSdrahn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
287ecb72feSdrahn * SUCH DAMAGE.
297ecb72feSdrahn */
307ecb72feSdrahn
317ecb72feSdrahn#include "SYS.h"
327ecb72feSdrahn
337ecb72feSdrahnSYSENTRY_HIDDEN(sigprocmask)
347ecb72feSdrahn	RETGUARD_SETUP(sigprocmask, t6)
357ecb72feSdrahn	beqz	a1, 1f
367ecb72feSdrahn	lw	a1, (a1)
377ecb72feSdrahn	j	2f
387ecb72feSdrahn1:
397ecb72feSdrahn	li	a0, 1
407ecb72feSdrahn	li	a1, 0
417ecb72feSdrahn2:
427ecb72feSdrahn
437ecb72feSdrahn	SYSTRAP(sigprocmask)
44*0f2255fcSdrahn	HANDLE_ERROR_TARGET(3f)
457ecb72feSdrahn	beqz	a2, 1f
467ecb72feSdrahn	sw	a0, (a2)
477ecb72feSdrahn1:
48*0f2255fcSdrahn	li	a0, 0
49*0f2255fcSdrahn3:
507ecb72feSdrahn	RETGUARD_CHECK(sigprocmask, t6)
517ecb72feSdrahn	ret
527ecb72feSdrahnSYSCALL_END_HIDDEN(sigprocmask)
53