cpr_wakecode.h revision bc4466305498eebc620bcefaac080629452b3156
2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _CPR_WC_H
2N/A#define _CPR_WC_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define WC_CODESIZE 0x400
2N/A
2N/A#if ! defined(_ASM)
2N/A
2N/A#include <sys/rm_platter.h>
2N/A#include <sys/psm_types.h>
2N/A
2N/Atypedef struct wc_cpu {
2N/A uint64_t wc_retaddr;
2N/A uint64_t wc_virtaddr;
2N/A uint64_t wc_cr0;
2N/A 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;
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 */