arch,sim: Create a common structure to hold syscall tables.
authorGabe Black <gabeblack@google.com>
Wed, 1 Jan 2020 08:39:09 +0000 (00:39 -0800)
committerGabe Black <gabeblack@google.com>
Fri, 20 Mar 2020 10:04:18 +0000 (10:04 +0000)
commitab8d484c272fe99c94a361ee8e1e7d3e3c860007
treeb7e7c6ac2bb9b9f071482a1523dc0b55ac215c23
parentdb7f6a5fa87178e7b5662427d154df21a81a6999
arch,sim: Create a common structure to hold syscall tables.

Also add the syscall number into the SyscallDesc class.

The common table structure is basically just a map that extracts its
key value from the SyscallDesc class using a new num() accessor. By
using a map instead of an array (like RISCV was already doing), it's
easy to support gaps of arbitrary size and non-zero offsets of groups
of system calls without lots of filler or additional logic. This
simplified the ARM system call tables in particular which had a lot
of filler entries.

Also, both the 32 and 64 bit ARM syscall tables had entries for a
syscall at 123456 which was the "Angel SWI system call". This value
is actually the immediate constant passed to the SWI system call
instruction and is not interpreted as the system call number in linux.
This constant can be intercepted by hardware or a simulator to, for
instance, implement ARM semihosting.

Also, that constant in combination with the SWI instruction is only
used for semihosting in 32 bit ARM mode, not in 64 bit mode or in
thumb.

Since checking for that system call number was very likely a mistake
from misinterpreting how the semihosting calls work, this change
drops those checks.

Change-Id: I9b2a902d7326791449cf0e1b98e932dcadba54f7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24117
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
20 files changed:
src/arch/arm/freebsd/process.cc
src/arch/arm/freebsd/process.hh
src/arch/arm/linux/process.cc
src/arch/arm/linux/process.hh
src/arch/mips/linux/process.cc
src/arch/mips/linux/process.hh
src/arch/power/linux/process.cc
src/arch/power/linux/process.hh
src/arch/riscv/linux/process.cc
src/arch/riscv/linux/process.hh
src/arch/sparc/linux/process.cc
src/arch/sparc/linux/process.hh
src/arch/sparc/linux/syscalls.cc
src/arch/sparc/solaris/process.cc
src/arch/sparc/solaris/process.hh
src/arch/x86/linux/process.cc
src/arch/x86/linux/process.hh
src/arch/x86/process.cc
src/arch/x86/process.hh
src/sim/syscall_desc.hh