Merge remote-tracking branch 'mjt/trivial-patches' into staging

* mjt/trivial-patches:
  acpi unit-test: Remove temporary disk after test
  mainstone: Fix duplicate array values for key 'space'
  pxa27x: Add 'const' attribute to keyboard maps
  pxa27x: Reduce size of keyboard matrix mapping
  doc: Mention chardev:id in available devices for -serial
  configure: Python tests must be done before help message
  configure: Rewrite code for help message
  fix -boot strict regressed in commit 6ef4716
  vl: make boot_strict variable static (not used outside vl.c)
  x86: only allow real mode to access 32bit without LMA
  linux-user: Use macro TARGET_NSIG_WORDS where possible
  exynos4210: Use macro ARRAY_SIZE where possible
  ui/cocoa: Use macro ARRAY_SIZE where possible
  misc: Use macro ARRAY_SIZE where possible
  openrisc: Fix spelling in comment (transaltion -> translation)
  hw/arm/highbank: Simplify code (memory region in device state)

Message-id: 1388182050-10270-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
This commit is contained in:
Anthony Liguori 2014-01-09 11:24:12 -08:00
commit 666eb032d3
18 changed files with 233 additions and 218 deletions

362
configure vendored
View File

@ -1004,6 +1004,25 @@ for opt do
esac esac
done done
if ! has $python; then
error_exit "Python not found. Use --python=/path/to/python"
fi
# Note that if the Python conditional here evaluates True we will exit
# with status 1 which is a shell 'false' value.
if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
error_exit "Cannot use '$python', Python 2.4 or later is required." \
"Note that Python 3 or later is not yet supported." \
"Use --python=/path/to/python to specify a supported Python."
fi
# The -B switch was added in Python 2.6.
# If it is supplied, compiled files are not written.
# Use it for Python versions which support it.
if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
python="$python -B"
fi
case "$cpu" in case "$cpu" in
ppc) ppc)
CPU_CFLAGS="-m32" CPU_CFLAGS="-m32"
@ -1074,169 +1093,169 @@ cat << EOF
Usage: configure [options] Usage: configure [options]
Options: [defaults in brackets after descriptions] Options: [defaults in brackets after descriptions]
Standard options:
--help print this message
--prefix=PREFIX install in PREFIX [$prefix]
--interp-prefix=PREFIX where to find shared libraries, etc.
use %M for cpu name [$interp_prefix]
--target-list=LIST set target list (default: build everything)
$(echo Available targets: $default_target_list | \
fold -s -w 53 | sed -e 's/^/ /')
Advanced options (experts only):
--source-path=PATH path of source code [$source_path]
--cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
--cc=CC use C compiler CC [$cc]
--iasl=IASL use ACPI compiler IASL [$iasl]
--host-cc=CC use C compiler CC [$host_cc] for code run at
build time
--cxx=CXX use C++ compiler CXX [$cxx]
--objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
--extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
--extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
--make=MAKE use specified make [$make]
--install=INSTALL use specified install [$install]
--python=PYTHON use specified python [$python]
--smbd=SMBD use specified smbd [$smbd]
--static enable static build [$static]
--mandir=PATH install man pages in PATH
--datadir=PATH install firmware in PATH$confsuffix
--docdir=PATH install documentation in PATH$confsuffix
--bindir=PATH install binaries in PATH
--libdir=PATH install libraries in PATH
--sysconfdir=PATH install config in PATH$confsuffix
--localstatedir=PATH install local state in PATH (set at runtime on win32)
--with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]
--enable-debug-tcg enable TCG debugging
--disable-debug-tcg disable TCG debugging (default)
--enable-debug-info enable debugging information (default)
--disable-debug-info disable debugging information
--enable-debug enable common debug build options
--enable-sparse enable sparse checker
--disable-sparse disable sparse checker (default)
--disable-strip disable stripping binaries
--disable-werror disable compilation abort on warning
--disable-sdl disable SDL
--enable-sdl enable SDL
--disable-gtk disable gtk UI
--enable-gtk enable gtk UI
--disable-virtfs disable VirtFS
--enable-virtfs enable VirtFS
--disable-vnc disable VNC
--enable-vnc enable VNC
--disable-cocoa disable Cocoa (Mac OS X only)
--enable-cocoa enable Cocoa (default on Mac OS X)
--audio-drv-list=LIST set audio drivers list:
Available drivers: $audio_possible_drivers
--block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
--block-drv-rw-whitelist=L
set block driver read-write whitelist
(affects only QEMU, not qemu-img)
--block-drv-ro-whitelist=L
set block driver read-only whitelist
(affects only QEMU, not qemu-img)
--disable-xen disable xen backend driver support
--enable-xen enable xen backend driver support
--disable-xen-pci-passthrough
--enable-xen-pci-passthrough
--disable-brlapi disable BrlAPI
--enable-brlapi enable BrlAPI
--disable-vnc-tls disable TLS encryption for VNC server
--enable-vnc-tls enable TLS encryption for VNC server
--disable-vnc-sasl disable SASL encryption for VNC server
--enable-vnc-sasl enable SASL encryption for VNC server
--disable-vnc-jpeg disable JPEG lossy compression for VNC server
--enable-vnc-jpeg enable JPEG lossy compression for VNC server
--disable-vnc-png disable PNG compression for VNC server (default)
--enable-vnc-png enable PNG compression for VNC server
--disable-vnc-ws disable Websockets support for VNC server
--enable-vnc-ws enable Websockets support for VNC server
--disable-curses disable curses output
--enable-curses enable curses output
--disable-curl disable curl connectivity
--enable-curl enable curl connectivity
--disable-fdt disable fdt device tree
--enable-fdt enable fdt device tree
--disable-bluez disable bluez stack connectivity
--enable-bluez enable bluez stack connectivity
--disable-slirp disable SLIRP userspace network connectivity
--disable-kvm disable KVM acceleration support
--enable-kvm enable KVM acceleration support
--disable-rdma disable RDMA-based migration support
--enable-rdma enable RDMA-based migration support
--enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
--enable-system enable all system emulation targets
--disable-system disable all system emulation targets
--enable-user enable supported user emulation targets
--disable-user disable all user emulation targets
--enable-linux-user enable all linux usermode emulation targets
--disable-linux-user disable all linux usermode emulation targets
--enable-bsd-user enable all BSD usermode emulation targets
--disable-bsd-user disable all BSD usermode emulation targets
--enable-guest-base enable GUEST_BASE support for usermode
emulation targets
--disable-guest-base disable GUEST_BASE support
--enable-pie build Position Independent Executables
--disable-pie do not build Position Independent Executables
--fmod-lib path to FMOD library
--fmod-inc path to FMOD includes
--oss-lib path to OSS library
--enable-uname-release=R Return R for uname -r in usermode emulation
--cpu=CPU Build for host CPU [$cpu]
--disable-uuid disable uuid support
--enable-uuid enable uuid support
--disable-vde disable support for vde network
--enable-vde enable support for vde network
--disable-netmap disable support for netmap network
--enable-netmap enable support for netmap network
--disable-linux-aio disable Linux AIO support
--enable-linux-aio enable Linux AIO support
--disable-cap-ng disable libcap-ng support
--enable-cap-ng enable libcap-ng support
--disable-attr disables attr and xattr support
--enable-attr enable attr and xattr support
--disable-blobs disable installing provided firmware blobs
--enable-docs enable documentation build
--disable-docs disable documentation build
--disable-vhost-net disable vhost-net acceleration support
--enable-vhost-net enable vhost-net acceleration support
--enable-trace-backend=B Set trace backend
Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
--with-trace-file=NAME Full PATH,NAME of file to store traces
Default:trace-<pid>
--disable-spice disable spice
--enable-spice enable spice
--enable-rbd enable building the rados block device (rbd)
--disable-libiscsi disable iscsi support
--enable-libiscsi enable iscsi support
--disable-smartcard-nss disable smartcard nss support
--enable-smartcard-nss enable smartcard nss support
--disable-libusb disable libusb (for usb passthrough)
--enable-libusb enable libusb (for usb passthrough)
--disable-usb-redir disable usb network redirection support
--enable-usb-redir enable usb network redirection support
--disable-guest-agent disable building of the QEMU Guest Agent
--enable-guest-agent enable building of the QEMU Guest Agent
--with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
--with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
--disable-seccomp disable seccomp support
--enable-seccomp enables seccomp support
--with-coroutine=BACKEND coroutine backend. Supported options:
gthread, ucontext, sigaltstack, windows
--disable-coroutine-pool disable coroutine freelist (worse performance)
--enable-coroutine-pool enable coroutine freelist (better performance)
--enable-glusterfs enable GlusterFS backend
--disable-glusterfs disable GlusterFS backend
--enable-gcov enable test coverage analysis with gcov
--gcov=GCOV use specified gcov [$gcov_tool]
--enable-tpm enable TPM support
--disable-libssh2 disable ssh block device support
--enable-libssh2 enable ssh block device support
--disable-vhdx disables support for the Microsoft VHDX image format
--enable-vhdx enable support for the Microsoft VHDX image format
NOTE: The object files are built at the place where configure is launched
EOF EOF
echo "Standard options:"
echo " --help print this message"
echo " --prefix=PREFIX install in PREFIX [$prefix]"
echo " --interp-prefix=PREFIX where to find shared libraries, etc."
echo " use %M for cpu name [$interp_prefix]"
echo " --target-list=LIST set target list (default: build everything)"
echo "Available targets: $default_target_list" | \
fold -s -w 53 | sed -e 's/^/ /'
echo ""
echo "Advanced options (experts only):"
echo " --source-path=PATH path of source code [$source_path]"
echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
echo " --cc=CC use C compiler CC [$cc]"
echo " --iasl=IASL use ACPI compiler IASL [$iasl]"
echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
echo " build time"
echo " --cxx=CXX use C++ compiler CXX [$cxx]"
echo " --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]"
echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
echo " --make=MAKE use specified make [$make]"
echo " --install=INSTALL use specified install [$install]"
echo " --python=PYTHON use specified python [$python]"
echo " --smbd=SMBD use specified smbd [$smbd]"
echo " --static enable static build [$static]"
echo " --mandir=PATH install man pages in PATH"
echo " --datadir=PATH install firmware in PATH$confsuffix"
echo " --docdir=PATH install documentation in PATH$confsuffix"
echo " --bindir=PATH install binaries in PATH"
echo " --libdir=PATH install libraries in PATH"
echo " --sysconfdir=PATH install config in PATH$confsuffix"
echo " --localstatedir=PATH install local state in PATH (set at runtime on win32)"
echo " --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
echo " --enable-debug-tcg enable TCG debugging"
echo " --disable-debug-tcg disable TCG debugging (default)"
echo " --enable-debug-info enable debugging information (default)"
echo " --disable-debug-info disable debugging information"
echo " --enable-debug enable common debug build options"
echo " --enable-sparse enable sparse checker"
echo " --disable-sparse disable sparse checker (default)"
echo " --disable-strip disable stripping binaries"
echo " --disable-werror disable compilation abort on warning"
echo " --disable-sdl disable SDL"
echo " --enable-sdl enable SDL"
echo " --disable-gtk disable gtk UI"
echo " --enable-gtk enable gtk UI"
echo " --disable-virtfs disable VirtFS"
echo " --enable-virtfs enable VirtFS"
echo " --disable-vnc disable VNC"
echo " --enable-vnc enable VNC"
echo " --disable-cocoa disable Cocoa (Mac OS X only)"
echo " --enable-cocoa enable Cocoa (default on Mac OS X)"
echo " --audio-drv-list=LIST set audio drivers list:"
echo " Available drivers: $audio_possible_drivers"
echo " --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L"
echo " --block-drv-rw-whitelist=L"
echo " set block driver read-write whitelist"
echo " (affects only QEMU, not qemu-img)"
echo " --block-drv-ro-whitelist=L"
echo " set block driver read-only whitelist"
echo " (affects only QEMU, not qemu-img)"
echo " --disable-xen disable xen backend driver support"
echo " --enable-xen enable xen backend driver support"
echo " --disable-xen-pci-passthrough"
echo " --enable-xen-pci-passthrough"
echo " --disable-brlapi disable BrlAPI"
echo " --enable-brlapi enable BrlAPI"
echo " --disable-vnc-tls disable TLS encryption for VNC server"
echo " --enable-vnc-tls enable TLS encryption for VNC server"
echo " --disable-vnc-sasl disable SASL encryption for VNC server"
echo " --enable-vnc-sasl enable SASL encryption for VNC server"
echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
echo " --disable-vnc-png disable PNG compression for VNC server (default)"
echo " --enable-vnc-png enable PNG compression for VNC server"
echo " --disable-vnc-ws disable Websockets support for VNC server"
echo " --enable-vnc-ws enable Websockets support for VNC server"
echo " --disable-curses disable curses output"
echo " --enable-curses enable curses output"
echo " --disable-curl disable curl connectivity"
echo " --enable-curl enable curl connectivity"
echo " --disable-fdt disable fdt device tree"
echo " --enable-fdt enable fdt device tree"
echo " --disable-bluez disable bluez stack connectivity"
echo " --enable-bluez enable bluez stack connectivity"
echo " --disable-slirp disable SLIRP userspace network connectivity"
echo " --disable-kvm disable KVM acceleration support"
echo " --enable-kvm enable KVM acceleration support"
echo " --disable-rdma disable RDMA-based migration support"
echo " --enable-rdma enable RDMA-based migration support"
echo " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
echo " --enable-system enable all system emulation targets"
echo " --disable-system disable all system emulation targets"
echo " --enable-user enable supported user emulation targets"
echo " --disable-user disable all user emulation targets"
echo " --enable-linux-user enable all linux usermode emulation targets"
echo " --disable-linux-user disable all linux usermode emulation targets"
echo " --enable-bsd-user enable all BSD usermode emulation targets"
echo " --disable-bsd-user disable all BSD usermode emulation targets"
echo " --enable-guest-base enable GUEST_BASE support for usermode"
echo " emulation targets"
echo " --disable-guest-base disable GUEST_BASE support"
echo " --enable-pie build Position Independent Executables"
echo " --disable-pie do not build Position Independent Executables"
echo " --fmod-lib path to FMOD library"
echo " --fmod-inc path to FMOD includes"
echo " --oss-lib path to OSS library"
echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
echo " --cpu=CPU Build for host CPU [$cpu]"
echo " --disable-uuid disable uuid support"
echo " --enable-uuid enable uuid support"
echo " --disable-vde disable support for vde network"
echo " --enable-vde enable support for vde network"
echo " --disable-netmap disable support for netmap network"
echo " --enable-netmap enable support for netmap network"
echo " --disable-linux-aio disable Linux AIO support"
echo " --enable-linux-aio enable Linux AIO support"
echo " --disable-cap-ng disable libcap-ng support"
echo " --enable-cap-ng enable libcap-ng support"
echo " --disable-attr disables attr and xattr support"
echo " --enable-attr enable attr and xattr support"
echo " --disable-blobs disable installing provided firmware blobs"
echo " --enable-docs enable documentation build"
echo " --disable-docs disable documentation build"
echo " --disable-vhost-net disable vhost-net acceleration support"
echo " --enable-vhost-net enable vhost-net acceleration support"
echo " --enable-trace-backend=B Set trace backend"
echo " Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
echo " Default:trace-<pid>"
echo " --disable-spice disable spice"
echo " --enable-spice enable spice"
echo " --enable-rbd enable building the rados block device (rbd)"
echo " --disable-libiscsi disable iscsi support"
echo " --enable-libiscsi enable iscsi support"
echo " --disable-smartcard-nss disable smartcard nss support"
echo " --enable-smartcard-nss enable smartcard nss support"
echo " --disable-libusb disable libusb (for usb passthrough)"
echo " --enable-libusb enable libusb (for usb passthrough)"
echo " --disable-usb-redir disable usb network redirection support"
echo " --enable-usb-redir enable usb network redirection support"
echo " --disable-guest-agent disable building of the QEMU Guest Agent"
echo " --enable-guest-agent enable building of the QEMU Guest Agent"
echo " --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent"
echo " --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)"
echo " --disable-seccomp disable seccomp support"
echo " --enable-seccomp enables seccomp support"
echo " --with-coroutine=BACKEND coroutine backend. Supported options:"
echo " gthread, ucontext, sigaltstack, windows"
echo " --disable-coroutine-pool disable coroutine freelist (worse performance)"
echo " --enable-coroutine-pool enable coroutine freelist (better performance)"
echo " --enable-glusterfs enable GlusterFS backend"
echo " --disable-glusterfs disable GlusterFS backend"
echo " --enable-gcov enable test coverage analysis with gcov"
echo " --gcov=GCOV use specified gcov [$gcov_tool]"
echo " --enable-tpm enable TPM support"
echo " --disable-libssh2 disable ssh block device support"
echo " --enable-libssh2 enable ssh block device support"
echo " --disable-vhdx disables support for the Microsoft VHDX image format"
echo " --enable-vhdx enable support for the Microsoft VHDX image format"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1 exit 1
fi fi
@ -1419,25 +1438,6 @@ if test "$solaris" = "yes" ; then
fi fi
fi fi
if ! has $python; then
error_exit "Python not found. Use --python=/path/to/python"
fi
# Note that if the Python conditional here evaluates True we will exit
# with status 1 which is a shell 'false' value.
if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
error_exit "Cannot use '$python', Python 2.4 or later is required." \
"Note that Python 3 or later is not yet supported." \
"Use --python=/path/to/python to specify a supported Python."
fi
# The -B switch was added in Python 2.6.
# If it is supplied, compiled files are not written.
# Use it for Python versions which support it.
if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
python="$python -B"
fi
if test -z "${target_list+xxx}" ; then if test -z "${target_list+xxx}" ; then
target_list="$default_target_list" target_list="$default_target_list"
else else

