lx_brand.h revision 319378d99bca1eacf64f0a464b0175bf66b422ab
/*
* 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
* 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 _LX_BRAND_H
#define _LX_BRAND_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifndef _ASM
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define LX_BRANDNAME "lx"
/*
* Brand uname info
*/
#define LX_UNAME_SYSNAME "Linux"
#define LX_UNAME_RELEASE_2_6 "2.6.18"
#define LX_UNAME_RELEASE_2_4 "2.4.21"
#define LX_UNAME_VERSION "BrandZ fake linux"
#define LX_UNAME_MACHINE "i686"
#define LX_LINKER_NAME "ld-linux.so.2"
#define LX_LIBC_NAME "libc.so.6"
#define LX_LIB "lx_brand.so.1"
#define LX_NSYSCALLS_2_4 270
#define LX_NSYSCALLS_2_6 317
#define LX_NSYSCALLS LX_NSYSCALLS_2_6
#define LX_KERN_2_4 0
#define LX_KERN_2_6 1
/*
* brand(2) subcommands
*
* Everything >= 128 is a brand-specific subcommand.
* 192 to 462 are reserved for system calls, although most of that space is
* unused.
*/
#define B_LPID_TO_SPAIR 128
#define B_SYSENTRY 129
#define B_SYSRETURN 130
#define B_PTRACE_SYSCALL 131
#define B_SET_AFFINITY_MASK 132
#define B_GET_AFFINITY_MASK 133
#define B_EMULATE_SYSCALL 192
#define LX_VERSION_1 1
#define LX_VERSION LX_VERSION_1
/* Aux vector containing phdr of linux executable, used by lx_librtld_db */
/* Aux vector containing hz value */
#define AT_CLKTCK 17
#ifndef _ASM
typedef struct lx_brand_registration {
void *lxbr_handler; /* base address of handler */
void *lxbr_tracehandler; /* base address of trace handler */
void *lxbr_traceflag; /* address of trace flag */
#ifdef _SYSCALL32
typedef struct lx_brand_registration32 {
#endif
typedef struct lx_regs {
long lxr_gs;
long lxr_edi;
long lxr_esi;
long lxr_ebp;
long lxr_esp;
long lxr_ebx;
long lxr_edx;
long lxr_ecx;
long lxr_eax;
long lxr_eip;
long lxr_orig_eax;
} lx_regs_t;
#endif /* _ASM */
/*
* GDT usage
*/
#define GDT_TLSMIN (GDT_BRANDMIN)
#ifndef _ASM
/*
* Stores information needed by the lx linker to launch the main
* lx executable.
*/
typedef struct lx_elf_data {
int ed_phdr;
int ed_phent;
int ed_phnum;
int ed_entry;
int ed_base;
int ed_ldentry;
#ifdef _KERNEL
typedef struct lx_proc_data {
#ifdef __amd64
#else
#endif /* __amd64 */
/*
* lx-specific data in the klwp_t
*/
typedef struct lx_lwp_data {
int br_signal; /* signal to send to parent when */
/* clone()'ed child terminates */
int br_exitwhy; /* reason for thread (process) exit */
int br_exitwhat; /* exit code / killing signal */
/* descriptors used by libc for TLS */
void *br_clear_ctidp; /* clone thread id ptr */
void *br_set_ctidp; /* clone thread id ptr */
/*
* The following struct is used by lx_clone()
* to pass info into fork()
*/
void *br_clone_args;
/*
* Space to save off userland Linux %gs pointer so we can restore it
* before calling signal handlers.
*/
/* brand specific data */
typedef struct lx_zone_data {
int kernel_version;
#define BR_CPU_BOUND 0x0001
void lx_brand_int80_callback(void);
extern int lx_get_zone_kern_version(zone_t *);
extern int lx_get_kern_version(void);
extern int lx_debug;
#endif /* _KERNEL */
#endif /* _ASM */
#ifdef __cplusplus
}
#endif
#endif /* _LX_BRAND_H */