1*33778f9eSskrll/* $NetBSD: getcontext.S,v 1.7 2020/10/15 05:43:38 skrll Exp $ */ 2ed9d4336Smatt 3ed9d4336Smatt/*- 4ed9d4336Smatt * Copyright (c) 2001 The NetBSD Foundation, Inc. 5ed9d4336Smatt * All rights reserved. 6ed9d4336Smatt * 7ed9d4336Smatt * This code is derived from software contributed to The NetBSD Foundation 8ed9d4336Smatt * by Matt Fredette. 9ed9d4336Smatt * 10ed9d4336Smatt * Redistribution and use in source and binary forms, with or without 11ed9d4336Smatt * modification, are permitted provided that the following conditions 12ed9d4336Smatt * are met: 13ed9d4336Smatt * 1. Redistributions of source code must retain the above copyright 14ed9d4336Smatt * notice, this list of conditions and the following disclaimer. 15ed9d4336Smatt * 2. Redistributions in binary form must reproduce the above copyright 16ed9d4336Smatt * notice, this list of conditions and the following disclaimer in the 17ed9d4336Smatt * documentation and/or other materials provided with the distribution. 18ed9d4336Smatt * 19ed9d4336Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20ed9d4336Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21ed9d4336Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22ed9d4336Smatt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23ed9d4336Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24ed9d4336Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25ed9d4336Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26ed9d4336Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27ed9d4336Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28ed9d4336Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29ed9d4336Smatt * POSSIBILITY OF SUCH DAMAGE. 30ed9d4336Smatt */ 31ed9d4336Smatt 32ed9d4336Smatt#include "SYS.h" 334c855bdfSskrll#include "assym.h" 34ed9d4336Smatt 352f80fec2Schs#ifdef WEAK_ALIAS 362f80fec2SchsWEAK_ALIAS(getcontext, _getcontext) 372f80fec2Schs#endif 38ed9d4336Smatt 392f80fec2SchsENTRY(_getcontext, 0) 402f80fec2Schs SYSCALL(getcontext) 41*33778f9eSskrll stw %rp, (_UC_GREGS + _REG_PCOQH * SZREG)(%arg0) 422f80fec2Schs ldo 4(%rp), %r1 43*33778f9eSskrll stw %r1, (_UC_GREGS + _REG_PCOQT * SZREG)(%arg0) 442f80fec2Schs bv %r0(%rp) 45*33778f9eSskrll stw %r0, (_UC_GREGS + _REG_RET0 * SZREG)(%arg0) 462f80fec2SchsEXIT(_getcontext) 47