Back to index

glibc  2.9
sysdep.h
Go to the documentation of this file.
00001 /* Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifdef __ASSEMBLER__
00020 
00021 /* Get the Mach definitions of ENTRY and kernel_trap.  */
00022 #include <mach/machine/syscall_sw.h>
00023 
00024 /* The Mach definitions assume underscores should be prepended to
00025    symbol names.  Redefine them to do so only when appropriate.  */
00026 #undef EXT
00027 #undef LEXT
00028 #define EXT(x) C_SYMBOL_NAME(x)
00029 #define LEXT(x) C_SYMBOL_NAME(x##:)
00030 
00031 #ifdef HAVE_ELF
00032 /* For ELF we need to add the `.type' directive to make shared libraries
00033    work right.  */
00034 #undef ENTRY
00035 #define ENTRY(name) \
00036   ASM_GLOBAL_DIRECTIVE name; \
00037   .align ALIGN; \
00038   .type name,@function; \
00039   name:
00040 #endif
00041 
00042 #endif
00043 
00044 /* This is invoked by things run when there is random lossage, before they
00045    try to do anything else.  Just to be safe, deallocate the reply port so
00046    bogons arriving on it don't foul up future RPCs.  */
00047 
00048 #ifndef __ASSEMBLER__
00049 #define FATAL_PREPARE_INCLUDE <mach/mig_support.h>
00050 #define FATAL_PREPARE __mig_dealloc_reply_port (MACH_PORT_NULL)
00051 #endif
00052 
00053 /* sysdeps/mach/MACHINE/sysdep.h should define the following macros.  */
00054 
00055 /* Produce a text assembler label for the C global symbol NAME.  */
00056 #ifndef ENTRY
00057 #define ENTRY(name) .error ENTRY not defined by sysdeps/mach/MACHINE/sysdep.h
00058 /* This is not used on all machines.  */
00059 #endif
00060 
00061 /* Set variables ARGC, ARGV, and ENVP for the arguments
00062    left on the stack by the microkernel.  */
00063 #ifndef SNARF_ARGS
00064 #define SNARF_ARGS(argc, argv, envp)
00065 #error SNARF_ARGS not defined by sysdeps/mach/MACHINE/sysdep.h
00066 #endif
00067 
00068 /* Call the C function FN with no arguments,
00069    on a stack starting at SP (as returned by *_cthread_init_routine).
00070    You don't need to deal with FN returning; it shouldn't.  */
00071 #ifndef       CALL_WITH_SP
00072 #define CALL_WITH_SP(fn, sp)
00073 #error CALL_WITH_SP not defined by sysdeps/mach/MACHINE/sysdep.h
00074 #endif
00075 
00076 /* LOSE can be defined as the `halt' instruction or something
00077    similar which will cause the process to die in a characteristic
00078    way suggesting a bug.  */
00079 #ifndef LOSE
00080 #define       LOSE   ({ volatile int zero = 0; zero / zero; })
00081 #endif
00082 
00083 /* One of these should be defined to specify the stack direction.  */
00084 #if !defined (STACK_GROWTH_UP) && !defined (STACK_GROWTH_DOWN)
00085 #error stack direction unspecified
00086 #endif
00087 
00088 /* Used by some assembly code.  */
00089 #ifdef NO_UNDERSCORES
00090 #define C_SYMBOL_NAME(name) name
00091 #else
00092 #define C_SYMBOL_NAME(name) _##name
00093 #endif