Back to index

glibc  2.9
sysdep.h
Go to the documentation of this file.
00001 /* Copyright (C) 1999, 2000 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 #include <sysdeps/unix/powerpc/sysdep.h>
00020 
00021 
00022 /* This seems to always be the case on PPC.  */
00023 #define ALIGNARG(log2) log2
00024 
00025 /* How to define local lables.  */
00026 #define L(name) L..##name
00027 
00028 /* Label in text section.  */
00029 #define C_TEXT(name) .##name
00030 
00031 /* Function descriptor.  */
00032 #define FUNCDESC(real, code) \
00033   .toc;                                                                     \
00034   .csect real##[DS], 3;                                                     \
00035   .globl real;                                                              \
00036 real:                                                                \
00037   .long code, TOC[tc0], 0;
00038 
00039 /* Code to generate function entry code.  */
00040 #define ENTRY(name) \
00041   FUNCDESC (name, C_TEXT (name))                                     \
00042   .csect .text[PR], 2;                                                      \
00043   .globl C_TEXT (name);                                                     \
00044 C_TEXT (name):
00045 
00046 /* XXX For now we don't define any code.  */
00047 #define CALL_MCOUNT
00048 
00049 #define EALIGN_W_0  /* No words to insert.  */
00050 #define EALIGN_W_1  nop
00051 #define EALIGN_W_2  nop;nop
00052 #define EALIGN_W_3  nop;nop;nop
00053 #define EALIGN_W_4  EALIGN_W_3;nop
00054 #define EALIGN_W_5  EALIGN_W_4;nop
00055 #define EALIGN_W_6  EALIGN_W_5;nop
00056 #define EALIGN_W_7  EALIGN_W_6;nop
00057 
00058 /* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes
00059    past a 2^align boundary.  */
00060 #ifdef PROF
00061 #define EALIGN(name, alignt, words)                                         \
00062   FUNCDESC (name, C_TEXT (name))                                     \
00063   .csect .text[PR], 2;                                                      \
00064   .align ALIGNARG(2);                                                       \
00065   .globl C_TEXT (name);                                                     \
00066 C_TEXT (name):                                                              \
00067   CALL_MCOUNT                                                        \
00068   b L(align_0);                                                             \
00069   .align ALIGNARG(alignt);                                           \
00070   EALIGN_W_##words;                                                  \
00071 L(align_0):
00072 #else /* PROF */
00073 #define EALIGN(name, alignt, words)                                         \
00074   FUNCDESC (name, C_TEXT (name))                                     \
00075   .csect .text[PR], 2;                                                      \
00076   .align ALIGNARG(alignt);                                           \
00077   EALIGN_W_##words;                                                  \
00078   .globl C_TEXT (name);                                                     \
00079 C_TEXT (name):
00080 #endif
00081 
00082 /* No special end code for now.  We will eventually add to usual prolog
00083    with function length etc.  */
00084 #define END(name)
00085 
00086 
00087 /* Jumping to another function.  We are jumping to the TOC entry.  */
00088 #define JUMPTARGET(name) C_TEXT (name)