blob: 7f55c9dcd60b0c23c894812f84d167e0f8f86c75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _CPR_WC_H
#define _CPR_WC_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define WC_CODESIZE 0x400
#if ! defined(_ASM)
#include <sys/rm_platter.h>
#include <sys/psm_types.h>
typedef struct wc_cpu {
uint64_t wc_retaddr;
uint64_t wc_virtaddr;
uint64_t wc_cr0;
uint64_t wc_cr3;
uint64_t wc_cr4;
uint64_t wc_cr8;
uint64_t wc_fs;
uint64_t wc_fsbase;
uint64_t wc_gs;
uint64_t wc_gsbase;
uint64_t wc_kgsbase;
uint64_t wc_r8;
uint64_t wc_r9;
uint64_t wc_r10;
uint64_t wc_r11;
uint64_t wc_r12;
uint64_t wc_r13;
uint64_t wc_r14;
uint64_t wc_r15;
uint64_t wc_rax;
uint64_t wc_rbp;
uint64_t wc_rbx;
uint64_t wc_rcx;
uint64_t wc_rdi;
uint64_t wc_rdx;
uint64_t wc_rsi;
uint64_t wc_rsp;
#if defined(__amd64)
/*
* The compiler will want to 64-bit align the 64-bit rm_gdt_base
* pointer, so we need to add an extra four bytes of padding here to
* make sure rm_gdt_lim and rm_gdt_base will align to create a proper
* ten byte GDT pseudo-descriptor.
*/
uint32_t wc_gdt_pad1;
#endif
ushort_t wc_gdt_pad2;
ushort_t wc_gdt_limit;
user_desc_t *wc_gdt_base;
#if defined(__amd64)
/*
* The compiler will want to 64-bit align the 64-bit rm_idt_base
* pointer, so we need to add an extra four bytes of padding here to
* make sure rm_idt_lim and rm_idt_base will align to create a proper
* ten byte IDT pseudo-descriptor.
*/
uint32_t wc_idt_pad1;
#endif
ushort_t wc_idt_pad2;
ushort_t wc_idt_limit;
user_desc_t *wc_idt_base;
#if defined(__amd64)
uint64_t wc_tr;
uint64_t wc_ldt;
uint64_t wc_eflags;
#else
uint32_t wc_tr;
uint32_t wc_ldt;
uint32_t wc_eflags;
#endif
uint32_t wc_ebx;
uint32_t wc_edi;
uint32_t wc_esi;
uint32_t wc_ebp;
uint32_t wc_esp;
uint16_t wc_ss;
uint16_t wc_cs;
uint16_t wc_ds;
uint16_t wc_es;
char wc_stack[400];
psm_state_request_t wc_apic_state;
/* temp stack grows down to here */
} wc_cpu_t;
typedef struct wc_wakecode {
rm_platter_t wc_platter;
wc_cpu_t wc_cpu;
/* temp stack grows down to here */
} wakecode_t;
/*
* this is NOT correctly aligned, see description of idt & gdt, limit and
* base in wc_cpu_t above
*/
typedef struct wc_desctbr {
ushort_t limit;
void *base;
} wc_desctbr_t;
extern int wc_save_context(wc_cpu_t *);
extern void wc_rm_start(void);
extern void wc_rm_end(void);
extern void (*cpr_start_cpu_func)(void);
#endif /* ! defined(_ASM) */
#define WC_STKSTART 0x7fc /* end of rm_platter page */
#ifdef __cplusplus
}
#endif
#endif /* _CPR_WC_H */
|