Skip to content

Commit

Permalink
Merge commit '121afa9e0c02617c2a774996512e4f85f3e93da8' into upstream…
Browse files Browse the repository at this point in the history
…-merge

* commit '121afa9e0c02617c2a774996512e4f85f3e93da8': (85 commits)
  Revert "Add ability to disable build of all targets"
  cpu_physical_memory_write_rom() needs to do TB invalidates
  qemu-char: BUGFIX, don't call FD_ISSET with negative fd
  Revert 455aa1e and c3767ed
  pc: Drop practically unused BOCHS BIOS debug ports
  add -machine mem-merge=on|off option
  Remove unused CONFIG_TCG_PASS_AREG0 and dead code
  target-mips: switch to AREG0 free mode
  target-sh4: switch to AREG0 free mode
  target-cris: Switch to AREG0 free mode
  target-cris: Avoid AREG0 for helpers
  target-microblaze: switch to AREG0 free mode
  target-arm: final conversion to AREG0 free mode
  target-arm: convert remaining helpers
  target-arm: convert void helpers
  target-unicore32: switch to AREG0 free mode
  target-m68k: avoid using cpu_single_env
  target-m68k: switch to AREG0 free mode
  target-lm32: switch to AREG0 free mode
  target-s390x: avoid cpu_single_env
  ...

Conflicts:
	configure

Signed-off-by: Marcelo Tosatti <[email protected]>
  • Loading branch information
matosatti committed Oct 11, 2012
2 parents 6b414d9 + 121afa9 commit 8ed1d27
Show file tree
Hide file tree
Showing 90 changed files with 4,025 additions and 3,917 deletions.
8 changes: 0 additions & 8 deletions Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,6 @@ obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o

tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci

# HELPER_CFLAGS is used for all the legacy code compiled with static register
# variables
user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)

# Note: this is a workaround. The real fix is to avoid compiling
# cpu_signal_handler() in user-exec.c.
%/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)

#########################################################
# Linux user emulator target

Expand Down
55 changes: 38 additions & 17 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ audio_card_list="ac97 es1370 sb16 hda"
audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
block_drv_whitelist=""
host_cc="gcc"
helper_cflags=""
libs_softmmu=""
libs_tools=""
audio_pt_int=""
Expand Down Expand Up @@ -911,7 +910,6 @@ case "$cpu" in
QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
if test "$solaris" = "no" ; then
QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
helper_cflags="-ffixed-i0"
fi
;;
sparc64)
Expand All @@ -936,7 +934,6 @@ case "$cpu" in
QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
LDFLAGS="-m32 $LDFLAGS"
cc_i386='$(CC) -m32'
helper_cflags="-fomit-frame-pointer"
host_guest_base="yes"
;;
x86_64)
Expand Down Expand Up @@ -1331,10 +1328,15 @@ if ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_
exit 1
fi

if test "$target_list" = "DEFAULT" ; then
target_list=`echo "$default_target_list" | sed -e 's/,/ /g'`
if test -z "$target_list" ; then
target_list="$default_target_list"
else
target_list=`echo "$target_list" | sed -e 's/,/ /g'`
fi
if test -z "$target_list" ; then
echo "No targets enabled"
exit 1
fi

# see if system emulation was really requested
case " $target_list " in
*"-softmmu "*) softmmu=yes
Expand Down Expand Up @@ -2679,18 +2681,45 @@ EOF
fi


##########################################
# Do we need libm
cat > $TMPC << EOF
#include <math.h>
int main(void) { return isnan(sin(0.0)); }
EOF
if compile_prog "" "" ; then
:
elif compile_prog "" "-lm" ; then
LIBS="-lm $LIBS"
libs_qga="-lm $libs_qga"
else
echo
echo "Error: libm check failed"
echo
exit 1
fi

##########################################
# Do we need librt
# uClibc provides 2 versions of clock_gettime(), one with realtime
# support and one without. This means that the clock_gettime() don't
# need -lrt. We still need it for timer_create() so we check for this
# function in addition.
cat > $TMPC <<EOF
#include <signal.h>
#include <time.h>
int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
int main(void) {
timer_create(CLOCK_REALTIME, NULL, NULL);
return clock_gettime(CLOCK_REALTIME, NULL);
}
EOF

