qemu/target/xtensa/import_core.sh
Philippe Mathieu-Daudé 23c11b04dc target: Do not include "exec/exec-all.h" if it is not necessary
Code change produced with:
    $ git grep '#include "exec/exec-all.h"' | \
      cut -d: -f-1 | \
      xargs egrep -L "(cpu_address_space_init|cpu_loop_|tlb_|tb_|GETPC|singlestep|TranslationBlock)" | \
      xargs sed -i.bak '/#include "exec\/exec-all.h"/d'

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180528232719.4721-10-f4bug@amsat.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-06-01 14:15:10 +02:00

69 lines
2.0 KiB
Bash
Executable File

#! /bin/bash -e
OVERLAY="$1"
NAME="$2"
FREQ=40000
BASE=$(dirname "$0")
TARGET="$BASE"/core-$NAME
[ $# -ge 2 -a -f "$OVERLAY" ] || { cat <<EOF
Usage: $0 overlay-archive-to-import core-name [frequency-in-KHz]
overlay-archive-to-import: file name of xtensa-config-overlay.tar.gz
to import configuration from.
core-name: QEMU name of the imported core. Must be valid
C identifier.
frequency-in-KHz: core frequency (40MHz if not specified).
EOF
exit
}
[ $# -ge 3 ] && FREQ="$3"
mkdir -p "$TARGET"
tar -xf "$OVERLAY" -C "$TARGET" --strip-components=1 \
--xform='s/core/core-isa/' config/core.h
tar -xf "$OVERLAY" -O gdb/xtensa-config.c | \
sed -n '1,/*\//p;/XTREG/,/XTREG_END/p' > "$TARGET"/gdb-config.inc.c
#
# Fix up known issues in the xtensa-modules.c
#
tar -xf "$OVERLAY" -O binutils/xtensa-modules.c | \
sed -e 's/\(xtensa_opcode_encode_fn.*\[\] =\)/static \1/' \
-e '/^int num_bypass_groups()/,/}/d' \
-e '/^int num_bypass_group_chunks()/,/}/d' \
-e '/^uint32 \*bypass_entry(int i)/,/}/d' \
-e '/^#include "ansidecl.h"/d' \
-e '/^Slot_[a-zA-Z0-9_]\+_decode (const xtensa_insnbuf insn)/,/^}/s/^ return 0;$/ return XTENSA_UNDEFINED;/' \
-e 's/#include <xtensa-isa.h>/#include "xtensa-isa.h"/' \
> "$TARGET"/xtensa-modules.inc.c
cat <<EOF > "${TARGET}.c"
#include "qemu/osdep.h"
#include "cpu.h"
#include "exec/gdbstub.h"
#include "qemu-common.h"
#include "qemu/host-utils.h"
#include "core-$NAME/core-isa.h"
#include "overlay_tool.h"
#define xtensa_modules xtensa_modules_$NAME
#include "core-$NAME/xtensa-modules.inc.c"
static XtensaConfig $NAME __attribute__((unused)) = {
.name = "$NAME",
.gdb_regmap = {
.reg = {
#include "core-$NAME/gdb-config.inc.c"
}
},
.isa_internal = &xtensa_modules,
.clock_freq_khz = $FREQ,
DEFAULT_SECTIONS
};
REGISTER_CORE($NAME)
EOF
grep -q core-${NAME}.o "$BASE"/Makefile.objs || \
echo "obj-y += core-${NAME}.o" >> "$BASE"/Makefile.objs