Ignore:
Timestamp:
Aug 20, 2007, 12:46:14 AM (18 years ago)
Author:
bird
Message:

made it build again.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/kProfile/kDbgBase.h

    r3525 r3526  
    22/** @file
    33 *
    4  * kLdr - The Dynamic Loader, Base Definitions and Typedefs.
     4 * kDbg - The Debug Info Reader, Base Definitions and Typedefs.
    55 *
    66 * Copyright (c) 2006-2007 knut st. osmundsen <bird@anduin.net>
    77 *
    88 *
    9  * This file is part of kLdr.
     9 * This file is part of kDbg.
    1010 *
    11  * kLdr is free software; you can redistribute it and/or modify
     11 * kDbg is free software; you can redistribute it and/or modify
    1212 * it under the terms of the GNU General Public License as published by
    1313 * the Free Software Foundation; either version 2 of the License, or
    1414 * (at your option) any later version.
    1515 *
    16  * kLdr is distributed in the hope that it will be useful,
     16 * kDbg is distributed in the hope that it will be useful,
    1717 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1818 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     
    2020 *
    2121 * You should have received a copy of the GNU General Public License
    22  * along with kLdr; if not, write to the Free Software
     22 * along with kDbg; if not, write to the Free Software
    2323 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2424 *
    2525 */
    2626
    27 #ifndef ___kLdrBase_h___
    28 #define ___kLdrBase_h___
     27#ifndef ___kDbgBase_h___
     28#define ___kDbgBase_h___
    2929
    3030
    31 /** @defgroup grp_kLdrBase  kLdrBase - Base Definitions And Typedefs
     31/** @defgroup grp_kDbgBase  kDbgBase - Base Definitions And Typedefs
    3232 * @{ */
    3333
    3434/*
    35  * kLdr depend on size_t, [u]intNN_t, [u]intptr_t and some related constants.
    36  * If KLDR_ALREADY_INCLUDED_STD_TYPES is defined, these has already been defined.
     35 * kDbg depend on size_t, [u]intNN_t, [u]intptr_t and some related constants.
     36 * If KDBG_ALREADY_INCLUDED_STD_TYPES or KCOMMON_ALREADY_INCLUDED_STD_TYPES
     37 * is defined, these has already been defined.
    3738 */
    38 #ifndef KLDR_ALREADY_INCLUDED_STD_TYPES
     39#if !defined(KDBG_ALREADY_INCLUDED_STD_TYPES) && !defined(KCOMMON_ALREADY_INCLUDED_STD_TYPES)
     40# define KCOMMON_ALREADY_INCLUDED_STD_TYPES 1
    3941# include <sys/types.h>
    4042# include <stddef.h>
     
    7375#  include <stdint.h>
    7476# endif
    75 #endif /* !KLDR_ALREADY_INCLUDED_STD_TYPES */
     77#endif /* !KDBG_ALREADY_INCLUDED_STD_TYPES && !KCOMMON_ALREADY_INCLUDED_STD_TYPES */
    7678
    7779
    7880/** Get the minimum of two values. */
    79 #define KLDR_MIN(a, b)              ((a) <= (b) ? (a) : (b))
     81#define KDBG_MIN(a, b)              ((a) <= (b) ? (a) : (b))
    8082/** Get the maximum of two values. */
    81 #define KLDR_MAX(a, b)              ((a) >= (b) ? (a) : (b))
     83#define KDBG_MAX(a, b)              ((a) >= (b) ? (a) : (b))
    8284/** Calculate the offset of a structure member. */
    83 #define KLDR_OFFSETOF(strct, memb)  ( (size_t)( &((strct *)0)->memb ) )
     85#define KDBG_OFFSETOF(strct, memb)  ( (size_t)( &((strct *)0)->memb ) )
    8486/** Align a size_t value. */
    85 #define KLDR_ALIGN_Z(val, align)    ( ((val) + ((align) - 1)) & ~(size_t)((align) - 1) )
     87#define KDBG_ALIGN_Z(val, align)    ( ((val) + ((align) - 1)) & ~(size_t)((align) - 1) )
    8688/** Align a void * value. */
    87 #define KLDR_ALIGN_P(pv, align)     ( (void *)( ((uintptr_t)(pv) + ((align) - 1)) & ~(uintptr_t)((align) - 1) ) )
     89#define KDBG_ALIGN_P(pv, align)     ( (void *)( ((uintptr_t)(pv) + ((align) - 1)) & ~(uintptr_t)((align) - 1) ) )
    8890/** Align a size_t value. */
    89 #define KLDR_ALIGN_ADDR(val, align) ( ((val) + ((align) - 1)) & ~(KLDRADDR)((align) - 1) )
     91#define KDBG_ALIGN_ADDR(val, align) ( ((val) + ((align) - 1)) & ~(KLDRADDR)((align) - 1) )
    9092/** Number of elements in an array. */
    91 #define KLDR_ELEMENTS(a)            ( sizeof(a) / sizeof((a)[0]) )
     93#define KDBG_ELEMENTS(a)            ( sizeof(a) / sizeof((a)[0]) )
    9294
    9395
    94 /** @def KLDR_LITTLE_ENDIAN
    95  * The kLdr build is for a little endian target. */
    96 /** @def KLDR_BIG_ENDIAN
    97  * The kLdr build is for a big endian target. */
    98 #if !defined(KLDR_LITTLE_ENDIAN) && !defined(KLDR_BIG_ENDIAN)
    99 # define KLDR_LITTLE_ENDIAN
     96/** @def KDBG_LITTLE_ENDIAN
     97 * The kDbg build is for a little endian target. */
     98/** @def KDBG_BIG_ENDIAN
     99 * The kDbg build is for a big endian target. */
     100#if !defined(KDBG_LITTLE_ENDIAN) && !defined(KDBG_BIG_ENDIAN)
     101# define KDBG_LITTLE_ENDIAN
    100102#endif
    101103#ifdef __DOXYGEN__
    102 # define KLDR_BIG_ENDIAN
     104# define KDBG_BIG_ENDIAN
    103105#endif
    104106
     
    107109 * @{ */
    108110
    109 /** @def KLDR_E2E_U16
     111/** @def KDBG_E2E_U16
    110112 * Convert the endian of an unsigned 16-bit value. */
    111 # define KLDR_E2E_U16(u16)      ( (uint16_t) (((u16) >> 8) | ((u16) << 8)) )
    112 /** @def KLDR_E2E_U32
     113# define KDBG_E2E_U16(u16)      ( (uint16_t) (((u16) >> 8) | ((u16) << 8)) )
     114/** @def KDBG_E2E_U32
    113115 * Convert the endian of an unsigned 32-bit value. */
    114 # define KLDR_E2E_U32(u32)      (   ( ((u32) & UINT32_C(0xff000000)) >> 24 ) \
     116# define KDBG_E2E_U32(u32)      (   ( ((u32) & UINT32_C(0xff000000)) >> 24 ) \
    115117                                  | ( ((u32) & UINT32_C(0x00ff0000)) >>  8 ) \
    116118                                  | ( ((u32) & UINT32_C(0x0000ff00)) <<  8 ) \
    117119                                  | ( ((u32) & UINT32_C(0x000000ff)) << 24 ) \
    118120                                )
    119 /** @def KLDR_E2E_U64
     121/** @def KDBG_E2E_U64
    120122 * Convert the endian of an unsigned 64-bit value. */
    121 # define KLDR_E2E_U64(u64)      (   ( ((u64) & UINT64_C(0xff00000000000000)) >> 56 ) \
     123# define KDBG_E2E_U64(u64)      (   ( ((u64) & UINT64_C(0xff00000000000000)) >> 56 ) \
    122124                                  | ( ((u64) & UINT64_C(0x00ff000000000000)) >> 40 ) \
    123125                                  | ( ((u64) & UINT64_C(0x0000ff0000000000)) >> 24 ) \
     
    129131                                )
    130132
    131 /** @def KLDR_LE2H_U16
     133/** @def KDBG_LE2H_U16
    132134 * Unsigned 16-bit little-endian to host endian. */
    133 /** @def KLDR_LE2H_U32
     135/** @def KDBG_LE2H_U32
    134136 * Unsigned 32-bit little-endian to host endian. */
    135 /** @def KLDR_LE2H_U64
     137/** @def KDBG_LE2H_U64
    136138 * Unsigned 64-bit little-endian to host endian. */
    137 /** @def KLDR_BE2H_U16
     139/** @def KDBG_BE2H_U16
    138140 * Unsigned 16-bit big-endian to host endian. */
    139 /** @def KLDR_BE2H_U32
     141/** @def KDBG_BE2H_U32
    140142 * Unsigned 32-bit big-endian to host endian. */
    141 /** @def KLDR_BE2H_U64
     143/** @def KDBG_BE2H_U64
    142144 * Unsigned 64-bit big-endian to host endian. */
    143 #ifdef KLDR_LITTLE_ENDIAN
    144 # define KLDR_LE2H_U16(u16)  ((uint16_t)(u16))
    145 # define KLDR_LE2H_U32(u32)  ((uint32_t)(u32))
    146 # define KLDR_LE2H_U64(u64)  ((uint32_t)(u32))
    147 # define KLDR_BE2H_U16(u16)  KLDR_E2E_U16(u16)
    148 # define KLDR_BE2H_U32(u32)  KLDR_E2E_U32(u32)
    149 # define KLDR_BE2H_U64(u64)  KLDR_E2E_U64(u64)
    150 #elif defined(KLDR_BIG_ENDIAN)
    151 # define KLDR_LE2H_U16(u16)  KLDR_E2E_U16(u16)
    152 # define KLDR_LE2H_U32(u32)  KLDR_E2E_U32(u32)
    153 # define KLDR_LE2H_U32(u64)  KLDR_E2E_U64(u64)
    154 # define KLDR_BE2H_U16(u16)  ((uint16_t)(u16))
    155 # define KLDR_BE2H_U32(u32)  ((uint32_t)(u32))
    156 # define KLDR_BE2H_U64(u64)  ((uint32_t)(u32))
     145#ifdef KDBG_LITTLE_ENDIAN
     146# define KDBG_LE2H_U16(u16)  ((uint16_t)(u16))
     147# define KDBG_LE2H_U32(u32)  ((uint32_t)(u32))
     148# define KDBG_LE2H_U64(u64)  ((uint32_t)(u32))
     149# define KDBG_BE2H_U16(u16)  KDBG_E2E_U16(u16)
     150# define KDBG_BE2H_U32(u32)  KDBG_E2E_U32(u32)
     151# define KDBG_BE2H_U64(u64)  KDBG_E2E_U64(u64)
     152#elif defined(KDBG_BIG_ENDIAN)
     153# define KDBG_LE2H_U16(u16)  KDBG_E2E_U16(u16)
     154# define KDBG_LE2H_U32(u32)  KDBG_E2E_U32(u32)
     155# define KDBG_LE2H_U32(u64)  KDBG_E2E_U64(u64)
     156# define KDBG_BE2H_U16(u16)  ((uint16_t)(u16))
     157# define KDBG_BE2H_U32(u32)  ((uint32_t)(u32))
     158# define KDBG_BE2H_U64(u64)  ((uint32_t)(u32))
    157159#else
    158 # error "KLDR_BIG_ENDIAN or KLDR_LITTLE_ENDIAN is supposed to be defined."
     160# error "KDBG_BIG_ENDIAN or KDBG_LITTLE_ENDIAN is supposed to be defined."
    159161#endif
    160162
Note: See TracChangeset for help on using the changeset viewer.