mirror of https://github.com/xemu-project/xemu.git
- Fix NULL dereference in NVMM & WHPX init_vcpu()
- Move user emulation headers "exec/user" to "user" - Fix SH-4 ADDV / SUBV opcodes - Drop Cocoa compatility on macOS <= 10.12 - Update Anthony PERARD email -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmY1BE4ACgkQ4+MsLN6t wN73jg//dbdHQU+4oM7BgTduDZn1ulKz5DtNEJawRP6vxIcSQ+Co2Yd+gdLOSXNI 2BaoiOQ8cyDEHj1Uud3WVB0GsQYvHrqgXcjeHpX6yFFCZNyRvzEXizJPHKCtq+4e XQFtfTFftlJdaKCLqyDqVnrVNRacFPm7kinrEQbTSmglAhwnyu3GwsokDAYiJTqp g0n6mX/pWVEMDNY1HrDsk2Q/pyIZFmzhtuRyXRvi/bh8/BnmMCpySG+2463dnu1O xIGr2w8ldc+mKn2w2k3wYKDnUHz/NhOkE86tL/ZxIgjCzeenZXwXNdzM+cuAmOZX L9KIu5io6bTevYVwwHhd5/N6MCqVEhoRmsUQfF0CIkIzxXbyF14M89YHXZo3YJAd n2uoJ7i6hF/4Pt6Uqlg09+vEk7onwrobnTPnbKHEKNWHNOMKXpq1CBxxcVz2qe24 +CTAAOOhHqaTjODPSexzHZDZYxugCy1XSqps9AFF1HqUcmsPCL/PQ75YGTJJO0oF 0V1Yvzjhin26AQS9SglIeXnHxYC26Cg2mXnUpVbryWnG888r0XAGpRl+FEuXK7Ln /dGuCIWTozypSkG9304IlxlYsOoXhL11NZqINW+W/Tor3dMRQhWUQcHqv98Jl4Ad rnpzZ0Dhd9ityZdbI0CCMZZZLY5dw1Rq5q407GTJr1CDU4PJBh0= =N8q0 -----END PGP SIGNATURE----- Merge tag 'accel-sh4-ui-20240503' of https://github.com/philmd/qemu into staging - Fix NULL dereference in NVMM & WHPX init_vcpu() - Move user emulation headers "exec/user" to "user" - Fix SH-4 ADDV / SUBV opcodes - Drop Cocoa compatility on macOS <= 10.12 - Update Anthony PERARD email # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmY1BE4ACgkQ4+MsLN6t # wN73jg//dbdHQU+4oM7BgTduDZn1ulKz5DtNEJawRP6vxIcSQ+Co2Yd+gdLOSXNI # 2BaoiOQ8cyDEHj1Uud3WVB0GsQYvHrqgXcjeHpX6yFFCZNyRvzEXizJPHKCtq+4e # XQFtfTFftlJdaKCLqyDqVnrVNRacFPm7kinrEQbTSmglAhwnyu3GwsokDAYiJTqp # g0n6mX/pWVEMDNY1HrDsk2Q/pyIZFmzhtuRyXRvi/bh8/BnmMCpySG+2463dnu1O # xIGr2w8ldc+mKn2w2k3wYKDnUHz/NhOkE86tL/ZxIgjCzeenZXwXNdzM+cuAmOZX # L9KIu5io6bTevYVwwHhd5/N6MCqVEhoRmsUQfF0CIkIzxXbyF14M89YHXZo3YJAd # n2uoJ7i6hF/4Pt6Uqlg09+vEk7onwrobnTPnbKHEKNWHNOMKXpq1CBxxcVz2qe24 # +CTAAOOhHqaTjODPSexzHZDZYxugCy1XSqps9AFF1HqUcmsPCL/PQ75YGTJJO0oF # 0V1Yvzjhin26AQS9SglIeXnHxYC26Cg2mXnUpVbryWnG888r0XAGpRl+FEuXK7Ln # /dGuCIWTozypSkG9304IlxlYsOoXhL11NZqINW+W/Tor3dMRQhWUQcHqv98Jl4Ad # rnpzZ0Dhd9ityZdbI0CCMZZZLY5dw1Rq5q407GTJr1CDU4PJBh0= # =N8q0 # -----END PGP SIGNATURE----- # gpg: Signature made Fri 03 May 2024 08:35:42 AM PDT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] * tag 'accel-sh4-ui-20240503' of https://github.com/philmd/qemu: ui/cocoa.m: Drop old macOS-10.12-and-earlier compat ifdefs target/sh4: Rename TCGv variables as manual for SUBV opcode target/sh4: Rename TCGv variables as manual for ADDV opcode target/sh4: Fix SUBV opcode target/sh4: Fix ADDV opcode MAINTAINERS: Update my email address plugins: Update stale comment plugins/api: Only include 'exec/ram_addr.h' with system emulation coverity: Update user emulation regexp user: Move 'thunk.h' from 'exec/user' to 'user' user: Move 'abitypes.h' from 'exec/user' to 'user' exec: Include missing license in 'exec/cpu-common.h' accel/whpx: Fix NULL dereference in whpx_init_vcpu() accel/nvmm: Fix NULL dereference in nvmm_init_vcpu() Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
commit
97c872276d
|
@ -532,7 +532,7 @@ Guest CPU Cores (Xen)
|
|||
---------------------
|
||||
X86 Xen CPUs
|
||||
M: Stefano Stabellini <sstabellini@kernel.org>
|
||||
M: Anthony Perard <anthony.perard@citrix.com>
|
||||
M: Anthony PERARD <anthony@xenproject.org>
|
||||
M: Paul Durrant <paul@xen.org>
|
||||
L: xen-devel@lists.xenproject.org
|
||||
S: Supported
|
||||
|
@ -3692,7 +3692,6 @@ Overall usermode emulation
|
|||
M: Riku Voipio <riku.voipio@iki.fi>
|
||||
S: Maintained
|
||||
F: accel/tcg/user-exec*.c
|
||||
F: include/exec/user/
|
||||
F: include/user/
|
||||
F: common-user/
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
#include "exec/cpu_ldst.h"
|
||||
#include "exec/exec-all.h"
|
||||
|
||||
#include "exec/user/abitypes.h"
|
||||
#include "user/abitypes.h"
|
||||
|
||||
extern char **environ;
|
||||
|
||||
#include "exec/user/thunk.h"
|
||||
#include "user/thunk.h"
|
||||
#include "target_arch.h"
|
||||
#include "syscall_defs.h"
|
||||
#include "target_syscall.h"
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
/* MMU memory access macros */
|
||||
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
#include "exec/user/abitypes.h"
|
||||
#include "user/abitypes.h"
|
||||
|
||||
/*
|
||||
* If non-zero, the guest virtual address space is a contiguous subset
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
/*
|
||||
* CPU interfaces that are target independent.
|
||||
*
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1+
|
||||
*/
|
||||
#ifndef CPU_COMMON_H
|
||||
#define CPU_COMMON_H
|
||||
|
||||
/* CPU interfaces that are target independent. */
|
||||
|
||||
#include "exec/vaddr.h"
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#include "exec/hwaddr.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef EXEC_USER_ABITYPES_H
|
||||
#define EXEC_USER_ABITYPES_H
|
||||
#ifndef USER_ABITYPES_H
|
||||
#define USER_ABITYPES_H
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#error Cannot include this header from system emulation
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef SYSCALL_TRACE_H
|
||||
#define SYSCALL_TRACE_H
|
||||
|
||||
#include "exec/user/abitypes.h"
|
||||
#include "user/abitypes.h"
|
||||
#include "gdbstub/user.h"
|
||||
#include "qemu/plugin.h"
|
||||
#include "trace/trace-root.h"
|
||||
|
|
|
@ -17,11 +17,15 @@
|
|||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef THUNK_H
|
||||
#define THUNK_H
|
||||
#ifndef USER_THUNK_H
|
||||
#define USER_THUNK_H
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#error Cannot include this header from system emulation
|
||||
#endif
|
||||
|
||||
#include "cpu.h"
|
||||
#include "exec/user/abitypes.h"
|
||||
#include "user/abitypes.h"
|
||||
|
||||
/* types enums definitions */
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
#include "cpu.h"
|
||||
#include "exec/cpu_ldst.h"
|
||||
|
||||
#include "exec/user/abitypes.h"
|
||||
#include "user/abitypes.h"
|
||||
|
||||
#include "syscall_defs.h"
|
||||
#include "target_syscall.h"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "qemu/log.h"
|
||||
|
||||
#include "qemu.h"
|
||||
#include "exec/user/thunk.h"
|
||||
#include "user/thunk.h"
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#ifndef LINUX_USER_USER_INTERNALS_H
|
||||
#define LINUX_USER_USER_INTERNALS_H
|
||||
|
||||
#include "exec/user/thunk.h"
|
||||
#include "user/thunk.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/tb-flush.h"
|
||||
#include "qemu/log.h"
|
||||
|
|
|
@ -42,10 +42,10 @@
|
|||
#include "tcg/tcg.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/gdbstub.h"
|
||||
#include "exec/ram_addr.h"
|
||||
#include "disas/disas.h"
|
||||
#include "plugin.h"
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#include "exec/ram_addr.h"
|
||||
#include "qemu/plugin-memory.h"
|
||||
#include "hw/boards.h"
|
||||
#else
|
||||
|
|
|
@ -410,7 +410,7 @@ void qemu_plugin_tb_trans_cb(CPUState *cpu, struct qemu_plugin_tb *tb)
|
|||
struct qemu_plugin_cb *cb, *next;
|
||||
enum qemu_plugin_event ev = QEMU_PLUGIN_EV_VCPU_TB_TRANS;
|
||||
|
||||
/* no plugin_mask check here; caller should have checked */
|
||||
/* no plugin_state->event_mask check here; caller should have checked */
|
||||
|
||||
QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) {
|
||||
qemu_plugin_vcpu_tb_trans_cb_t func = cb->f.vcpu_tb_trans;
|
||||
|
|
|
@ -121,7 +121,7 @@ usb
|
|||
~ (/qemu)?(/hw/usb/.*|/include/hw/usb/.*)
|
||||
|
||||
user
|
||||
~ (/qemu)?(/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/exec/user/.*)
|
||||
~ (/qemu)?(/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/user/.*)
|
||||
|
||||
util
|
||||
~ (/qemu)?(/util/.*|/include/qemu/.*)
|
||||
|
|
|
@ -982,7 +982,7 @@ nvmm_init_vcpu(CPUState *cpu)
|
|||
}
|
||||
}
|
||||
|
||||
cpu->accel->dirty = true;
|
||||
qcpu->dirty = true;
|
||||
cpu->accel = qcpu;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -2236,7 +2236,7 @@ int whpx_init_vcpu(CPUState *cpu)
|
|||
}
|
||||
|
||||
vcpu->interruptable = true;
|
||||
cpu->accel->dirty = true;
|
||||
vcpu->dirty = true;
|
||||
cpu->accel = vcpu;
|
||||
max_vcpu_index = max(max_vcpu_index, cpu->cpu_index);
|
||||
qemu_add_vm_change_state_handler(whpx_cpu_update_state, env);
|
||||
|
|
|
@ -705,16 +705,20 @@ static void _decode_opc(DisasContext * ctx)
|
|||
return;
|
||||
case 0x300f: /* addv Rm,Rn */
|
||||
{
|
||||
TCGv t0, t1, t2;
|
||||
t0 = tcg_temp_new();
|
||||
tcg_gen_add_i32(t0, REG(B7_4), REG(B11_8));
|
||||
TCGv Rn = REG(B11_8);
|
||||
TCGv Rm = REG(B7_4);
|
||||
TCGv result, t1, t2;
|
||||
|
||||
result = tcg_temp_new();
|
||||
t1 = tcg_temp_new();
|
||||
tcg_gen_xor_i32(t1, t0, REG(B11_8));
|
||||
t2 = tcg_temp_new();
|
||||
tcg_gen_xor_i32(t2, REG(B7_4), REG(B11_8));
|
||||
tcg_gen_add_i32(result, Rm, Rn);
|
||||
/* T = ((Rn ^ Rm) & (Result ^ Rn)) >> 31 */
|
||||
tcg_gen_xor_i32(t1, result, Rn);
|
||||
tcg_gen_xor_i32(t2, Rm, Rn);
|
||||
tcg_gen_andc_i32(cpu_sr_t, t1, t2);
|
||||
tcg_gen_shri_i32(cpu_sr_t, cpu_sr_t, 31);
|
||||
tcg_gen_mov_i32(REG(B7_4), t0);
|
||||
tcg_gen_mov_i32(Rn, result);
|
||||
}
|
||||
return;
|
||||
case 0x2009: /* and Rm,Rn */
|
||||
|
@ -929,16 +933,20 @@ static void _decode_opc(DisasContext * ctx)
|
|||
return;
|
||||
case 0x300b: /* subv Rm,Rn */
|
||||
{
|
||||
TCGv t0, t1, t2;
|
||||
t0 = tcg_temp_new();
|
||||
tcg_gen_sub_i32(t0, REG(B11_8), REG(B7_4));
|
||||
TCGv Rn = REG(B11_8);
|
||||
TCGv Rm = REG(B7_4);
|
||||
TCGv result, t1, t2;
|
||||
|
||||
result = tcg_temp_new();
|
||||
t1 = tcg_temp_new();
|
||||
tcg_gen_xor_i32(t1, t0, REG(B7_4));
|
||||
t2 = tcg_temp_new();
|
||||
tcg_gen_xor_i32(t2, REG(B11_8), REG(B7_4));
|
||||
tcg_gen_sub_i32(result, Rn, Rm);
|
||||
/* T = ((Rn ^ Rm) & (Result ^ Rn)) >> 31 */
|
||||
tcg_gen_xor_i32(t1, result, Rn);
|
||||
tcg_gen_xor_i32(t2, Rn, Rm);
|
||||
tcg_gen_and_i32(t1, t1, t2);
|
||||
tcg_gen_shri_i32(cpu_sr_t, t1, 31);
|
||||
tcg_gen_mov_i32(REG(B11_8), t0);
|
||||
tcg_gen_mov_i32(Rn, result);
|
||||
}
|
||||
return;
|
||||
case 0x2008: /* tst Rm,Rn */
|
||||
|
|
|
@ -17,3 +17,9 @@ TESTS += test-macl
|
|||
|
||||
test-macw: CFLAGS += -O -g
|
||||
TESTS += test-macw
|
||||
|
||||
test-addv: CFLAGS += -O -g
|
||||
TESTS += test-addv
|
||||
|
||||
test-subv: CFLAGS += -O -g
|
||||
TESTS += test-subv
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void addv(const int a, const int b, const int res, const int carry)
|
||||
{
|
||||
int o = a, c;
|
||||
|
||||
asm volatile("addv %2,%0\n"
|
||||
"movt %1\n"
|
||||
: "+r"(o), "=r"(c) : "r"(b) : );
|
||||
|
||||
if (c != carry || o != res) {
|
||||
printf("ADDV %d, %d = %d/%d [T = %d/%d]\n", a, b, o, res, c, carry);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
addv(INT_MAX, 1, INT_MIN, 1);
|
||||
addv(INT_MAX - 1, 1, INT_MAX, 0);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void subv(const int a, const int b, const int res, const int carry)
|
||||
{
|
||||
int o = a, c;
|
||||
|
||||
asm volatile("subv %2,%0\n"
|
||||
"movt %1\n"
|
||||
: "+r"(o), "=r"(c) : "r"(b) : );
|
||||
|
||||
if (c != carry || o != res) {
|
||||
printf("SUBV %d, %d = %d/%d [T = %d/%d]\n", a, b, o, res, c, carry);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
subv(INT_MIN, 1, INT_MAX, 1);
|
||||
subv(INT_MAX, -1, INT_MIN, 1);
|
||||
subv(INT_MAX, 1, INT_MAX - 1, 0);
|
||||
subv(0, 1, -1, 0);
|
||||
subv(-1, -1, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
13
ui/cocoa.m
13
ui/cocoa.m
|
@ -50,23 +50,10 @@
|
|||
#include <Carbon/Carbon.h>
|
||||
#include "hw/core/cpu.h"
|
||||
|
||||
#ifndef MAC_OS_X_VERSION_10_13
|
||||
#define MAC_OS_X_VERSION_10_13 101300
|
||||
#endif
|
||||
|
||||
#ifndef MAC_OS_VERSION_14_0
|
||||
#define MAC_OS_VERSION_14_0 140000
|
||||
#endif
|
||||
|
||||
/* 10.14 deprecates NSOnState and NSOffState in favor of
|
||||
* NSControlStateValueOn/Off, which were introduced in 10.13.
|
||||
* Define for older versions
|
||||
*/
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13
|
||||
#define NSControlStateValueOn NSOnState
|
||||
#define NSControlStateValueOff NSOffState
|
||||
#endif
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
Loading…
Reference in New Issue