if compile_prog "" "" ; then
:
elif compile_prog "" "-lrt" ; then
# we need pthread for static linking. use previous pthread test result
elif compile_prog "" "-lrt $pthread_lib" ; then
LIBS="-lrt $LIBS"
libs_qga="-lrt $libs_qga"
fi

if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Expand Down Expand Up @@ -2767,7 +2796,7 @@ fi

# check for usbredirparser for usb network redirection support
if test "$usb_redir" != "no" ; then
if $pkg_config --atleast-version=0.3.4 libusbredirparser >/dev/null 2>&1 ; then
if $pkg_config --atleast-version=0.5 libusbredirparser >/dev/null 2>&1 ; then
usb_redir="yes"
usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
Expand Down Expand Up @@ -3599,7 +3628,6 @@ if test "$sparse" = "yes" ; then
echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
fi
echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
Expand Down Expand Up @@ -3854,13 +3882,6 @@ fi

symlink "$source_path/Makefile.target" "$target_dir/Makefile"


case "$target_arch2" in
alpha | i386 | or32 | s390x | sparc* | x86_64 | xtensa* | ppc*)
echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
;;
esac

upper() {
echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
}
Expand Down
11 changes: 0 additions & 11 deletions cpu-all.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,6 @@ extern unsigned long reserved_va;
#define stfl(p, v) stfl_raw(p, v)
#define stfq(p, v) stfq_raw(p, v)

#ifndef CONFIG_TCG_PASS_AREG0
#define ldub_code(p) ldub_raw(p)
#define ldsb_code(p) ldsb_raw(p)
#define lduw_code(p) lduw_raw(p)
#define ldsw_code(p) ldsw_raw(p)
#define ldl_code(p) ldl_raw(p)
#define ldq_code(p) ldq_raw(p)
#else
#define cpu_ldub_code(env1, p) ldub_raw(p)
#define cpu_ldsb_code(env1, p) ldsb_raw(p)
#define cpu_lduw_code(env1, p) lduw_raw(p)
Expand Down Expand Up @@ -296,7 +288,6 @@ extern unsigned long reserved_va;
#define cpu_stw_kernel(env, addr, data) stw_raw(addr, data)
#define cpu_stl_kernel(env, addr, data) stl_raw(addr, data)
#define cpu_stq_kernel(env, addr, data) stq_raw(addr, data)
#endif

#define ldub_kernel(p) ldub_raw(p)
#define ldsb_kernel(p) ldsb_raw(p)
Expand All @@ -313,15 +304,13 @@ extern unsigned long reserved_va;
#define stfl_kernel(p, v) stfl_raw(p, v)
#define stfq_kernel(p, vt) stfq_raw(p, v)

#ifdef CONFIG_TCG_PASS_AREG0
#define cpu_ldub_data(env, addr) ldub_raw(addr)
#define cpu_lduw_data(env, addr) lduw_raw(addr)
#define cpu_ldl_data(env, addr) ldl_raw(addr)

#define cpu_stb_data(env, addr, data) stb_raw(addr, data)
#define cpu_stw_data(env, addr, data) stw_raw(addr, data)
#define cpu_stl_data(env, addr, data) stl_raw(addr, data)
#endif
#endif /* defined(CONFIG_USER_ONLY) */

/* page related stuff */
Expand Down
5 changes: 0 additions & 5 deletions cputlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr)
mmu_idx = cpu_mmu_index(env1);
if (unlikely(env1->tlb_table[mmu_idx][page_index].addr_code !=
(addr & TARGET_PAGE_MASK))) {
#ifdef CONFIG_TCG_PASS_AREG0
cpu_ldub_code(env1, addr);
#else
ldub_code(addr);
#endif
}
pd = env1->iotlb[mmu_idx][page_index] & ~TARGET_PAGE_MASK;
mr = iotlb_to_region(pd);
Expand All @@ -348,7 +344,6 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr)
#define MMUSUFFIX _cmmu
#undef GETPC
#define GETPC() ((uintptr_t)0)
#define env cpu_single_env
#define SOFTMMU_CODE_ACCESS

