17c478bd9Sstevel@tonic-gate/* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 59a70fc3bSMark J. Nelson * Common Development and Distribution License (the "License"). 69a70fc3bSMark J. Nelson * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate/* 22*1ce128c5SRod Evans * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 269a70fc3bSMark J. Nelson .file "unwind_frame.s" 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate#ifdef _LIBCRUN_ 297c478bd9Sstevel@tonic-gate#define ENTRY(x) \ 307c478bd9Sstevel@tonic-gate .text; \ 317c478bd9Sstevel@tonic-gate .align 8; \ 327c478bd9Sstevel@tonic-gate .globl x; \ 337c478bd9Sstevel@tonic-gate .type x, @function; \ 347c478bd9Sstevel@tonic-gate x: 357c478bd9Sstevel@tonic-gate#define SET_SIZE(x) \ 367c478bd9Sstevel@tonic-gate .size x, .-x 377c478bd9Sstevel@tonic-gate#else 387c478bd9Sstevel@tonic-gate#include "SYS.h" 397c478bd9Sstevel@tonic-gate#endif 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate/* 427c478bd9Sstevel@tonic-gate * ==================== 437c478bd9Sstevel@tonic-gate * _Unw_capture_regs() 447c478bd9Sstevel@tonic-gate * -------------------- 457c478bd9Sstevel@tonic-gate * 467c478bd9Sstevel@tonic-gate * Given foo()->ex_throw()->_Unwind_RaiseException()->_Unw_capture_regs() 477c478bd9Sstevel@tonic-gate * fills in a register array with FP and the preserved registers 487c478bd9Sstevel@tonic-gate */ 497c478bd9Sstevel@tonic-gate ENTRY(_Unw_capture_regs) 507c478bd9Sstevel@tonic-gate movq %rbx,24(%rdi) /* save preserved registers */ 517c478bd9Sstevel@tonic-gate movq %rbp,48(%rdi) 527c478bd9Sstevel@tonic-gate movq %r12,96(%rdi) 537c478bd9Sstevel@tonic-gate movq %r13,104(%rdi) 547c478bd9Sstevel@tonic-gate movq %r14,112(%rdi) 557c478bd9Sstevel@tonic-gate movq %r15,120(%rdi) 567c478bd9Sstevel@tonic-gate ret 577c478bd9Sstevel@tonic-gate SET_SIZE(_Unw_capture_regs) 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate/* 607c478bd9Sstevel@tonic-gate * ==================== 617c478bd9Sstevel@tonic-gate * _Unw_jmp 627c478bd9Sstevel@tonic-gate * -------------------- 637c478bd9Sstevel@tonic-gate * 647c478bd9Sstevel@tonic-gate * _Unw_jmp is passed a pc and an array of register values. 657c478bd9Sstevel@tonic-gate */ 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate ENTRY(_Unw_jmp) 687c478bd9Sstevel@tonic-gate movq %rdi,%r8 /* save arguments to this func */ 697c478bd9Sstevel@tonic-gate movq %rsi,%rax 707c478bd9Sstevel@tonic-gate movq 40(%rax),%rdi /* set handler parameters */ 717c478bd9Sstevel@tonic-gate movq 32(%rax),%rsi 727c478bd9Sstevel@tonic-gate movq 8(%rax),%rdx 737c478bd9Sstevel@tonic-gate movq 16(%rax),%rcx 747c478bd9Sstevel@tonic-gate movq 24(%rax),%rbx /* restore preserved registers */ 757c478bd9Sstevel@tonic-gate movq 96(%rax),%r12 767c478bd9Sstevel@tonic-gate movq 104(%rax),%r13 777c478bd9Sstevel@tonic-gate movq 112(%rax),%r14 787c478bd9Sstevel@tonic-gate movq 120(%rax),%r15 797c478bd9Sstevel@tonic-gate movq 48(%rax),%rbp 807c478bd9Sstevel@tonic-gate movq 56(%rax),%rsp 81*1ce128c5SRod Evans movq (%rax),%rax 827c478bd9Sstevel@tonic-gate jmp *%r8 /* branch to handler */ 837c478bd9Sstevel@tonic-gate SET_SIZE(_Unw_jmp) 84