15d9d9091SRichard Lowe/*
25d9d9091SRichard Lowe * CDDL HEADER START
35d9d9091SRichard Lowe *
45d9d9091SRichard Lowe * The contents of this file are subject to the terms of the
55d9d9091SRichard Lowe * Common Development and Distribution License (the "License").
65d9d9091SRichard Lowe * You may not use this file except in compliance with the License.
75d9d9091SRichard Lowe *
85d9d9091SRichard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
95d9d9091SRichard Lowe * or http://www.opensolaris.org/os/licensing.
105d9d9091SRichard Lowe * See the License for the specific language governing permissions
115d9d9091SRichard Lowe * and limitations under the License.
125d9d9091SRichard Lowe *
135d9d9091SRichard Lowe * When distributing Covered Code, include this CDDL HEADER in each
145d9d9091SRichard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
155d9d9091SRichard Lowe * If applicable, add the following below this CDDL HEADER, with the
165d9d9091SRichard Lowe * fields enclosed by brackets "[]" replaced with your own identifying
175d9d9091SRichard Lowe * information: Portions Copyright [yyyy] [name of copyright owner]
185d9d9091SRichard Lowe *
195d9d9091SRichard Lowe * CDDL HEADER END
205d9d9091SRichard Lowe */
215d9d9091SRichard Lowe
225d9d9091SRichard Lowe/*
235d9d9091SRichard Lowe * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
245d9d9091SRichard Lowe * Use is subject to license terms.
255d9d9091SRichard Lowe */
265d9d9091SRichard Lowe
27*ed093b41SRobert Mustacchi/*
28*ed093b41SRobert Mustacchi * Copyright 2023 Oxide Computer Company
29*ed093b41SRobert Mustacchi */
30*ed093b41SRobert Mustacchi
315d9d9091SRichard Lowe	.file	"__getcontext.s"
325d9d9091SRichard Lowe
335d9d9091SRichard Lowe/*
345d9d9091SRichard Lowe * __getcontext() must be implemented in assembler, as opposed
355d9d9091SRichard Lowe * to the other members of the SYS_context family (see ucontext.c)
365d9d9091SRichard Lowe * because we must be careful to get the precise context of the caller.
375d9d9091SRichard Lowe */
385d9d9091SRichard Lowe
395d9d9091SRichard Lowe#include "SYS.h"
405d9d9091SRichard Lowe
415d9d9091SRichard Lowe	ENTRY(__getcontext)
425d9d9091SRichard Lowe	movq	%rdi, %rsi
435d9d9091SRichard Lowe	movq	$0, %rdi
445d9d9091SRichard Lowe	SYSTRAP_RVAL1(context)
455d9d9091SRichard Lowe	SYSCERROR
465d9d9091SRichard Lowe	RETC
475d9d9091SRichard Lowe	SET_SIZE(__getcontext)
48*ed093b41SRobert Mustacchi
49*ed093b41SRobert Mustacchi	ENTRY(__getcontext_extd)
50*ed093b41SRobert Mustacchi	movq	%rdi, %rsi
51*ed093b41SRobert Mustacchi	movq	$4, %rdi
52*ed093b41SRobert Mustacchi	SYSTRAP_RVAL1(context)
53*ed093b41SRobert Mustacchi	SYSCERROR
54*ed093b41SRobert Mustacchi	RETC
55*ed093b41SRobert Mustacchi	SET_SIZE(__getcontext_extd)
56