Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch

This commit is contained in:
Brian Behlendorf 2008-12-10 12:01:25 -08:00
commit ca69955c59
3 changed files with 291 additions and 13 deletions

View File

@ -1,7 +1,29 @@
/*
* This header file distributed under the terms of the CDDL.
* Portions Copyright 2008 Sun Microsystems, Inc. All Rights reserved.
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FRAME_H
#define _SYS_FRAME_H
@ -18,18 +40,92 @@ struct frame {
greg_t fr_savpc; /* saved program counter */
};
#if defined(_SYSCALL32)
typedef int32_t greg32_t;
typedef int64_t greg64_t;
/*
* Kernel's view of a 32-bit stack frame.
* In the x86 world, a stack frame looks like this:
*
* |--------------------------|
* 4n+8(%ebp) ->| argument word n |
* | ... | (Previous frame)
* 8(%ebp) ->| argument word 0 |
* |--------------------------|--------------------
* 4(%ebp) ->| return address |
* |--------------------------|
* 0(%ebp) ->| previous %ebp (optional) |
* |--------------------------|
* -4(%ebp) ->| unspecified | (Current frame)
* | ... |
* 0(%esp) ->| variable size |
* |--------------------------|
*/
struct frame32 {
greg32_t fr_savfp; /* saved frame pointer */
greg32_t fr_savpc; /* saved program counter */
};
#endif /* _SYSCALL32 */
/*
* Stack alignment macros.
*/
#define STACK_ALIGN32 4
#define STACK_ENTRY_ALIGN32 4
#define STACK_BIAS32 0
#define SA32(x) (((x)+(STACK_ALIGN32-1)) & ~(STACK_ALIGN32-1))
#define STACK_RESERVE32 0
#define MINFRAME32 0
#if defined(__amd64)
/*
* In the amd64 world, a stack frame looks like this:
*
* |--------------------------|
* 8n+16(%rbp)->| argument word n |
* | ... | (Previous frame)
* 16(%rbp) ->| argument word 0 |
* |--------------------------|--------------------
* 8(%rbp) ->| return address |
* |--------------------------|
* 0(%rbp) ->| previous %rbp |
* |--------------------------|
* -8(%rbp) ->| unspecified | (Current frame)
* | ... |
* 0(%rsp) ->| variable size |
* |--------------------------|
* -128(%rsp) ->| reserved for function |
* |--------------------------|
*
* The end of the input argument area must be aligned on a 16-byte
* boundary; i.e. (%rsp - 8) % 16 == 0 at function entry.
*
* The 128-byte location beyond %rsp is considered to be reserved for
* functions and is NOT modified by signal handlers. It can be used
* to store temporary data that is not needed across function calls.
*/
/*
* Stack alignment macros.
*/
#define STACK_ALIGN64 16
#define STACK_ENTRY_ALIGN64 8
#define STACK_BIAS64 0
#define SA64(x) (((x)+(STACK_ALIGN64-1)) & ~(STACK_ALIGN64-1))
#define STACK_RESERVE64 128
#define MINFRAME64 0
#define STACK_ALIGN STACK_ALIGN64
#define STACK_ENTRY_ALIGN STACK_ENTRY_ALIGN64
#define STACK_BIAS STACK_BIAS64
#define SA(x) SA64(x)
#define STACK_RESERVE STACK_RESERVE64
#define MINFRAME MINFRAME64
#elif defined(__i386)
#define STACK_ALIGN STACK_ALIGN32
#define STACK_ENTRY_ALIGN STACK_ENTRY_ALIGN32
#define STACK_BIAS STACK_BIAS32
#define SA(x) SA32(x)
#define STACK_RESERVE STACK_RESERVE32
#define MINFRAME MINFRAME32
#endif /* __i386 */
#endif /* _SYS_FRAME_H */

View File