View File

@ -126,7 +126,7 @@ typedef struct {
SysBusDevice parent_obj; SysBusDevice parent_obj;
/*< public >*/ /*< public >*/
MemoryRegion *iomem; MemoryRegion iomem;
uint32_t regs[NUM_REGS]; uint32_t regs[NUM_REGS];
} HighbankRegsState; } HighbankRegsState;
@ -155,10 +155,9 @@ static int highbank_regs_init(SysBusDevice *dev)
{ {
HighbankRegsState *s = HIGHBANK_REGISTERS(dev); HighbankRegsState *s = HIGHBANK_REGISTERS(dev);
s->iomem = g_new(MemoryRegion, 1); memory_region_init_io(&s->iomem, OBJECT(s), &hb_mem_ops, s->regs,
memory_region_init_io(s->iomem, OBJECT(s), &hb_mem_ops, s->regs,
"highbank_regs", 0x1000); "highbank_regs", 0x1000);
sysbus_init_mmio(dev, s->iomem); sysbus_init_mmio(dev, &s->iomem);
return 0; return 0;
} }

View File

@ -45,7 +45,7 @@
#define S1_STSCHG_IRQ 14 #define S1_STSCHG_IRQ 14
#define S1_IRQ 15 #define S1_IRQ 15
static struct keymap map[0xE0] = { static const struct keymap map[0xE0] = {
[0 ... 0xDF] = { -1, -1 }, [0 ... 0xDF] = { -1, -1 },
[0x1e] = {0,0}, /* a */ [0x1e] = {0,0}, /* a */
[0x30] = {0,1}, /* b */ [0x30] = {0,1}, /* b */
@ -75,9 +75,18 @@ static struct keymap map[0xE0] = {
[0x2c] = {4,3}, /* z */ [0x2c] = {4,3}, /* z */
[0xc7] = {5,0}, /* Home */ [0xc7] = {5,0}, /* Home */
[0x2a] = {5,1}, /* shift */ [0x2a] = {5,1}, /* shift */
[0x39] = {5,2}, /* space */ /*
* There are two matrix positions which map to space,
* but QEMU can only use one of them for the reverse
* mapping, so simply use the second one.
*/
/* [0x39] = {5,2}, space */
[0x39] = {5,3}, /* space */ [0x39] = {5,3}, /* space */
[0x1c] = {5,5}, /* enter */ /*
* Matrix position {5,4} and other keys are missing here.
* TODO: Compare with Linux code and test real hardware.
*/
[0x1c] = {5,5}, /* enter (TODO: might be wrong) */
[0xc8] = {6,0}, /* up */ [0xc8] = {6,0}, /* up */
[0xd0] = {6,1}, /* down */ [0xd0] = {6,1}, /* down */
[0xcb] = {6,2}, /* left */ [0xcb] = {6,2}, /* left */

View File

@ -33,7 +33,7 @@
#define DPRINTF(fmt, ...) #define DPRINTF(fmt, ...)
#endif #endif
static struct keymap map[0x100] = { static const struct keymap map[0x100] = {
[0 ... 0xff] = { -1, -1 }, [0 ... 0xff] = { -1, -1 },
[0x3b] = {0, 0}, /* Option = F1 */ [0x3b] = {0, 0}, /* Option = F1 */
[0xc8] = {0, 1}, /* Up */ [0xc8] = {0, 1}, /* Up */

View File

@ -900,7 +900,7 @@ static const IntelHDAReg *intel_hda_reg_find(IntelHDAState *d, hwaddr addr)
{ {
const IntelHDAReg *reg; const IntelHDAReg *reg;
if (addr >= sizeof(regtab)/sizeof(regtab[0])) { if (addr >= ARRAY_SIZE(regtab)) {
goto noreg; goto noreg;
} }
reg = regtab+addr; reg = regtab+addr;
@ -1025,7 +1025,7 @@ static void intel_hda_regs_reset(IntelHDAState *d)
uint32_t *addr; uint32_t *addr;
int i; int i;
for (i = 0; i < sizeof(regtab)/sizeof(regtab[0]); i++) { for (i = 0; i < ARRAY_SIZE(regtab); i++) {
if (regtab[i].name == NULL) { if (regtab[i].name == NULL) {
continue; continue;
} }

View File

@ -192,10 +192,9 @@ typedef struct Exynos4210UartState {
static const char *exynos4210_uart_regname(hwaddr offset) static const char *exynos4210_uart_regname(hwaddr offset)
{ {
int regs_number = sizeof(exynos4210_uart_regs) / sizeof(Exynos4210UartReg);
int i; int i;
for (i = 0; i < regs_number; i++) { for (i = 0; i < ARRAY_SIZE(exynos4210_uart_regs); i++) {
if (offset == exynos4210_uart_regs[i].offset) { if (offset == exynos4210_uart_regs[i].offset) {
return exynos4210_uart_regs[i].name; return exynos4210_uart_regs[i].name;
} }
@ -544,10 +543,9 @@ static void exynos4210_uart_event(void *opaque, int event)
static void exynos4210_uart_reset(DeviceState *dev) static void exynos4210_uart_reset(DeviceState *dev)
{ {
Exynos4210UartState *s = EXYNOS4210_UART(dev); Exynos4210UartState *s = EXYNOS4210_UART(dev);
int regs_number = sizeof(exynos4210_uart_regs)/sizeof(Exynos4210UartReg);
int i; int i;
for (i = 0; i < regs_number; i++) { for (i = 0; i < ARRAY_SIZE(exynos4210_uart_regs); i++) {
s->reg[I_(exynos4210_uart_regs[i].offset)] = s->reg[I_(exynos4210_uart_regs[i].offset)] =
exynos4210_uart_regs[i].reset_value; exynos4210_uart_regs[i].reset_value;
} }

View File

@ -85,7 +85,7 @@
struct PXA2xxKeyPadState { struct PXA2xxKeyPadState {
MemoryRegion iomem; MemoryRegion iomem;
qemu_irq irq; qemu_irq irq;
struct keymap *map; const struct keymap *map;
int pressed_cnt; int pressed_cnt;
int alt_code; int alt_code;
@ -322,8 +322,8 @@ PXA2xxKeyPadState *pxa27x_keypad_init(MemoryRegion *sysmem,
return s; return s;
} }
void pxa27x_register_keypad(PXA2xxKeyPadState *kp, struct keymap *map, void pxa27x_register_keypad(PXA2xxKeyPadState *kp,
int size) const struct keymap *map, int size)
{ {
if(!map || size < 0x80) { if(!map || size < 0x80) {
fprintf(stderr, "%s - No PXA keypad map defined\n", __FUNCTION__); fprintf(stderr, "%s - No PXA keypad map defined\n", __FUNCTION__);

View File

@ -383,8 +383,7 @@ static const Exynos4210PmuReg exynos4210_pmu_regs[] = {
{"GPS_ALIVE_OPTION", GPS_ALIVE_OPTION, 0x00000001}, {"GPS_ALIVE_OPTION", GPS_ALIVE_OPTION, 0x00000001},
}; };
#define PMU_NUM_OF_REGISTERS \ #define PMU_NUM_OF_REGISTERS ARRAY_SIZE(exynos4210_pmu_regs)
(sizeof(exynos4210_pmu_regs) / sizeof(Exynos4210PmuReg))
#define TYPE_EXYNOS4210_PMU "exynos4210.pmu" #define TYPE_EXYNOS4210_PMU "exynos4210.pmu"
#define EXYNOS4210_PMU(obj) \ #define EXYNOS4210_PMU(obj) \

View File

@ -102,15 +102,15 @@ void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq);
/* pxa2xx_keypad.c */ /* pxa2xx_keypad.c */
struct keymap { struct keymap {
int column; int8_t column;
int row; int8_t row;
}; };
typedef struct PXA2xxKeyPadState PXA2xxKeyPadState; typedef struct PXA2xxKeyPadState PXA2xxKeyPadState;
PXA2xxKeyPadState *pxa27x_keypad_init(MemoryRegion *sysmem, PXA2xxKeyPadState *pxa27x_keypad_init(MemoryRegion *sysmem,
hwaddr base, hwaddr base,
qemu_irq irq); qemu_irq irq);
void pxa27x_register_keypad(PXA2xxKeyPadState *kp, struct keymap *map, void pxa27x_register_keypad(PXA2xxKeyPadState *kp,
int size); const struct keymap *map, int size);
/* pxa2xx.c */ /* pxa2xx.c */
typedef struct PXA2xxI2CState PXA2xxI2CState; typedef struct PXA2xxI2CState PXA2xxI2CState;

View File

@ -2543,9 +2543,9 @@ void sparc64_set_context(CPUSPARCState *env)
abi_ulong *src, *dst; abi_ulong *src, *dst;
src = ucp->tuc_sigmask.sig; src = ucp->tuc_sigmask.sig;
dst = target_set.sig; dst = target_set.sig;
for (i = 0; i < sizeof(target_sigset_t) / sizeof(abi_ulong); for (i = 0; i < TARGET_NSIG_WORDS; i++, dst++, src++) {
i++, dst++, src++)
err |= __get_user(*dst, src); err |= __get_user(*dst, src);
}
if (err) if (err)
goto do_sigsegv; goto do_sigsegv;
} }
@ -2648,9 +2648,9 @@ void sparc64_get_context(CPUSPARCState *env)
abi_ulong *src, *dst; abi_ulong *src, *dst;
src = target_set.sig; src = target_set.sig;
dst = ucp->tuc_sigmask.sig; dst = ucp->tuc_sigmask.sig;
for (i = 0; i < sizeof(target_sigset_t) / sizeof(abi_ulong); for (i = 0; i < TARGET_NSIG_WORDS; i++, dst++, src++) {
i++, dst++, src++)
err |= __put_user(*src, dst); err |= __put_user(*src, dst);
}
if (err) if (err)
goto do_sigsegv; goto do_sigsegv;
} }

View File

@ -856,7 +856,7 @@ static int net_host_check_device(const char *device)
,"vde" ,"vde"
#endif #endif
}; };
for (i = 0; i < sizeof(valid_param_list) / sizeof(char *); i++) { for (i = 0; i < ARRAY_SIZE(valid_param_list); i++) {
if (!strncmp(valid_param_list[i], device, if (!strncmp(valid_param_list[i], device,
strlen(valid_param_list[i]))) strlen(valid_param_list[i])))
return 1; return 1;

View File

@ -1975,8 +1975,7 @@ static void win_stdio_wait_func(void *opaque)
DWORD dwSize; DWORD dwSize;
int i; int i;
ret = ReadConsoleInput(stdio->hStdIn, buf, sizeof(buf) / sizeof(*buf), ret = ReadConsoleInput(stdio->hStdIn, buf, ARRAY_SIZE(buf), &dwSize);
&dwSize);
if (!ret) { if (!ret) {
/* Avoid error storm */ /* Avoid error storm */

View File

@ -2419,6 +2419,8 @@ vc:80Cx24C
No device is allocated. No device is allocated.
@item null @item null
void device void device
@item chardev:@var{id}
Use a named character device defined with the @code{-chardev} option.
@item /dev/XXX @item /dev/XXX
[Linux only] Use host tty, e.g. @file{/dev/ttyS0}. The host serial port [Linux only] Use host tty, e.g. @file{/dev/ttyS0}. The host serial port
parameters are set according to the emulated ones. parameters are set according to the emulated ones.

View File

@ -531,6 +531,12 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
if (!(env->cr[0] & CR0_PG_MASK)) { if (!(env->cr[0] & CR0_PG_MASK)) {
pte = addr; pte = addr;
#ifdef TARGET_X86_64
if (!(env->hflags & HF_LMA_MASK)) {
/* Without long mode we can only address 32bits in real mode */
pte = (uint32_t)pte;
}
#endif
virt_addr = addr & TARGET_PAGE_MASK; virt_addr = addr & TARGET_PAGE_MASK;
prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
page_size = 4096; page_size = 4096;

View File

@ -112,7 +112,7 @@ void openrisc_translate_init(void)
} }
} }
/* Writeback SR_F transaltion-space to execution-space. */ /* Writeback SR_F translation space to execution space. */
static inline void wb_SR_F(void) static inline void wb_SR_F(void)
{ {
int label; int label;

View File

@ -382,6 +382,7 @@ int main(int argc, char *argv[])
{ {
const char *arch = qtest_get_arch(); const char *arch = qtest_get_arch();
FILE *f = fopen(disk, "w"); FILE *f = fopen(disk, "w");
int ret;
fwrite(boot_sector, 1, sizeof boot_sector, f); fwrite(boot_sector, 1, sizeof boot_sector, f);
fclose(f); fclose(f);
@ -390,5 +391,7 @@ int main(int argc, char *argv[])
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
qtest_add_func("acpi/tcg", test_acpi_tcg); qtest_add_func("acpi/tcg", test_acpi_tcg);
} }
return g_test_run(); ret = g_test_run();
unlink(disk);
return ret;
} }

View File

@ -240,9 +240,8 @@ int keymap[] =
static int cocoa_keycode_to_qemu(int keycode) static int cocoa_keycode_to_qemu(int keycode)
{ {
if((sizeof(keymap)/sizeof(int)) <= keycode) if (ARRAY_SIZE(keymap) <= keycode) {
{ printf("(cocoa) warning unknown keycode 0x%x\n", keycode);
printf("(cocoa) warning unknow keycode 0x%x\n", keycode);
return 0; return 0;
} }
return keymap[keycode]; return keymap[keycode];

5
vl.c
View File

@ -230,7 +230,7 @@ int ctrl_grab = 0;
unsigned int nb_prom_envs = 0; unsigned int nb_prom_envs = 0;
const char *prom_envs[MAX_PROM_ENVS]; const char *prom_envs[MAX_PROM_ENVS];
int boot_menu; int boot_menu;
bool boot_strict; static bool boot_strict;
uint8_t *boot_splash_filedata; uint8_t *boot_splash_filedata;
size_t boot_splash_filedata_size; size_t boot_splash_filedata_size;
uint8_t qemu_extra_params_fw[2]; uint8_t qemu_extra_params_fw[2];
@ -461,7 +461,7 @@ static QemuOptsList qemu_boot_opts = {
.type = QEMU_OPT_STRING, .type = QEMU_OPT_STRING,
}, { }, {
.name = "strict", .name = "strict",
.type = QEMU_OPT_STRING, .type = QEMU_OPT_BOOL,
}, },
{ /*End of list */ } { /*End of list */ }
}, },
@ -4081,6 +4081,7 @@ int main(int argc, char **argv, char **envp)
} }
boot_menu = qemu_opt_get_bool(opts, "menu", boot_menu); boot_menu = qemu_opt_get_bool(opts, "menu", boot_menu);
boot_strict = qemu_opt_get_bool(opts, "strict", false);
} }
if (!kernel_cmdline) { if (!kernel_cmdline) {