Commit | Line | Data |
---|---|---|
dd3b648e RP |
1 | /* Copyright (C) 1990 Free Software Foundation, Inc. |
2 | ||
3 | This file is part of GDB. | |
4 | ||
5 | GDB is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 1, or (at your option) | |
8 | any later version. | |
9 | ||
10 | GDB is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with GDB; see the file COPYING. If not, write to | |
17 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
18 | ||
19 | #if !defined (PARAM_H) | |
20 | #define PARAM_H 1 | |
21 | ||
22 | /* DO NOT #include "tm.h" -- a particular tm file has been inc'd by caller */ | |
23 | ||
24 | #include "xm.h" | |
25 | ||
26 | /* TARGET_BYTE_ORDER and HOST_BYTE_ORDER should be defined to one of these. */ | |
27 | #if !defined (BIG_ENDIAN) | |
28 | #define BIG_ENDIAN 4321 | |
29 | #endif | |
30 | ||
31 | #if !defined (LITTLE_ENDIAN) | |
32 | #define LITTLE_ENDIAN 1234 | |
33 | #endif | |
34 | ||
35 | /* The bit byte-order has to do just with numbering of bits in | |
36 | debugging symbols and such. Conceptually, it's quite separate | |
37 | from byte/word byte order. */ | |
38 | ||
39 | #if TARGET_BYTE_ORDER == BIG_ENDIAN | |
40 | #define BITS_BIG_ENDIAN 1 | |
41 | #endif | |
42 | ||
43 | #if TARGET_BYTE_ORDER == LITTLE_ENDIAN | |
44 | /*#define BITS_BIG_ENDIAN */ | |
45 | #endif | |
46 | ||
47 | /* Swap LEN bytes at BUFFER between target and host byte-order. */ | |
48 | #if TARGET_BYTE_ORDER == HOST_BYTE_ORDER | |
49 | #define SWAP_TARGET_AND_HOST(buffer,len) | |
50 | #else /* Target and host byte order differ. */ | |
51 | #define SWAP_TARGET_AND_HOST(buffer,len) \ | |
52 | { \ | |
53 | char tmp; \ | |
54 | char *p = (char *)(buffer); \ | |
55 | char *q = ((char *)(buffer)) + len - 1; \ | |
56 | for (; p < q; p++, q--) \ | |
57 | { \ | |
58 | tmp = *q; \ | |
59 | *q = *p; \ | |
60 | *p = tmp; \ | |
61 | } \ | |
62 | } | |
63 | #endif /* Target and host byte order differ. */ | |
64 | ||
65 | /* On some machines there are bits in addresses which are not really | |
66 | part of the address, but are used by the kernel, the hardware, etc. | |
67 | for special purposes. ADDR_BITS_REMOVE takes out any such bits | |
68 | so we get a "real" address such as one would find in a symbol | |
69 | table. ADDR_BITS_SET sets those bits the way the system wants | |
70 | them. */ | |
71 | #if !defined (ADDR_BITS_REMOVE) | |
72 | #define ADDR_BITS_REMOVE(addr) (addr) | |
73 | #define ADDR_BITS_SET(addr) (addr) | |
74 | #endif /* No ADDR_BITS_REMOVE. */ | |
75 | ||
76 | #endif /* param.h not already included. */ |