@ -0,0 +1,182 @@
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_MACHELF_H
#define _SYS_MACHELF_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__amd64)
#include <sys/elf_amd64.h>
#elif defined(__i386)
#include <sys/elf_386.h>
#elif defined(__sparc)
#include <sys/elf_SPARC.h>
#endif
#ifndef _ASM
#include <sys/types.h>
#include <sys/elf.h>
#include <sys/link.h> /* for Elf*_Dyn */
#endif /* _ASM */
/*
* Make machine class dependent data types transparent to the common code
*/
#if defined(_ELF64) && !defined(_ELF32_COMPAT)
#ifndef _ASM
typedef Elf64_Xword Xword;
typedef Elf64_Lword Lword;
typedef Elf64_Sxword Sxword;
typedef Elf64_Word Word;
typedef Elf64_Sword Sword;
typedef Elf64_Half Half;
typedef Elf64_Addr Addr;
typedef Elf64_Off Off;
typedef uchar_t Byte;
#endif /* _ASM */
#if defined(_KERNEL)
#define ELF_R_TYPE ELF64_R_TYPE
#define ELF_R_SYM ELF64_R_SYM
#define ELF_R_TYPE_DATA ELF64_R_TYPE_DATA
#define ELF_R_INFO ELF64_R_INFO
#define ELF_ST_BIND ELF64_ST_BIND
#define ELF_ST_TYPE ELF64_ST_TYPE
#define ELF_M_SYM ELF64_M_SYM
#define ELF_M_SIZE ELF64_M_SIZE
#endif
#ifndef _ASM
typedef Elf64_Ehdr Ehdr;
typedef Elf64_Shdr Shdr;
typedef Elf64_Sym Sym;
typedef Elf64_Syminfo Syminfo;
typedef Elf64_Rela Rela;
typedef Elf64_Rel Rel;
typedef Elf64_Nhdr Nhdr;
typedef Elf64_Phdr Phdr;
typedef Elf64_Dyn Dyn;
typedef Elf64_Boot Boot;
typedef Elf64_Verdef Verdef;
typedef Elf64_Verdaux Verdaux;
typedef Elf64_Verneed Verneed;
typedef Elf64_Vernaux Vernaux;
typedef Elf64_Versym Versym;
typedef Elf64_Move Move;
typedef Elf64_Cap Cap;
#endif /* _ASM */
#else /* _ILP32 */
#ifndef _ASM
typedef Elf32_Word Xword; /* Xword/Sxword are 32-bits in Elf32 */
typedef Elf32_Lword Lword;
typedef Elf32_Sword Sxword;
typedef Elf32_Word Word;
typedef Elf32_Sword Sword;
typedef Elf32_Half Half;
typedef Elf32_Addr Addr;
typedef Elf32_Off Off;
typedef uchar_t Byte;
#endif /* _ASM */
#if defined(_KERNEL)
#define ELF_R_TYPE ELF32_R_TYPE
#define ELF_R_SYM ELF32_R_SYM
#define ELF_R_TYPE_DATA(x) (0)
#define ELF_R_INFO ELF32_R_INFO
#define ELF_ST_BIND ELF32_ST_BIND
#define ELF_ST_TYPE ELF32_ST_TYPE
#define ELF_M_SYM ELF32_M_SYM
#define ELF_M_SIZE ELF32_M_SIZE
#endif
#ifndef _ASM
typedef Elf32_Ehdr Ehdr;
typedef Elf32_Shdr Shdr;
typedef Elf32_Sym Sym;
typedef Elf32_Syminfo Syminfo;
typedef Elf32_Rela Rela;
typedef Elf32_Rel Rel;
typedef Elf32_Nhdr Nhdr;
typedef Elf32_Phdr Phdr;
typedef Elf32_Dyn Dyn;
typedef Elf32_Boot Boot;
typedef Elf32_Verdef Verdef;
typedef Elf32_Verdaux Verdaux;
typedef Elf32_Verneed Verneed;
typedef Elf32_Vernaux Vernaux;
typedef Elf32_Versym Versym;
typedef Elf32_Move Move;
typedef Elf32_Cap Cap;
#endif /* _ASM */
#endif /* _ILP32 */
/*
* Elf `printf' type-cast macros. These force arguments to be a fixed size
* so that Elf32 and Elf64 can share common format strings.
*/
#ifndef __lint
#define EC_ADDR(a) ((Elf64_Addr)(a)) /* "ull" */
#define EC_OFF(a) ((Elf64_Off)(a)) /* "ull" */
#define EC_HALF(a) ((Elf64_Half)(a)) /* "d" */
#define EC_WORD(a) ((Elf64_Word)(a)) /* "u" */
#define EC_SWORD(a) ((Elf64_Sword)(a)) /* "d" */
#define EC_XWORD(a) ((Elf64_Xword)(a)) /* "ull" */
#define EC_SXWORD(a) ((Elf64_Sxword)(a)) /* "ll" */
#define EC_LWORD(a) ((Elf64_Lword)(a)) /* "ull" */
/*
* A native pointer is special. Although it can be convenient to display
* these from a common format (ull), compilers may flag the cast of a pointer
* to an integer as illegal. Casting these pointers to the native pointer
* size, suppresses any compiler errors.
*/
#define EC_NATPTR(a) ((Elf64_Xword)(uintptr_t)(a)) /* "ull" */
#else
#define EC_ADDR(a) ((u_longlong_t)(a))
#define EC_OFF(a) ((u_longlong_t)(a))
#define EC_HALF(a) ((ushort_t)(a))
#define EC_WORD(a) ((uint_t)(a))
#define EC_SWORD(a) ((int)(a))
#define EC_XWORD(a) ((u_longlong_t)(a))
#define EC_SXWORD(a) ((longlong_t)(a))
#define EC_LWORD(a) ((u_longlong_t)(a))
#define EC_NATPTR(a) ((u_longlong_t)(a))
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MACHELF_H */

View File

@ -148,7 +148,7 @@ getpcstack(uintptr_t *pcstack, int pcstack_limit, int check_signal)
break;
else if (nextfp <= minfp || (tmp - base) >= size) {
#ifndef UMEM_STANDALONE
if (tmp == NULL || !on_altstack)
if (tmp == 0 || !on_altstack)
break;
/*
* If we're on an alternate signal stack, try jumping