1211608Srpaulo/* 2211608Srpaulo * CDDL HEADER START 3211608Srpaulo * 4211608Srpaulo * The contents of this file are subject to the terms of the 5211608Srpaulo * Common Development and Distribution License, Version 1.0 only 6211608Srpaulo * (the "License"). You may not use this file except in compliance 7211608Srpaulo * with the License. 8211608Srpaulo * 9211608Srpaulo * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10211608Srpaulo * or http://www.opensolaris.org/os/licensing. 11211608Srpaulo * See the License for the specific language governing permissions 12211608Srpaulo * and limitations under the License. 13211608Srpaulo * 14211608Srpaulo * When distributing Covered Code, include this CDDL HEADER in each 15211608Srpaulo * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16211608Srpaulo * If applicable, add the following below this CDDL HEADER, with the 17211608Srpaulo * fields enclosed by brackets "[]" replaced with your own identifying 18211608Srpaulo * information: Portions Copyright [yyyy] [name of copyright owner] 19211608Srpaulo * 20211608Srpaulo * CDDL HEADER END 21211608Srpaulo * 22211608Srpaulo * $FreeBSD$ 23211608Srpaulo */ 24211608Srpaulo/* 25211608Srpaulo * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 26211608Srpaulo * Use is subject to license terms. 27211608Srpaulo */ 28211608Srpaulo 29211608Srpaulo/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 30211608Srpaulo 31211608Srpaulo/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 32211608Srpaulo/* All Rights Reserved */ 33211608Srpaulo 34211608Srpaulo#ifndef _REGSET_H 35211608Srpaulo#define _REGSET_H 36211608Srpaulo 37211608Srpaulo/* 38211608Srpaulo * #pragma ident "@(#)regset.h 1.11 05/06/08 SMI" 39211608Srpaulo */ 40211608Srpaulo 41211608Srpaulo#ifdef __cplusplus 42211608Srpauloextern "C" { 43211608Srpaulo#endif 44211608Srpaulo 45211608Srpaulo/* 46211608Srpaulo * The names and offsets defined here should be specified by the 47211608Srpaulo * AMD64 ABI suppl. 48211608Srpaulo * 49211608Srpaulo * We make fsbase and gsbase part of the lwp context (since they're 50211608Srpaulo * the only way to access the full 64-bit address range via the segment 51211608Srpaulo * registers) and thus belong here too. However we treat them as 52211608Srpaulo * read-only; if %fs or %gs are updated, the results of the descriptor 53211608Srpaulo * table lookup that those updates implicitly cause will be reflected 54211608Srpaulo * in the corresponding fsbase and/or gsbase values the next time the 55211608Srpaulo * context can be inspected. However it is NOT possible to override 56211608Srpaulo * the fsbase/gsbase settings via this interface. 57211608Srpaulo * 58211608Srpaulo * Direct modification of the base registers (thus overriding the 59211608Srpaulo * descriptor table base address) can be achieved with _lwp_setprivate. 60211608Srpaulo */ 61211608Srpaulo 62211608Srpaulo#define REG_GSBASE 27 63211608Srpaulo#define REG_FSBASE 26 64265278Smarkj#if defined(sun) 65211608Srpaulo#define REG_DS 25 66211608Srpaulo#define REG_ES 24 67211608Srpaulo 68211608Srpaulo#define REG_GS 23 69211608Srpaulo#define REG_FS 22 70211608Srpaulo#define REG_SS 21 71211608Srpaulo#define REG_RSP 20 72211608Srpaulo#define REG_RFL 19 73211608Srpaulo#define REG_CS 18 74211608Srpaulo#define REG_RIP 17 75211608Srpaulo#define REG_ERR 16 76211608Srpaulo#define REG_TRAPNO 15 77211608Srpaulo#define REG_RAX 14 78211608Srpaulo#define REG_RCX 13 79211608Srpaulo#define REG_RDX 12 80211608Srpaulo#define REG_RBX 11 81211608Srpaulo#define REG_RBP 10 82211608Srpaulo#define REG_RSI 9 83211608Srpaulo#define REG_RDI 8 84211608Srpaulo#define REG_R8 7 85211608Srpaulo#define REG_R9 6 86211608Srpaulo#define REG_R10 5 87211608Srpaulo#define REG_R11 4 88211608Srpaulo#define REG_R12 3 89211608Srpaulo#define REG_R13 2 90211608Srpaulo#define REG_R14 1 91211608Srpaulo#define REG_R15 0 92265278Smarkj#else 93265278Smarkj#define REG_SS 25 94265278Smarkj#define REG_RSP 24 95265278Smarkj#define REG_RFL 23 96265278Smarkj#define REG_CS 22 97265278Smarkj#define REG_RIP 21 98265278Smarkj#define REG_DS 20 99265278Smarkj#define REG_ES 19 100265278Smarkj#define REG_ERR 18 101265278Smarkj#define REG_GS 17 102265278Smarkj#define REG_FS 16 103265278Smarkj#define REG_TRAPNO 15 104265278Smarkj#define REG_RAX 14 105265278Smarkj#define REG_RCX 13 106265278Smarkj#define REG_RDX 12 107265278Smarkj#define REG_RBX 11 108265278Smarkj#define REG_RBP 10 109265278Smarkj#define REG_RSI 9 110265278Smarkj#define REG_RDI 8 111265278Smarkj#define REG_R8 7 112265278Smarkj#define REG_R9 6 113265278Smarkj#define REG_R10 5 114265278Smarkj#define REG_R11 4 115265278Smarkj#define REG_R12 3 116265278Smarkj#define REG_R13 2 117265278Smarkj#define REG_R14 1 118265278Smarkj#define REG_R15 0 119265278Smarkj#endif 120211608Srpaulo 121211608Srpaulo/* 122211608Srpaulo * The names and offsets defined here are specified by i386 ABI suppl. 123211608Srpaulo */ 124211608Srpaulo 125265278Smarkj#if defined(sun) 126211608Srpaulo#define SS 18 /* only stored on a privilege transition */ 127211608Srpaulo#define UESP 17 /* only stored on a privilege transition */ 128211608Srpaulo#define EFL 16 129211608Srpaulo#define CS 15 130211608Srpaulo#define EIP 14 131211608Srpaulo#define ERR 13 132211608Srpaulo#define TRAPNO 12 133211608Srpaulo#define EAX 11 134211608Srpaulo#define ECX 10 135211608Srpaulo#define EDX 9 136211608Srpaulo#define EBX 8 137211608Srpaulo#define ESP 7 138211608Srpaulo#define EBP 6 139211608Srpaulo#define ESI 5 140211608Srpaulo#define EDI 4 141211608Srpaulo#define DS 3 142211608Srpaulo#define ES 2 143211608Srpaulo#define FS 1 144211608Srpaulo#define GS 0 145265278Smarkj#else 146265278Smarkj#define GS 18 147265278Smarkj#define SS 17 /* only stored on a privilege transition */ 148265278Smarkj#define UESP 16 /* only stored on a privilege transition */ 149265278Smarkj#define EFL 15 150265278Smarkj#define CS 14 151265278Smarkj#define EIP 13 152265278Smarkj#define ERR 12 153265278Smarkj#define TRAPNO 11 154265278Smarkj#define EAX 10 155265278Smarkj#define ECX 9 156265278Smarkj#define EDX 8 157265278Smarkj#define EBX 7 158265278Smarkj#define ESP 6 159265278Smarkj#define EBP 5 160265278Smarkj#define ESI 4 161265278Smarkj#define EDI 3 162265278Smarkj#define DS 2 163265278Smarkj#define ES 1 164265278Smarkj#define FS 0 165265278Smarkj#endif 166211608Srpaulo 167211608Srpaulo#define REG_PC EIP 168211608Srpaulo#define REG_FP EBP 169211608Srpaulo#define REG_SP UESP 170211608Srpaulo#define REG_PS EFL 171211608Srpaulo#define REG_R0 EAX 172211608Srpaulo#define REG_R1 EDX 173211608Srpaulo 174211608Srpaulo#ifdef __cplusplus 175211608Srpaulo} 176211608Srpaulo#endif 177211608Srpaulo 178211608Srpaulo#endif /* _REGSET_H */ 179