diff options
author | Mike Frysinger <vapier@gentoo.org> | 2024-01-03 02:17:16 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2024-01-03 02:17:16 -0500 |
commit | b37a470842dd788c32e52f5b43de44cc30c19305 (patch) | |
tree | 5aa2fefbe1c4d96a460bb75b4184ba773c3f3a9c /sim | |
parent | d4edfa1e2e0d56b9e06b2d884866f0c46f4d81d3 (diff) | |
download | gdb-b37a470842dd788c32e52f5b43de44cc30c19305.zip gdb-b37a470842dd788c32e52f5b43de44cc30c19305.tar.gz gdb-b37a470842dd788c32e52f5b43de44cc30c19305.tar.bz2 |
sim: ppc: switch to common endian code
The common sim-endian is a forked & updated version of the ppc code.
Fortunately, they didn't diverge from the basic APIs, so they are
still compatible, which means we can just delete the ppc version now
that the build env is merged at the top-level.
Diffstat (limited to 'sim')
-rw-r--r-- | sim/Makefile.in | 2 | ||||
-rw-r--r-- | sim/ppc/local.mk | 4 | ||||
-rw-r--r-- | sim/ppc/sim-endian-n.h | 133 | ||||
-rw-r--r-- | sim/ppc/sim-endian.c | 76 | ||||
-rw-r--r-- | sim/ppc/sim-endian.h | 225 |
5 files changed, 0 insertions, 440 deletions
diff --git a/sim/Makefile.in b/sim/Makefile.in index 00a0062..3ef1a59 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -5812,8 +5812,6 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo @SIM_ENABLE_ARCH_or1k_TRUE@ $(AM_V_GEN)cpu=or1k32bf mach=or32,or32nd FLAGS="with-scache" EXTRAFILES="$(CGEN_CPU_SEM) $(CGEN_CPU_SEMSW)"; $(CGEN_GEN_CPU_DECODE) @SIM_ENABLE_ARCH_or1k_TRUE@$(srcdir)/or1k/cpu.h $(srcdir)/or1k/cpu.c $(srcdir)/or1k/model.c $(srcdir)/or1k/sem.c $(srcdir)/or1k/sem-switch.c $(srcdir)/or1k/decode.c $(srcdir)/or1k/decode.h: @CGEN_MAINT@ or1k/cgen-cpu-decode -@SIM_ENABLE_ARCH_ppc_TRUE@ppc/sim-endian.o: $(srcdir)/ppc/sim-endian.c ; $(SIM_COMPILE) - @SIM_ENABLE_ARCH_ppc_TRUE@ppc/%.o: common/%.c ; $(SIM_COMPILE) @SIM_ENABLE_ARCH_ppc_TRUE@-@am__include@ ppc/$(DEPDIR)/*.Po diff --git a/sim/ppc/local.mk b/sim/ppc/local.mk index 01cc125..f6da1c2 100644 --- a/sim/ppc/local.mk +++ b/sim/ppc/local.mk @@ -67,10 +67,6 @@ AM_CPPFLAGS_%C%_options.o = '-DOPCODE_RULES="$(IGEN_OPCODE_RULES)"' '-DIGEN_FLAG noinst_LIBRARIES += %D%/libsim.a -## common/sim-endian.c is matched before ppc/sim-endian.c due to the pattern -## rule below. Force the ppc version until we can unify the two properly. -%D%/sim-endian.o: $(srcdir)/%D%/sim-endian.c ; $(SIM_COMPILE) - %D%/%.o: common/%.c ; $(SIM_COMPILE) -@am__include@ %D%/$(DEPDIR)/*.Po diff --git a/sim/ppc/sim-endian-n.h b/sim/ppc/sim-endian-n.h deleted file mode 100644 index a9b2e20..0000000 --- a/sim/ppc/sim-endian-n.h +++ /dev/null @@ -1,133 +0,0 @@ -/* This file is part of the program psim. - - Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. - - */ - - -#ifndef N -#error "N must be #defined" -#endif - -/* NOTE: See end of file for #undef */ -#define unsigned_N XCONCAT2(unsigned_,N) -#define endian_t2h_N XCONCAT2(endian_t2h_,N) -#define endian_h2t_N XCONCAT2(endian_h2t_,N) -#define _SWAP_N XCONCAT2(_SWAP_,N) -#define swap_N XCONCAT2(swap_,N) -#define endian_h2be_N XCONCAT2(endian_h2be_,N) -#define endian_be2h_N XCONCAT2(endian_be2h_,N) -#define endian_h2le_N XCONCAT2(endian_h2le_,N) -#define endian_le2h_N XCONCAT2(endian_le2h_,N) - - -INLINE_PSIM_ENDIAN\ -(unsigned_N) -endian_t2h_N(unsigned_N raw_in) -{ - if (CURRENT_TARGET_BYTE_ORDER == HOST_BYTE_ORDER) { - return raw_in; - } - else { - _SWAP_N(return,raw_in); - } -} - - -INLINE_PSIM_ENDIAN\ -(unsigned_N) -endian_h2t_N(unsigned_N raw_in) -{ - if (CURRENT_TARGET_BYTE_ORDER == HOST_BYTE_ORDER) { - return raw_in; - } - else { - _SWAP_N(return,raw_in); - } -} - - -INLINE_PSIM_ENDIAN\ -(unsigned_N) -swap_N(unsigned_N raw_in) -{ - _SWAP_N(return,raw_in); -} - - - -INLINE_PSIM_ENDIAN\ -(unsigned_N) -endian_h2be_N(unsigned_N raw_in) -{ - if (HOST_BYTE_ORDER == BFD_ENDIAN_BIG) { - return raw_in; - } - else { - _SWAP_N(return,raw_in); - } -} - - -INLINE_PSIM_ENDIAN\ -(unsigned_N) -endian_be2h_N(unsigned_N raw_in) -{ - if (HOST_BYTE_ORDER == BFD_ENDIAN_BIG) { - return raw_in; - } - else { - _SWAP_N(return,raw_in); - } -} - - -INLINE_PSIM_ENDIAN\ -(unsigned_N) -endian_h2le_N(unsigned_N raw_in) -{ - if (HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE) { - return raw_in; - } - else { - _SWAP_N(return,raw_in); - } -} - - -INLINE_PSIM_ENDIAN\ -(unsigned_N) -endian_le2h_N(unsigned_N raw_in) -{ - if (HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE) { - return raw_in; - } - else { - _SWAP_N(return,raw_in); - } -} - - -/* NOTE: See start of file for #define */ -#undef unsigned_N -#undef endian_t2h_N -#undef endian_h2t_N -#undef _SWAP_N -#undef swap_N -#undef endian_h2be_N -#undef endian_be2h_N -#undef endian_h2le_N -#undef endian_le2h_N diff --git a/sim/ppc/sim-endian.c b/sim/ppc/sim-endian.c deleted file mode 100644 index ee1e083..0000000 --- a/sim/ppc/sim-endian.c +++ /dev/null @@ -1,76 +0,0 @@ -/* This file is part of the program psim. - - Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. - - */ - - -#ifndef _SIM_ENDIAN_C_ -#define _SIM_ENDIAN_C_ - -/* This must come before any other includes. */ -#include "defs.h" - -#include "basics.h" -#include "symcat.h" - - -#if !defined(_SWAP_1) -#define _SWAP_1(SET,RAW) SET (RAW) -#endif - -#if !defined(_SWAP_2) && (HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE) && defined(htons) -#define _SWAP_2(SET,RAW) SET htons (RAW) -#endif - -#ifndef _SWAP_2 -#define _SWAP_2(SET,RAW) SET (((RAW) >> 8) | ((RAW) << 8)) -#endif - -#if !defined(_SWAP_4) && (HOST_BYTE_ORDER == BFD_ENDIAN_LITTLE) && defined(htonl) -#define _SWAP_4(SET,RAW) SET htonl (RAW) -#endif - -#ifndef _SWAP_4 -#define _SWAP_4(SET,RAW) SET (((RAW) << 24) | (((RAW) & 0xff00) << 8) | (((RAW) & 0xff0000) >> 8) | ((RAW) >> 24)) -#endif - -#ifndef _SWAP_8 -#define _SWAP_8(SET,RAW) \ - union { unsigned_8 dword; unsigned_4 words[2]; } in, out; \ - in.dword = RAW; \ - _SWAP_4 (out.words[0] =, in.words[1]); \ - _SWAP_4 (out.words[1] =, in.words[0]); \ - SET out.dword; -#endif - -#define N 1 -#include "sim-endian-n.h" -#undef N - -#define N 2 -#include "sim-endian-n.h" -#undef N - -#define N 4 -#include "sim-endian-n.h" -#undef N - -#define N 8 -#include "sim-endian-n.h" -#undef N - -#endif /* _SIM_ENDIAN_C_ */ diff --git a/sim/ppc/sim-endian.h b/sim/ppc/sim-endian.h deleted file mode 100644 index e074572..0000000 --- a/sim/ppc/sim-endian.h +++ /dev/null @@ -1,225 +0,0 @@ -/* This file is part of the program psim. - - Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. - - */ - - -#ifndef _SIM_ENDIAN_H_ -#define _SIM_ENDIAN_H_ - - -/* C byte conversion functions */ - -INLINE_PSIM_ENDIAN(unsigned_1) endian_h2t_1(unsigned_1 x); -INLINE_PSIM_ENDIAN(unsigned_2) endian_h2t_2(unsigned_2 x); -INLINE_PSIM_ENDIAN(unsigned_4) endian_h2t_4(unsigned_4 x); -INLINE_PSIM_ENDIAN(unsigned_8) endian_h2t_8(unsigned_8 x); - -INLINE_PSIM_ENDIAN(unsigned_1) endian_t2h_1(unsigned_1 x); -INLINE_PSIM_ENDIAN(unsigned_2) endian_t2h_2(unsigned_2 x); -INLINE_PSIM_ENDIAN(unsigned_4) endian_t2h_4(unsigned_4 x); -INLINE_PSIM_ENDIAN(unsigned_8) endian_t2h_8(unsigned_8 x); - -INLINE_PSIM_ENDIAN(unsigned_1) swap_1(unsigned_1 x); -INLINE_PSIM_ENDIAN(unsigned_2) swap_2(unsigned_2 x); -INLINE_PSIM_ENDIAN(unsigned_4) swap_4(unsigned_4 x); -INLINE_PSIM_ENDIAN(unsigned_8) swap_8(unsigned_8 x); - -INLINE_PSIM_ENDIAN(unsigned_1) endian_h2be_1(unsigned_1 x); -INLINE_PSIM_ENDIAN(unsigned_2) endian_h2be_2(unsigned_2 x); -INLINE_PSIM_ENDIAN(unsigned_4) endian_h2be_4(unsigned_4 x); -INLINE_PSIM_ENDIAN(unsigned_8) endian_h2be_8(unsigned_8 x); - -INLINE_PSIM_ENDIAN(unsigned_1) endian_be2h_1(unsigned_1 x); -INLINE_PSIM_ENDIAN(unsigned_2) endian_be2h_2(unsigned_2 x); -INLINE_PSIM_ENDIAN(unsigned_4) endian_be2h_4(unsigned_4 x); -INLINE_PSIM_ENDIAN(unsigned_8) endian_be2h_8(unsigned_8 x); - -INLINE_PSIM_ENDIAN(unsigned_1) endian_h2le_1(unsigned_1 x); -INLINE_PSIM_ENDIAN(unsigned_2) endian_h2le_2(unsigned_2 x); -INLINE_PSIM_ENDIAN(unsigned_4) endian_h2le_4(unsigned_4 x); -INLINE_PSIM_ENDIAN(unsigned_8) endian_h2le_8(unsigned_8 x); - -INLINE_PSIM_ENDIAN(unsigned_1) endian_le2h_1(unsigned_1 x); -INLINE_PSIM_ENDIAN(unsigned_2) endian_le2h_2(unsigned_2 x); -INLINE_PSIM_ENDIAN(unsigned_4) endian_le2h_4(unsigned_4 x); -INLINE_PSIM_ENDIAN(unsigned_8) endian_le2h_8(unsigned_8 x); - - -/* SWAP */ - -#define SWAP_1 swap_1 -#define SWAP_2 swap_2 -#define SWAP_4 swap_4 -#define SWAP_8 swap_8 - - -/* HOST to BE */ - -#define H2BE_1 endian_h2be_1 -#define H2BE_2 endian_h2be_2 -#define H2BE_4 endian_h2be_4 -#define H2BE_8 endian_h2be_8 -#define BE2H_1 endian_be2h_1 -#define BE2H_2 endian_be2h_2 -#define BE2H_4 endian_be2h_4 -#define BE2H_8 endian_be2h_8 - - -/* HOST to LE */ - -#define H2LE_1 endian_h2le_1 -#define H2LE_2 endian_h2le_2 -#define H2LE_4 endian_h2le_4 -#define H2LE_8 endian_h2le_8 -#define LE2H_1 endian_le2h_1 -#define LE2H_2 endian_le2h_2 -#define LE2H_4 endian_le2h_4 -#define LE2H_8 endian_le2h_8 - - -/* HOST to TARGET */ - -#define H2T_1 endian_h2t_1 -#define H2T_2 endian_h2t_2 -#define H2T_4 endian_h2t_4 -#define H2T_8 endian_h2t_8 -#define T2H_1 endian_t2h_1 -#define T2H_2 endian_t2h_2 -#define T2H_4 endian_t2h_4 -#define T2H_8 endian_t2h_8 - - -/* CONVERT IN PLACE - - These macros, given an argument of unknown size, swap its value in - place if a host/target conversion is required. */ - -#define H2T(VARIABLE) \ -do { \ - switch (sizeof(VARIABLE)) { \ - case 1: VARIABLE = H2T_1(VARIABLE); break; \ - case 2: VARIABLE = H2T_2(VARIABLE); break; \ - case 4: VARIABLE = H2T_4(VARIABLE); break; \ - case 8: VARIABLE = H2T_8(VARIABLE); break; \ - } \ -} while (0) - -#define T2H(VARIABLE) \ -do { \ - switch (sizeof(VARIABLE)) { \ - case 1: VARIABLE = T2H_1(VARIABLE); break; \ - case 2: VARIABLE = T2H_2(VARIABLE); break; \ - case 4: VARIABLE = T2H_4(VARIABLE); break; \ - case 8: VARIABLE = T2H_8(VARIABLE); break; \ - } \ -} while (0) - -#define SWAP(VARIABLE) \ -do { \ - switch (sizeof(VARIABLE)) { \ - case 1: VARIABLE = SWAP_1(VARIABLE); break; \ - case 2: VARIABLE = SWAP_2(VARIABLE); break; \ - case 4: VARIABLE = SWAP_4(VARIABLE); break; \ - case 8: VARIABLE = SWAP_8(VARIABLE); break; \ - } \ -} while (0) - -#define H2BE(VARIABLE) \ -do { \ - switch (sizeof(VARIABLE)) { \ - case 1: VARIABLE = H2BE_1(VARIABLE); break; \ - case 2: VARIABLE = H2BE_2(VARIABLE); break; \ - case 4: VARIABLE = H2BE_4(VARIABLE); break; \ - case 8: VARIABLE = H2BE_8(VARIABLE); break; \ - } \ -} while (0) - -#define BE2H(VARIABLE) \ -do { \ - switch (sizeof(VARIABLE)) { \ - case 1: VARIABLE = BE2H_1(VARIABLE); break; \ - case 2: VARIABLE = BE2H_2(VARIABLE); break; \ - case 4: VARIABLE = BE2H_4(VARIABLE); break; \ - case 8: VARIABLE = BE2H_8(VARIABLE); break; \ - } \ -} while (0) - -#define H2LE(VARIABLE) \ -do { \ - switch (sizeof(VARIABLE)) { \ - case 1: VARIABLE = H2LE_1(VARIABLE); break; \ - case 2: VARIABLE = H2LE_2(VARIABLE); break; \ - case 4: VARIABLE = H2LE_4(VARIABLE); break; \ - case 8: VARIABLE = H2LE_8(VARIABLE); break; \ - } \ -} while (0) - -#define LE2H(VARIABLE) \ -do { \ - switch (sizeof(VARIABLE)) { \ - case 1: VARIABLE = LE2H_1(VARIABLE); break; \ - case 2: VARIABLE = LE2H_2(VARIABLE); break; \ - case 4: VARIABLE = LE2H_4(VARIABLE); break; \ - case 8: VARIABLE = LE2H_8(VARIABLE); break; \ - } \ -} while (0) - - - -/* TARGET WORD: - - Byte swap a quantity the size of the targets word */ - -#if (WITH_TARGET_WORD_BITSIZE == 64) -#define H2T_word H2T_8 -#define T2H_word T2H_8 -#define H2BE_word H2BE_8 -#define BE2H_word BE2H_8 -#define H2LE_word H2LE_8 -#define LE2H_word LE2H_8 -#define SWAP_word SWAP_8 -#endif -#if (WITH_TARGET_WORD_BITSIZE == 32) -#define H2T_word H2T_4 -#define T2H_word T2H_4 -#define H2BE_word H2BE_4 -#define BE2H_word BE2H_4 -#define H2LE_word H2LE_4 -#define LE2H_word LE2H_4 -#define SWAP_word SWAP_4 -#endif - - -/* TARGET CELL: - - Byte swap a quantity the size of the targets IEEE 1275 memory cell */ - -#define H2T_cell H2T_4 -#define T2H_cell T2H_4 -#define H2BE_cell H2BE_4 -#define BE2H_cell BE2H_4 -#define H2LE_cell H2LE_4 -#define LE2H_cell LE2H_4 -#define SWAP_cell SWAP_4 - - -#if (SIM_ENDIAN_INLINE & INCLUDE_MODULE) -# include "sim-endian.c" -#endif - -#endif /* _SIM_ENDIAN_H_ */ |