#define SHIFT 0
Expand Down
2 changes: 2 additions & 0 deletions def-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@
#define DEF_HELPER_5(name, ret, t1, t2, t3, t4, t5) \
DEF_HELPER_FLAGS_5(name, 0, ret, t1, t2, t3, t4, t5)

/* MAX_OPC_PARAM_IARGS must be set to n if last entry is DEF_HELPER_FLAGS_n. */

#endif /* DEF_HELPER_H */

#ifndef GEN_HELPER
Expand Down
70 changes: 0 additions & 70 deletions dyngen-exec.h

This file was deleted.

6 changes: 1 addition & 5 deletions exec-all.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ typedef struct TranslationBlock TranslationBlock;
#else
#define MAX_OPC_PARAM_PER_ARG 1
#endif
#define MAX_OPC_PARAM_IARGS 4
#define MAX_OPC_PARAM_IARGS 5
#define MAX_OPC_PARAM_OARGS 1
#define MAX_OPC_PARAM_ARGS (MAX_OPC_PARAM_IARGS + MAX_OPC_PARAM_OARGS)

Expand Down Expand Up @@ -323,9 +323,6 @@ void tlb_fill(CPUArchState *env1, target_ulong addr, int is_write, int mmu_idx,

#define ACCESS_TYPE (NB_MMU_MODES + 1)
#define MEMSUFFIX _code
#ifndef CONFIG_TCG_PASS_AREG0
#define env cpu_single_env
#endif

#define DATA_SIZE 1
#include "softmmu_header.h"
Expand All @@ -341,7 +338,6 @@ void tlb_fill(CPUArchState *env1, target_ulong addr, int is_write, int mmu_idx,

#undef ACCESS_TYPE
#undef MEMSUFFIX
#undef env

#endif

Expand Down
26 changes: 23 additions & 3 deletions exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2525,6 +2525,19 @@ void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
}
}

static int memory_try_enable_merging(void *addr, size_t len)
{
QemuOpts *opts;

opts = qemu_opts_find(qemu_find_opts("machine"), 0);
if (opts && !qemu_opt_get_bool(opts, "mem-merge", true)) {
/* disabled by the user */
return 0;
}

return qemu_madvise(addr, len, QEMU_MADV_MERGEABLE);
}

ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
MemoryRegion *mr)
{
Expand All @@ -2544,7 +2557,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
new_block->host = file_ram_alloc(new_block, size, mem_path);
if (!new_block->host) {
new_block->host = qemu_vmalloc(size);
qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE);
memory_try_enable_merging(new_block->host, size);
}
#else
fprintf(stderr, "-mem-path option unsupported\n");
Expand All @@ -2559,7 +2572,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
} else {
new_block->host = qemu_vmalloc(size);
}
qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE);
memory_try_enable_merging(new_block->host, size);
}
}
new_block->length = size;
Expand Down Expand Up @@ -2689,7 +2702,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
length, addr);
exit(1);
}
qemu_madvise(vaddr, length, QEMU_MADV_MERGEABLE);
memory_try_enable_merging(vaddr, length);
qemu_ram_setup_dump(vaddr, length);
}
return;
Expand Down Expand Up @@ -3523,6 +3536,13 @@ void cpu_physical_memory_write_rom(target_phys_addr_t addr,
/* ROM/RAM case */
ptr = qemu_get_ram_ptr(addr1);
memcpy(ptr, buf, l);
if (!cpu_physical_memory_is_dirty(addr1)) {
/* invalidate code */
tb_invalidate_phys_page_range(addr1, addr1 + l, 0);
/* set dirty bit */
cpu_physical_memory_set_dirty_flags(
addr1, (0xff & ~CODE_DIRTY_FLAG));
}
qemu_put_ram_ptr(ptr);
}
len -= l;
Expand Down
Loading

0 comments on commit 8ed1d27

Please sign in to comment.