summary refs log tree commit diff stats
path: root/scripts/qapi/common.py
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-04-20 22:22:06 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-05-21 20:00:18 +0100
commit3986a1721e10aebe0dc2c17f262ebf067e7414df (patch)
treea3b520fa21afdc1637d13dd34f44dee3788212ad /scripts/qapi/common.py
parentab546bd23856866411ff1b2ffaedabdc360e69df (diff)
downloadfocaccia-qemu-3986a1721e10aebe0dc2c17f262ebf067e7414df.tar.gz
focaccia-qemu-3986a1721e10aebe0dc2c17f262ebf067e7414df.zip
linux-user/arm: Fix identification of syscall numbers
Our code to identify syscall numbers has some issues:
 * for Thumb mode, we never need the immediate value from the insn,
   but we always read it anyway
 * bad immediate values in the svc insn should cause a SIGILL, but we
   were abort()ing instead (via "goto error")

We can fix both these things by refactoring the code that identifies
the syscall number to more closely follow the kernel COMPAT_OABI code:
 * for Thumb it is always r7
 * for Arm, if the immediate value is 0, then this is an EABI call
   with the syscall number in r7
 * otherwise, we XOR the immediate value with 0x900000
   (ARM_SYSCALL_BASE for QEMU; __NR_OABI_SYSCALL_BASE in the kernel),
   which converts valid syscall immediates into the desired value,
   and puts all invalid immediates in the range 0x100000 or above
 * then we can just let the existing "value too large, deliver
   SIGILL" case handle invalid numbers, and drop the 'goto error'

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 20200420212206.12776-5-peter.maydell@linaro.org
Diffstat (limited to 'scripts/qapi/common.py')
0 files changed, 0 insertions, 0 deletions