diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/arm/ArmSystem.py | 14 | ||||
-rw-r--r-- | src/arch/arm/SConscript | 3 | ||||
-rw-r--r-- | src/arch/arm/freebsd/freebsd.cc | 78 | ||||
-rw-r--r-- | src/arch/arm/freebsd/freebsd.hh | 356 | ||||
-rw-r--r-- | src/arch/arm/freebsd/process.cc | 1280 | ||||
-rw-r--r-- | src/arch/arm/freebsd/process.hh | 86 | ||||
-rw-r--r-- | src/arch/arm/freebsd/system.cc | 175 | ||||
-rw-r--r-- | src/arch/arm/freebsd/system.hh | 135 | ||||
-rw-r--r-- | src/arch/arm/linux/system.cc | 4 | ||||
-rw-r--r-- | src/arch/arm/linux/system.hh | 2 | ||||
-rw-r--r-- | src/arch/arm/process.cc | 91 | ||||
-rw-r--r-- | src/arch/arm/system.cc | 18 | ||||
-rw-r--r-- | src/arch/arm/system.hh | 20 | ||||
-rw-r--r-- | src/arch/generic/freebsd/threadinfo.hh | 60 | ||||
-rw-r--r-- | src/base/loader/elf_object.cc | 16 | ||||
-rw-r--r-- | src/base/loader/object_file.hh | 3 | ||||
-rw-r--r-- | src/base/output.cc | 1 | ||||
-rw-r--r-- | src/base/vnc/vncserver.cc | 12 | ||||
-rw-r--r-- | src/dev/arm/gic_pl390.cc | 6 | ||||
-rw-r--r-- | src/dev/terminal.cc | 10 | ||||
-rw-r--r-- | src/kern/SConscript | 1 | ||||
-rw-r--r-- | src/kern/freebsd/events.cc | 71 | ||||
-rw-r--r-- | src/kern/freebsd/events.hh | 68 | ||||
-rw-r--r-- | src/kern/freebsd/freebsd.hh | 120 | ||||
-rw-r--r-- | src/sim/process.cc | 10 |
25 files changed, 2593 insertions, 47 deletions
diff --git a/src/arch/arm/ArmSystem.py b/src/arch/arm/ArmSystem.py index ec9d8c848..f40458ca5 100644 --- a/src/arch/arm/ArmSystem.py +++ b/src/arch/arm/ArmSystem.py @@ -71,9 +71,9 @@ class ArmSystem(System): have_large_asid_64 = Param.Bool(False, "True if ASID is 16 bits in AArch64 (ARMv8)") -class LinuxArmSystem(ArmSystem): - type = 'LinuxArmSystem' - cxx_header = "arch/arm/linux/system.hh" +class GenericArmSystem(ArmSystem): + type = 'GenericArmSystem' + cxx_header = "arch/arm/system.hh" load_addr_mask = 0x0fffffff machine_type = Param.ArmMachineType('VExpress_EMM', "Machine id from http://www.arm.linux.org.uk/developer/machines/") @@ -91,3 +91,11 @@ class LinuxArmSystem(ArmSystem): "guest kernel panics") panic_on_oops = Param.Bool(False, "Trigger a gem5 panic if the " \ "guest kernel oopses") + +class LinuxArmSystem(GenericArmSystem): + type = 'LinuxArmSystem' + cxx_header = "arch/arm/linux/system.hh" + +class FreebsdArmSystem(GenericArmSystem): + type = 'FreebsdArmSystem' + cxx_header = "arch/arm/freebsd/system.hh" diff --git a/src/arch/arm/SConscript b/src/arch/arm/SConscript index a4740a9bc..f6c8f3c44 100644 --- a/src/arch/arm/SConscript +++ b/src/arch/arm/SConscript @@ -67,6 +67,9 @@ if env['TARGET_ISA'] == 'arm': Source('linux/linux.cc') Source('linux/process.cc') Source('linux/system.cc') + Source('freebsd/freebsd.cc') + Source('freebsd/process.cc') + Source('freebsd/system.cc') Source('miscregs.cc') Source('nativetrace.cc') Source('pmu.cc') diff --git a/src/arch/arm/freebsd/freebsd.cc b/src/arch/arm/freebsd/freebsd.cc new file mode 100644 index 000000000..feee5686f --- /dev/null +++ b/src/arch/arm/freebsd/freebsd.cc @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by the University of Cambridge Computer + * Laboratory as part of the CTSRD Project, with support from the UK Higher + * Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "arch/arm/freebsd/freebsd.hh" + +#include <fcntl.h> + +// open(2) flags translation table +OpenFlagTransTable ArmFreebsd32::openFlagTable[] = { + { ArmFreebsd32::TGT_O_RDONLY, O_RDONLY }, + { ArmFreebsd32::TGT_O_WRONLY, O_WRONLY }, + { ArmFreebsd32::TGT_O_RDWR, O_RDWR }, + { ArmFreebsd32::TGT_O_CREAT, O_CREAT }, + { ArmFreebsd32::TGT_O_EXCL, O_EXCL }, + { ArmFreebsd32::TGT_O_NOCTTY, O_NOCTTY }, + { ArmFreebsd32::TGT_O_TRUNC, O_TRUNC }, + { ArmFreebsd32::TGT_O_APPEND, O_APPEND }, + { ArmFreebsd32::TGT_O_NONBLOCK, O_NONBLOCK }, + { ArmFreebsd32::TGT_O_SYNC, O_SYNC }, + { ArmFreebsd32::TGT_FASYNC, FASYNC }, + { ArmFreebsd32::TGT_O_DIRECT, O_DIRECT }, + { ArmFreebsd32::TGT_O_DIRECTORY, O_DIRECTORY }, + { ArmFreebsd32::TGT_O_NOFOLLOW, O_NOFOLLOW }, +}; + +const int ArmFreebsd32::NUM_OPEN_FLAGS = sizeof(ArmFreebsd32::openFlagTable) / + sizeof(ArmFreebsd32::openFlagTable[0]); + +// open(2) flags translation table +OpenFlagTransTable ArmFreebsd64::openFlagTable[] = { + { ArmFreebsd32::TGT_O_RDONLY, O_RDONLY }, + { ArmFreebsd32::TGT_O_WRONLY, O_WRONLY }, + { ArmFreebsd32::TGT_O_RDWR, O_RDWR }, + { ArmFreebsd32::TGT_O_CREAT, O_CREAT }, + { ArmFreebsd32::TGT_O_EXCL, O_EXCL }, + { ArmFreebsd32::TGT_O_NOCTTY, O_NOCTTY }, + { ArmFreebsd32::TGT_O_TRUNC, O_TRUNC }, + { ArmFreebsd32::TGT_O_APPEND, O_APPEND }, + { ArmFreebsd32::TGT_O_NONBLOCK, O_NONBLOCK }, + { ArmFreebsd32::TGT_O_SYNC, O_SYNC }, + { ArmFreebsd32::TGT_FASYNC, FASYNC }, + { ArmFreebsd32::TGT_O_DIRECT, O_DIRECT }, + { ArmFreebsd32::TGT_O_DIRECTORY, O_DIRECTORY }, + { ArmFreebsd32::TGT_O_NOFOLLOW, O_NOFOLLOW }, +}; + +const int ArmFreebsd64::NUM_OPEN_FLAGS = sizeof(ArmFreebsd64::openFlagTable) / + sizeof(ArmFreebsd64::openFlagTable[0]); + diff --git a/src/arch/arm/freebsd/freebsd.hh b/src/arch/arm/freebsd/freebsd.hh new file mode 100644 index 000000000..b5654185b --- /dev/null +++ b/src/arch/arm/freebsd/freebsd.hh @@ -0,0 +1,356 @@ +/* + * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by the University of Cambridge Computer + * Laboratory as part of the CTSRD Project, with support from the UK Higher + * Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __ARCH_ARM_FREEBSD_FREEBSD_HH__ +#define __ARCH_ARM_FREEBSD_FREEBSD_HH__ + +#include "kern/freebsd/freebsd.hh" + +class ArmFreebsd32 : public FreeBSD +{ + public: + + /// This table maps the target open() flags to the corresponding + /// host open() flags. + static OpenFlagTransTable openFlagTable[]; + + /// Number of entries in openFlagTable[]. + static const int NUM_OPEN_FLAGS; + + //@{ + /// Basic ARM FreeBSD types + typedef uint32_t size_t; + typedef uint32_t off_t; + typedef int32_t time_t; + typedef int32_t clock_t; + //@} + + //@{ + /// open(2) flag values. + static const int TGT_O_RDONLY = 0x00000000; //!< O_RDONLY + static const int TGT_O_WRONLY = 0x00000001; //!< O_WRONLY + static const int TGT_O_RDWR = 0x00000002; //!< O_RDWR + static const int TGT_O_CREAT = 0x00000200; //!< O_CREAT + static const int TGT_O_EXCL = 0x00000800; //!< O_EXCL + static const int TGT_O_NOCTTY = 0x00008000; //!< O_NOCTTY + static const int TGT_O_TRUNC = 0x00000400; //!< O_TRUNC + static const int TGT_O_APPEND = 0x00000008; //!< O_APPEND + static const int TGT_O_NONBLOCK = 0x00000004; //!< O_NONBLOCK + static const int TGT_O_SYNC = 0x00000080; //!< O_SYNC + static const int TGT_FASYNC = 0x00000040; //!< FASYNC + static const int TGT_O_DIRECT = 0x00010000; //!< O_DIRECT + static const int TGT_O_DIRECTORY = 0x00020000; //!< O_DIRECTORY + static const int TGT_O_NOFOLLOW = 0x00000100; //!< O_NOFOLLOW + static const int TGT_O_CLOEXEC = 0x00100000; //!< O_CLOEXEC + //@} + + /// For mmap(). + static const unsigned TGT_MAP_ANONYMOUS = 0x1000; + static const unsigned TGT_MAP_FIXED = 0x0010; + + /// Limit struct for getrlimit/setrlimit. + struct rlimit { + uint32_t rlim_cur; //!< soft limit + uint32_t rlim_max; //!< hard limit + }; + + /// For gettimeofday(). + struct timeval { + int32_t tv_sec; //!< seconds + int32_t tv_usec; //!< microseconds + }; + + // For writev/readv + struct tgt_iovec { + uint32_t iov_base; // void * + uint32_t iov_len; + }; + + /* + * sizeof st 120 + * sizeof st_dev 4 + * sizeof st_ino 4 + * sizeof st_mode 2 + * sizeof st_nlink 2 + * sizeof st_uid 4 + * sizeof st_gid 4 + * sizeof st_rdev 4 + * sizeof st_atim 16 + * sizeof st_size 8 + * sizeof st_blocks 8 + * sizeof st_blksize 4 + * sizeof st_flags 4 + * sizeof st_gen 4 + * sizeof st_lspare 4 + */ + + typedef struct { + uint32_t st_dev; + uint32_t st_ino; + uint16_t st_mode; + uint16_t st_nlink; + uint32_t st_uid; + uint32_t st_gid; + uint32_t st_rdev; + uint64_t st_atimeX; + uint64_t st_atime_nsec; + uint64_t st_mtimeX; + uint64_t st_mtime_nsec; + uint64_t st_ctimeX; + uint64_t st_ctime_nsec; + uint64_t st_size; + uint64_t st_blocks; + uint32_t st_blksize; + uint32_t st_flags; + uint32_t st_gen; + uint32_t st_lspare; + uint64_t st_birthtimX; + uint64_t st_birthtim; + } tgt_stat; + + typedef struct { + uint32_t st_dev; + uint32_t st_ino; + uint16_t st_mode; + uint16_t st_nlink; + uint32_t st_uid; + uint32_t st_gid; + uint32_t st_rdev; + uint64_t st_atimeX; + uint64_t st_atime_nsec; + uint64_t st_mtimeX; + uint64_t st_mtime_nsec; + uint64_t st_ctimeX; + uint64_t st_ctime_nsec; + uint64_t st_size; + uint64_t st_blocks; + uint32_t st_blksize; + uint32_t st_flags; + uint32_t st_gen; + uint32_t st_lspare; + uint64_t st_birthtimX; + uint64_t st_birthtim; + } tgt_stat64; + + /// For getrusage(). + struct rusage { + struct timeval ru_utime; //!< user time used + struct timeval ru_stime; //!< system time used + int32_t ru_maxrss; //!< max rss + int32_t ru_ixrss; //!< integral shared memory size + int32_t ru_idrss; //!< integral unshared data " + int32_t ru_isrss; //!< integral unshared stack " + int32_t ru_minflt; //!< page reclaims - total vmfaults + int32_t ru_majflt; //!< page faults + int32_t ru_nswap; //!< swaps + int32_t ru_inblock; //!< block input operations + int32_t ru_oublock; //!< block output operations + int32_t ru_msgsnd; //!< messages sent + int32_t ru_msgrcv; //!< messages received + int32_t ru_nsignals; //!< signals received + int32_t ru_nvcsw; //!< voluntary context switches + int32_t ru_nivcsw; //!< involuntary " + }; + + /// For times(). + struct tms { + int32_t tms_utime; //!< user time + int32_t tms_stime; //!< system time + int32_t tms_cutime; //!< user time of children + int32_t tms_cstime; //!< system time of children + }; +}; + +class ArmFreebsd64 : public FreeBSD +{ + public: + + /// This table maps the target open() flags to the corresponding + /// host open() flags. + static OpenFlagTransTable openFlagTable[]; + + /// Number of entries in openFlagTable[]. + static const int NUM_OPEN_FLAGS; + + //@{ + /// Basic ARM FreeBSD types + typedef uint64_t size_t; + typedef uint64_t off_t; + typedef int64_t time_t; + typedef int64_t clock_t; + //@} + + //@{ + /// open(2) flag values. + static const int TGT_O_RDONLY = 0x00000000; //!< O_RDONLY + static const int TGT_O_WRONLY = 0x00000001; //!< O_WRONLY + static const int TGT_O_RDWR = 0x00000002; //!< O_RDWR + static const int TGT_O_CREAT = 0x00000200; //!< O_CREAT + static const int TGT_O_EXCL = 0x00000800; //!< O_EXCL + static const int TGT_O_NOCTTY = 0x00008000; //!< O_NOCTTY + static const int TGT_O_TRUNC = 0x00000400; //!< O_TRUNC + static const int TGT_O_APPEND = 0x00000008; //!< O_APPEND + static const int TGT_O_NONBLOCK = 0x00000004; //!< O_NONBLOCK + static const int TGT_O_SYNC = 0x00000080; //!< O_SYNC + static const int TGT_FASYNC = 0x00000040; //!< FASYNC + static const int TGT_O_DIRECT = 0x00010000; //!< O_DIRECT + static const int TGT_O_DIRECTORY = 0x00020000; //!< O_DIRECTORY + static const int TGT_O_NOFOLLOW = 0x00000100; //!< O_NOFOLLOW + static const int TGT_O_CLOEXEC = 0x00100000; //!< O_CLOEXEC + //@} + + /// For mmap(). + static const unsigned TGT_MAP_ANONYMOUS = 0x1000; + static const unsigned TGT_MAP_FIXED = 0x0010; + + //@{ + /// For getrusage(). + static const int TGT_RUSAGE_SELF = 0; + static const int TGT_RUSAGE_CHILDREN = -1; + static const int TGT_RUSAGE_THREAD = 1; + //@} + + /// Resource enumeration for getrlimit(). + enum rlimit_resources { + TGT_RLIMIT_CPU = 0, + TGT_RLIMIT_FSIZE = 1, + TGT_RLIMIT_DATA = 2, + TGT_RLIMIT_STACK = 3, + TGT_RLIMIT_CORE = 4, + TGT_RLIMIT_RSS = 5, + TGT_RLIMIT_MEMLOCK = 6, + TGT_RLIMIT_NPROC = 7, + TGT_RLIMIT_NOFILE = 8, + TGT_RLIMIT_SBSIZE = 9, + TGT_RLIMIT_VMEM = 10, + TGT_RLIMIT_AS = TGT_RLIMIT_VMEM, + TGT_RLIMIT_NPTS = 11, + TGT_RLIMIT_SWAP = 12, + TGT_RLIMIT_KQUEUES = 13 + }; + + /// Limit struct for getrlimit/setrlimit. + struct rlimit { + uint64_t rlim_cur; //!< soft limit + uint64_t rlim_max; //!< hard limit + }; + + /// For gettimeofday(). + struct timeval { + int64_t tv_sec; //!< seconds + int64_t tv_usec; //!< microseconds + }; + + // For writev/readv + struct tgt_iovec { + uint64_t iov_base; // void * + uint64_t iov_len; + }; + + typedef struct { + uint32_t st_dev; + uint32_t st_ino; + uint16_t st_mode; + uint16_t st_nlink; + uint32_t st_uid; + uint32_t st_gid; + uint32_t st_rdev; + uint64_t st_atimeX; + uint64_t st_atime_nsec; + uint64_t st_mtimeX; + uint64_t st_mtime_nsec; + uint64_t st_ctimeX; + uint64_t st_ctime_nsec; + uint64_t st_size; + uint64_t st_blocks; + uint32_t st_blksize; + uint32_t st_flags; + uint32_t st_gen; + uint32_t st_lspare; + uint64_t st_birthtimX; + uint64_t st_birthtim; + } tgt_stat; + + typedef struct { + uint32_t st_dev; + uint32_t st_ino; + uint16_t st_mode; + uint16_t st_nlink; + uint32_t st_uid; + uint32_t st_gid; + uint32_t st_rdev; + uint64_t st_atimeX; + uint64_t st_atime_nsec; + uint64_t st_mtimeX; + uint64_t st_mtime_nsec; + uint64_t st_ctimeX; + uint64_t st_ctime_nsec; + uint64_t st_size; + uint64_t st_blocks; + uint32_t st_blksize; + uint32_t st_flags; + uint32_t st_gen; + uint32_t st_lspare; + uint64_t st_birthtimX; + uint64_t st_birthtim; + } tgt_stat64; + + /// For getrusage(). + struct rusage { + struct timeval ru_utime; //!< user time used + struct timeval ru_stime; //!< system time used + int64_t ru_maxrss; //!< max rss + int64_t ru_ixrss; //!< integral shared memory size + int64_t ru_idrss; //!< integral unshared data " + int64_t ru_isrss; //!< integral unshared stack " + int64_t ru_minflt; //!< page reclaims - total vmfaults + int64_t ru_majflt; //!< page faults + int64_t ru_nswap; //!< swaps + int64_t ru_inblock; //!< block input operations + int64_t ru_oublock; //!< block output operations + int64_t ru_msgsnd; //!< messages sent + int64_t ru_msgrcv; //!< messages received + int64_t ru_nsignals; //!< signals received + int64_t ru_nvcsw; //!< voluntary context switches + int64_t ru_nivcsw; //!< involuntary " + }; + + /// For times(). + struct tms { + int64_t tms_utime; //!< user time + int64_t tms_stime; //!< system time + int64_t tms_cutime; //!< user time of children + int64_t tms_cstime; //!< system time of children + }; +}; + +#endif diff --git a/src/arch/arm/freebsd/process.cc b/src/arch/arm/freebsd/process.cc new file mode 100644 index 000000000..c2a6b38b0 --- /dev/null +++ b/src/arch/arm/freebsd/process.cc @@ -0,0 +1,1280 @@ +/* + * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by the University of Cambridge Computer + * Laboratory as part of the CTSRD Project, with support from the UK Higher + * Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "arch/arm/freebsd/process.hh" + +#include <sys/mman.h> +#include <sys/param.h> +#include <sys/syscall.h> +#include <sys/sysctl.h> +#include <sys/types.h> +#include <utime.h> + +#include "arch/arm/freebsd/freebsd.hh" +#include "arch/arm/isa_traits.hh" +#include "base/trace.hh" +#include "cpu/thread_context.hh" +#include "kern/freebsd/freebsd.hh" +#include "sim/process.hh" +#include "sim/syscall_emul.hh" +#include "sim/system.hh" + +using namespace std; +using namespace ArmISA; + +static SyscallReturn +issetugidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, + ThreadContext *tc) +{ + + return 0; +} + +static SyscallReturn +sysctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process, + ThreadContext *tc) +{ + int index = 0; + uint64_t ret; + + Addr namep = process->getSyscallArg(tc, index); + size_t namelen = process->getSyscallArg(tc, index); + Addr oldp = process->getSyscallArg(tc, index); + Addr oldlenp = process->getSyscallArg(tc, index); + Addr newp = process->getSyscallArg(tc, index); + size_t newlen = process->getSyscallArg(tc, index); + + BufferArg buf(namep, sizeof(size_t)); + BufferArg buf2(oldp, sizeof(size_t)); + BufferArg buf3(oldlenp, sizeof(size_t)); + BufferArg buf4(newp, sizeof(size_t)); + + buf.copyIn(tc->getMemProxy()); + buf2.copyIn(tc->getMemProxy()); + buf3.copyIn(tc->getMemProxy()); + + void *hnewp = NULL; + if (newp) { + buf4.copyIn(tc->getMemProxy()); + hnewp = (void *)buf4.bufferPtr(); + } + + uint32_t *hnamep = (uint32_t *)buf.bufferPtr(); + void *holdp = (void *)buf2.bufferPtr(); + size_t *holdlenp = (size_t *)buf3.bufferPtr(); + + ret = sysctl((int *)hnamep, namelen, holdp, holdlenp, hnewp, newlen); + + buf.copyOut(tc->getMemProxy()); + buf2.copyOut(tc->getMemProxy()); + buf3.copyOut(tc->getMemProxy()); + if (newp) + buf4.copyOut(tc->getMemProxy()); + + return (ret); +} + +static SyscallDesc syscallDescs32[] = { + /* 0 */ SyscallDesc("unused#000", unimplementedFunc), + /* 1 */ SyscallDesc("unused#001", unimplementedFunc), + /* 2 */ SyscallDesc("unused#002", unimplementedFunc), + /* 3 */ SyscallDesc("unused#003", unimplementedFunc), + /* 4 */ SyscallDesc("unused#004", unimplementedFunc), + /* 5 */ SyscallDesc("unused#005", unimplementedFunc), + /* 6 */ SyscallDesc("unused#006", unimplementedFunc), + /* 7 */ SyscallDesc("unused#007", unimplementedFunc), + /* 8 */ SyscallDesc("unused#008", unimplementedFunc), + /* 9 */ SyscallDesc("unused#009", unimplementedFunc), + /* 10 */ SyscallDesc("unused#010", unimplementedFunc), + /* 11 */ SyscallDesc("unused#011", unimplementedFunc), + /* 12 */ SyscallDesc("unused#012", unimplementedFunc), + /* 13 */ SyscallDesc("unused#013", unimplementedFunc), + /* 14 */ SyscallDesc("unused#014", unimplementedFunc), + /* 15 */ SyscallDesc("unused#015", unimplementedFunc), + /* 16 */ SyscallDesc("unused#016", unimplementedFunc), + /* 17 */ SyscallDesc("unused#017", unimplementedFunc), + /* 18 */ SyscallDesc("unused#018", unimplementedFunc), + /* 19 */ SyscallDesc("unused#019", unimplementedFunc), + /* 20 */ SyscallDesc("unused#020", unimplementedFunc), + /* 21 */ SyscallDesc("unused#021", unimplementedFunc), + /* 22 */ SyscallDesc("unused#022", unimplementedFunc), + /* 23 */ SyscallDesc("unused#023", unimplementedFunc), + /* 24 */ SyscallDesc("unused#024", unimplementedFunc), + /* 25 */ SyscallDesc("unused#025", unimplementedFunc), + /* 26 */ SyscallDesc("unused#026", unimplementedFunc), + /* 27 */ SyscallDesc("unused#027", unimplementedFunc), + /* 28 */ SyscallDesc("unused#028", unimplementedFunc), + /* 29 */ SyscallDesc("unused#029", unimplementedFunc), + /* 30 */ SyscallDesc("unused#030", unimplementedFunc), + /* 31 */ SyscallDesc("unused#031", unimplementedFunc), + /* 32 */ SyscallDesc("unused#032", unimplementedFunc), + /* 33 */ SyscallDesc("unused#033", unimplementedFunc), + /* 34 */ SyscallDesc("unused#034", unimplementedFunc), + /* 35 */ SyscallDesc("unused#035", unimplementedFunc), + /* 36 */ SyscallDesc("unused#036", unimplementedFunc), + /* 37 */ SyscallDesc("unused#037", unimplementedFunc), + /* 38 */ SyscallDesc("unused#038", unimplementedFunc), + /* 39 */ SyscallDesc("unused#039", unimplementedFunc), + /* 40 */ SyscallDesc("unused#040", unimplementedFunc), + /* 41 */ SyscallDesc("unused#041", unimplementedFunc), + /* 42 */ SyscallDesc("unused#042", unimplementedFunc), + /* 43 */ SyscallDesc("unused#043", unimplementedFunc), + /* 44 */ SyscallDesc("unused#044", unimplementedFunc), + /* 45 */ SyscallDesc("unused#045", unimplementedFunc), + /* 46 */ SyscallDesc("unused#046", unimplementedFunc), + /* 47 */ SyscallDesc("unused#047", unimplementedFunc), + /* 48 */ SyscallDesc("unused#048", unimplementedFunc), + /* 49 */ SyscallDesc("unused#049", unimplementedFunc), + /* 50 */ SyscallDesc("unused#050", unimplementedFunc), + /* 51 */ SyscallDesc("unused#051", unimplementedFunc), + /* 52 */ SyscallDesc("unused#052", unimplementedFunc), + /* 53 */ SyscallDesc("unused#053", unimplementedFunc), + /* 54 */ SyscallDesc("unused#054", unimplementedFunc), + /* 55 */ SyscallDesc("unused#055", unimplementedFunc), + /* 56 */ SyscallDesc("unused#056", unimplementedFunc), + /* 57 */ SyscallDesc("unused#057", unimplementedFunc), + /* 58 */ SyscallDesc("unused#058", unimplementedFunc), + /* 59 */ SyscallDesc("unused#059", unimplementedFunc), + /* 60 */ SyscallDesc("unused#060", unimplementedFunc), + /* 61 */ SyscallDesc("unused#061", unimplementedFunc), + /* 62 */ SyscallDesc("unused#062", unimplementedFunc), + /* 63 */ SyscallDesc("unused#063", unimplementedFunc), + /* 64 */ SyscallDesc("unused#064", unimplementedFunc), + /* 65 */ SyscallDesc("unused#065", unimplementedFunc), + /* 66 */ SyscallDesc("unused#066", unimplementedFunc), + /* 67 */ SyscallDesc("unused#067", unimplementedFunc), + /* 68 */ SyscallDesc("unused#068", unimplementedFunc), + /* 69 */ SyscallDesc("unused#069", unimplementedFunc), + /* 70 */ SyscallDesc("unused#070", unimplementedFunc), + /* 71 */ SyscallDesc("unused#071", unimplementedFunc), + /* 72 */ SyscallDesc("unused#072", unimplementedFunc), + /* 73 */ SyscallDesc("unused#073", unimplementedFunc), + /* 74 */ SyscallDesc("unused#074", unimplementedFunc), + /* 75 */ SyscallDesc("unused#075", unimplementedFunc), + /* 76 */ SyscallDesc("unused#076", unimplementedFunc), + /* 77 */ SyscallDesc("unused#077", unimplementedFunc), + /* 78 */ SyscallDesc("unused#078", unimplementedFunc), + /* 79 */ SyscallDesc("unused#079", unimplementedFunc), + /* 80 */ SyscallDesc("unused#080", unimplementedFunc), + /* 81 */ SyscallDesc("unused#081", unimplementedFunc), + /* 82 */ SyscallDesc("unused#082", unimplementedFunc), + /* 83 */ SyscallDesc("unused#083", unimplementedFunc), + /* 84 */ SyscallDesc("unused#084", unimplementedFunc), + /* 85 */ SyscallDesc("unused#085", unimplementedFunc), + /* 86 */ SyscallDesc("unused#086", unimplementedFunc), + /* 87 */ SyscallDesc("unused#087", unimplementedFunc), + /* 88 */ SyscallDesc("unused#088", unimplementedFunc), + /* 89 */ SyscallDesc("unused#089", unimplementedFunc), + /* 90 */ SyscallDesc("unused#090", unimplementedFunc), + /* 91 */ SyscallDesc("unused#091", unimplementedFunc), + /* 92 */ SyscallDesc("unused#092", unimplementedFunc), + /* 93 */ SyscallDesc("unused#093", unimplementedFunc), + /* 94 */ SyscallDesc("unused#094", unimplementedFunc), + /* 95 */ SyscallDesc("unused#095", unimplementedFunc), + /* 96 */ SyscallDesc("unused#096", unimplementedFunc), + /* 97 */ SyscallDesc("unused#097", unimplementedFunc), + /* 98 */ SyscallDesc("unused#098", unimplementedFunc), + /* 99 */ SyscallDesc("unused#099", unimplementedFunc), + /* 100 */ SyscallDesc("unused#100", unimplementedFunc), + /* 101 */ SyscallDesc("unused#101", unimplementedFunc), + /* 102 */ SyscallDesc("unused#102", unimplementedFunc), + /* 103 */ SyscallDesc("unused#103", unimplementedFunc), + /* 104 */ SyscallDesc("unused#104", unimplementedFunc), + /* 105 */ SyscallDesc("unused#105", unimplementedFunc), + /* 106 */ SyscallDesc("unused#106", unimplementedFunc), + /* 107 */ SyscallDesc("unused#107", unimplementedFunc), + /* 108 */ SyscallDesc("unused#108", unimplementedFunc), + /* 109 */ SyscallDesc("unused#109", unimplementedFunc), + /* 110 */ SyscallDesc("unused#110", unimplementedFunc), + /* 111 */ SyscallDesc("unused#111", unimplementedFunc), + /* 112 */ SyscallDesc("unused#112", unimplementedFunc), + /* 113 */ SyscallDesc("unused#113", unimplementedFunc), + /* 114 */ SyscallDesc("unused#114", unimplementedFunc), + /* 115 */ SyscallDesc("unused#115", unimplementedFunc), + /* 116 */ SyscallDesc("unused#116", unimplementedFunc), + /* 117 */ SyscallDesc("unused#117", unimplementedFunc), + /* 118 */ SyscallDesc("unused#118", unimplementedFunc), + /* 119 */ SyscallDesc("unused#119", unimplementedFunc), + /* 120 */ SyscallDesc("unused#120", unimplementedFunc), + /* 121 */ SyscallDesc("unused#121", unimplementedFunc), + /* 122 */ SyscallDesc("unused#122", unimplementedFunc), + /* 123 */ SyscallDesc("unused#123", unimplementedFunc), + /* 124 */ SyscallDesc("unused#124", unimplementedFunc), + /* 125 */ SyscallDesc("unused#125", unimplementedFunc), + /* 126 */ SyscallDesc("unused#126", unimplementedFunc), + /* 127 */ SyscallDesc("unused#127", unimplementedFunc), + /* 128 */ SyscallDesc("unused#128", unimplementedFunc), + /* 129 */ SyscallDesc("unused#129", unimplementedFunc), + /* 130 */ SyscallDesc("unused#130", unimplementedFunc), + /* 131 */ SyscallDesc("unused#131", unimplementedFunc), + /* 132 */ SyscallDesc("unused#132", unimplementedFunc), + /* 133 */ SyscallDesc("unused#133", unimplementedFunc), + /* 134 */ SyscallDesc("unused#134", unimplementedFunc), + /* 135 */ SyscallDesc("unused#135", unimplementedFunc), + /* 136 */ SyscallDesc("unused#136", unimplementedFunc), + /* 137 */ SyscallDesc("unused#137", unimplementedFunc), + /* 138 */ SyscallDesc("unused#138", unimplementedFunc), + /* 139 */ SyscallDesc("unused#139", unimplementedFunc), + /* 140 */ SyscallDesc("unused#140", unimplementedFunc), + /* 141 */ SyscallDesc("unused#141", unimplementedFunc), + /* 142 */ SyscallDesc("unused#142", unimplementedFunc), + /* 143 */ SyscallDesc("unused#143", unimplementedFunc), + /* 144 */ SyscallDesc("unused#144", unimplementedFunc), + /* 145 */ SyscallDesc("unused#145", unimplementedFunc), + /* 146 */ SyscallDesc("unused#146", unimplementedFunc), + /* 147 */ SyscallDesc("unused#147", unimplementedFunc), + /* 148 */ SyscallDesc("unused#148", unimplementedFunc), + /* 149 */ SyscallDesc("unused#149", unimplementedFunc), + /* 150 */ SyscallDesc("unused#150", unimplementedFunc), + /* 151 */ SyscallDesc("unused#151", unimplementedFunc), + /* 152 */ SyscallDesc("unused#152", unimplementedFunc), + /* 153 */ SyscallDesc("unused#153", unimplementedFunc), + /* 154 */ SyscallDesc("unused#154", unimplementedFunc), + /* 155 */ SyscallDesc("unused#155", unimplementedFunc), + /* 156 */ SyscallDesc("unused#156", unimplementedFunc), + /* 157 */ SyscallDesc("unused#157", unimplementedFunc), + /* 158 */ SyscallDesc("unused#158", unimplementedFunc), + /* 159 */ SyscallDesc("unused#159", unimplementedFunc), + /* 160 */ SyscallDesc("unused#160", unimplementedFunc), + /* 161 */ SyscallDesc("unused#161", unimplementedFunc), + /* 162 */ SyscallDesc("unused#162", unimplementedFunc), + /* 163 */ SyscallDesc("unused#163", unimplementedFunc), + /* 164 */ SyscallDesc("unused#164", unimplementedFunc), + /* 165 */ SyscallDesc("unused#165", unimplementedFunc), + /* 166 */ SyscallDesc("unused#166", unimplementedFunc), + /* 167 */ SyscallDesc("unused#167", unimplementedFunc), + /* 168 */ SyscallDesc("unused#168", unimplementedFunc), + /* 169 */ SyscallDesc("unused#169", unimplementedFunc), + /* 170 */ SyscallDesc("unused#170", unimplementedFunc), + /* 171 */ SyscallDesc("unused#171", unimplementedFunc), + /* 172 */ SyscallDesc("unused#172", unimplementedFunc), + /* 173 */ SyscallDesc("unused#173", unimplementedFunc), + /* 174 */ SyscallDesc("unused#174", unimplementedFunc), + /* 175 */ SyscallDesc("unused#175", unimplementedFunc), + /* 176 */ SyscallDesc("unused#176", unimplementedFunc), + /* 177 */ SyscallDesc("unused#177", unimplementedFunc), + /* 178 */ SyscallDesc("unused#178", unimplementedFunc), + /* 179 */ SyscallDesc("unused#179", unimplementedFunc), + /* 180 */ SyscallDesc("unused#180", unimplementedFunc), + /* 181 */ SyscallDesc("unused#181", unimplementedFunc), + /* 182 */ SyscallDesc("unused#182", unimplementedFunc), + /* 183 */ SyscallDesc("unused#183", unimplementedFunc), + /* 184 */ SyscallDesc("unused#184", unimplementedFunc), + /* 185 */ SyscallDesc("unused#185", unimplementedFunc), + /* 186 */ SyscallDesc("unused#186", unimplementedFunc), + /* 187 */ SyscallDesc("unused#187", unimplementedFunc), + /* 188 */ SyscallDesc("unused#188", unimplementedFunc), + /* 189 */ SyscallDesc("unused#189", unimplementedFunc), + /* 190 */ SyscallDesc("unused#190", unimplementedFunc), + /* 191 */ SyscallDesc("unused#191", unimplementedFunc), + /* 192 */ SyscallDesc("unused#192", unimplementedFunc), + /* 193 */ SyscallDesc("unused#193", unimplementedFunc), + /* 194 */ SyscallDesc("unused#194", unimplementedFunc), + /* 195 */ SyscallDesc("unused#195", unimplementedFunc), + /* 196 */ SyscallDesc("unused#196", unimplementedFunc), + /* 197 */ SyscallDesc("unused#197", unimplementedFunc), + /* 198 */ SyscallDesc("unused#198", unimplementedFunc), + /* 199 */ SyscallDesc("unused#199", unimplementedFunc), + /* 200 */ SyscallDesc("unused#200", unimplementedFunc), + /* 201 */ SyscallDesc("unused#201", unimplementedFunc), + /* 202 */ SyscallDesc("unused#202", unimplementedFunc), + /* 203 */ SyscallDesc("unused#203", unimplementedFunc), + /* 204 */ SyscallDesc("unused#204", unimplementedFunc), + /* 205 */ SyscallDesc("unused#205", unimplementedFunc), + /* 206 */ SyscallDesc("unused#206", unimplementedFunc), + /* 207 */ SyscallDesc("unused#207", unimplementedFunc), + /* 208 */ SyscallDesc("unused#208", unimplementedFunc), + /* 209 */ SyscallDesc("unused#209", unimplementedFunc), + /* 210 */ SyscallDesc("unused#210", unimplementedFunc), + /* 211 */ SyscallDesc("unused#211", unimplementedFunc), + /* 212 */ SyscallDesc("unused#212", unimplementedFunc), + /* 213 */ SyscallDesc("unused#213", unimplementedFunc), + /* 214 */ SyscallDesc("unused#214", unimplementedFunc), + /* 215 */ SyscallDesc("unused#215", unimplementedFunc), + /* 216 */ SyscallDesc("unused#216", unimplementedFunc), + /* 217 */ SyscallDesc("unused#217", unimplementedFunc), + /* 218 */ SyscallDesc("unused#218", unimplementedFunc), + /* 219 */ SyscallDesc("unused#219", unimplementedFunc), + /* 220 */ SyscallDesc("unused#220", unimplementedFunc), + /* 221 */ SyscallDesc("unused#221", unimplementedFunc), + /* 222 */ SyscallDesc("unused#222", unimplementedFunc), + /* 223 */ SyscallDesc("unused#223", unimplementedFunc), + /* 224 */ SyscallDesc("unused#224", unimplementedFunc), + /* 225 */ SyscallDesc("unused#225", unimplementedFunc), + /* 226 */ SyscallDesc("unused#226", unimplementedFunc), + /* 227 */ SyscallDesc("unused#227", unimplementedFunc), + /* 228 */ SyscallDesc("unused#228", unimplementedFunc), + /* 229 */ SyscallDesc("unused#229", unimplementedFunc), + /* 230 */ SyscallDesc("unused#230", unimplementedFunc), + /* 231 */ SyscallDesc("unused#231", unimplementedFunc), + /* 232 */ SyscallDesc("unused#232", unimplementedFunc), + /* 233 */ SyscallDesc("unused#233", unimplementedFunc), + /* 234 */ SyscallDesc("unused#234", unimplementedFunc), + /* 235 */ SyscallDesc("unused#235", unimplementedFunc), + /* 236 */ SyscallDesc("unused#236", unimplementedFunc), + /* 237 */ SyscallDesc("unused#237", unimplementedFunc), + /* 238 */ SyscallDesc("unused#238", unimplementedFunc), + /* 239 */ SyscallDesc("unused#239", unimplementedFunc), + /* 240 */ SyscallDesc("unused#240", unimplementedFunc), + /* 241 */ SyscallDesc("unused#241", unimplementedFunc), + /* 242 */ SyscallDesc("unused#242", unimplementedFunc), + /* 243 */ SyscallDesc("unused#243", unimplementedFunc), + /* 244 */ SyscallDesc("unused#244", unimplementedFunc), + /* 245 */ SyscallDesc("unused#245", unimplementedFunc), + /* 246 */ SyscallDesc("unused#246", unimplementedFunc), + /* 247 */ SyscallDesc("unused#247", unimplementedFunc), + /* 248 */ SyscallDesc("unused#248", unimplementedFunc), + /* 249 */ SyscallDesc("unused#249", unimplementedFunc), + /* 250 */ SyscallDesc("unused#250", unimplementedFunc), + /* 251 */ SyscallDesc("unused#251", unimplementedFunc), + /* 252 */ SyscallDesc("unused#252", unimplementedFunc), + /* 253 */ SyscallDesc("unused#253", unimplementedFunc), + /* 254 */ SyscallDesc("unused#254", unimplementedFunc), + /* 255 */ SyscallDesc("unused#255", unimplementedFunc), + /* 256 */ SyscallDesc("unused#256", unimplementedFunc), + /* 257 */ SyscallDesc("unused#257", unimplementedFunc), + /* 258 */ SyscallDesc("unused#258", unimplementedFunc), + /* 259 */ SyscallDesc("unused#259", unimplementedFunc), + /* 260 */ SyscallDesc("unused#260", unimplementedFunc), + /* 261 */ SyscallDesc("unused#261", unimplementedFunc), + /* 262 */ SyscallDesc("unused#262", unimplementedFunc), + /* 263 */ SyscallDesc("unused#263", unimplementedFunc), + /* 264 */ SyscallDesc("unused#264", unimplementedFunc), + /* 265 */ SyscallDesc("unused#265", unimplementedFunc), + /* 266 */ SyscallDesc("unused#266", unimplementedFunc), + /* 267 */ SyscallDesc("unused#267", unimplementedFunc), + /* 268 */ SyscallDesc("unused#268", unimplementedFunc), + /* 269 */ SyscallDesc("unused#269", unimplementedFunc), + /* 270 */ SyscallDesc("unused#270", unimplementedFunc), + /* 271 */ SyscallDesc("unused#271", unimplementedFunc), + /* 272 */ SyscallDesc("unused#272", unimplementedFunc), + /* 273 */ SyscallDesc("unused#273", unimplementedFunc), + /* 274 */ SyscallDesc("unused#274", unimplementedFunc), + /* 275 */ SyscallDesc("unused#275", unimplementedFunc), + /* 276 */ SyscallDesc("unused#276", unimplementedFunc), + /* 277 */ SyscallDesc("unused#277", unimplementedFunc), + /* 278 */ SyscallDesc("unused#278", unimplementedFunc), + /* 279 */ SyscallDesc("unused#279", unimplementedFunc), + /* 280 */ SyscallDesc("unused#280", unimplementedFunc), + /* 281 */ SyscallDesc("unused#281", unimplementedFunc), + /* 282 */ SyscallDesc("unused#282", unimplementedFunc), + /* 283 */ SyscallDesc("unused#283", unimplementedFunc), + /* 284 */ SyscallDesc("unused#284", unimplementedFunc), + /* 285 */ SyscallDesc("unused#285", unimplementedFunc), + /* 286 */ SyscallDesc("unused#286", unimplementedFunc), + /* 287 */ SyscallDesc("unused#287", unimplementedFunc), + /* 288 */ SyscallDesc("unused#288", unimplementedFunc), + /* 289 */ SyscallDesc("unused#289", unimplementedFunc), + /* 290 */ SyscallDesc("unused#290", unimplementedFunc), + /* 291 */ SyscallDesc("unused#291", unimplementedFunc), + /* 292 */ SyscallDesc("unused#292", unimplementedFunc), + /* 293 */ SyscallDesc("unused#293", unimplementedFunc), + /* 294 */ SyscallDesc("unused#294", unimplementedFunc), + /* 295 */ SyscallDesc("unused#295", unimplementedFunc), + /* 296 */ SyscallDesc("unused#296", unimplementedFunc), + /* 297 */ SyscallDesc("unused#297", unimplementedFunc), + /* 298 */ SyscallDesc("unused#298", unimplementedFunc), + /* 299 */ SyscallDesc("unused#299", unimplementedFunc), + /* 300 */ SyscallDesc("unused#300", unimplementedFunc), + /* 301 */ SyscallDesc("unused#301", unimplementedFunc), + /* 302 */ SyscallDesc("unused#302", unimplementedFunc), + /* 303 */ SyscallDesc("unused#303", unimplementedFunc), + /* 304 */ SyscallDesc("unused#304", unimplementedFunc), + /* 305 */ SyscallDesc("unused#305", unimplementedFunc), + /* 306 */ SyscallDesc("unused#306", unimplementedFunc), + /* 307 */ SyscallDesc("unused#307", unimplementedFunc), + /* 308 */ SyscallDesc("unused#308", unimplementedFunc), + /* 309 */ SyscallDesc("unused#309", unimplementedFunc), + /* 310 */ SyscallDesc("unused#310", unimplementedFunc), + /* 311 */ SyscallDesc("unused#311", unimplementedFunc), + /* 312 */ SyscallDesc("unused#312", unimplementedFunc), + /* 313 */ SyscallDesc("unused#313", unimplementedFunc), + /* 314 */ SyscallDesc("unused#314", unimplementedFunc), + /* 315 */ SyscallDesc("unused#315", unimplementedFunc), + /* 316 */ SyscallDesc("unused#316", unimplementedFunc), + /* 317 */ SyscallDesc("unused#317", unimplementedFunc), + /* 318 */ SyscallDesc("unused#318", unimplementedFunc), + /* 319 */ SyscallDesc("unused#319", unimplementedFunc), + /* 320 */ SyscallDesc("unused#320", unimplementedFunc), + /* 321 */ SyscallDesc("unused#321", unimplementedFunc), + /* 322 */ SyscallDesc("unused#322", unimplementedFunc), + /* 323 */ SyscallDesc("unused#323", unimplementedFunc), + /* 324 */ SyscallDesc("unused#324", unimplementedFunc), + /* 325 */ SyscallDesc("unused#325", unimplementedFunc), + /* 326 */ SyscallDesc("unused#326", unimplementedFunc), + /* 327 */ SyscallDesc("unused#327", unimplementedFunc), + /* 328 */ SyscallDesc("unused#328", unimplementedFunc), + /* 329 */ SyscallDesc("unused#329", unimplementedFunc), + /* 330 */ SyscallDesc("unused#330", unimplementedFunc), + /* 331 */ SyscallDesc("unused#331", unimplementedFunc), + /* 332 */ SyscallDesc("unused#332", unimplementedFunc), + /* 333 */ SyscallDesc("unused#333", unimplementedFunc), + /* 334 */ SyscallDesc("unused#334", unimplementedFunc), + /* 335 */ SyscallDesc("unused#335", unimplementedFunc), + /* 336 */ SyscallDesc("unused#336", unimplementedFunc), + /* 337 */ SyscallDesc("unused#337", unimplementedFunc), + /* 338 */ SyscallDesc("unused#338", unimplementedFunc), + /* 339 */ SyscallDesc("unused#339", unimplementedFunc), + /* 340 */ SyscallDesc("unused#340", unimplementedFunc), + /* 341 */ SyscallDesc("unused#341", unimplementedFunc), + /* 342 */ SyscallDesc("unused#342", unimplementedFunc), + /* 343 */ SyscallDesc("unused#343", unimplementedFunc), + /* 344 */ SyscallDesc("unused#344", unimplementedFunc), + /* 345 */ SyscallDesc("unused#345", unimplementedFunc), + /* 346 */ SyscallDesc("unused#346", unimplementedFunc), + /* 347 */ SyscallDesc("unused#347", unimplementedFunc), + /* 348 */ SyscallDesc("unused#348", unimplementedFunc), + /* 349 */ SyscallDesc("unused#349", unimplementedFunc), + /* 350 */ SyscallDesc("unused#350", unimplementedFunc), + /* 351 */ SyscallDesc("unused#351", unimplementedFunc), + /* 352 */ SyscallDesc("unused#352", unimplementedFunc), + /* 353 */ SyscallDesc("unused#353", unimplementedFunc), + /* 354 */ SyscallDesc("unused#354", unimplementedFunc), + /* 355 */ SyscallDesc("unused#355", unimplementedFunc), + /* 356 */ SyscallDesc("unused#356", unimplementedFunc), + /* 357 */ SyscallDesc("unused#357", unimplementedFunc), + /* 358 */ SyscallDesc("unused#358", unimplementedFunc), + /* 359 */ SyscallDesc("unused#359", unimplementedFunc), + /* 360 */ SyscallDesc("unused#360", unimplementedFunc), + /* 361 */ SyscallDesc("unused#361", unimplementedFunc), + /* 362 */ SyscallDesc("unused#362", unimplementedFunc), + /* 363 */ SyscallDesc("unused#363", unimplementedFunc), + /* 364 */ SyscallDesc("unused#364", unimplementedFunc), + /* 365 */ SyscallDesc("unused#365", unimplementedFunc), + /* 366 */ SyscallDesc("unused#366", unimplementedFunc), + /* 367 */ SyscallDesc("unused#367", unimplementedFunc), + /* 368 */ SyscallDesc("unused#368", unimplementedFunc), + /* 369 */ SyscallDesc("unused#369", unimplementedFunc), + /* 370 */ SyscallDesc("unused#370", unimplementedFunc), + /* 371 */ SyscallDesc("unused#371", unimplementedFunc), + /* 372 */ SyscallDesc("unused#372", unimplementedFunc), + /* 373 */ SyscallDesc("unused#373", unimplementedFunc), + /* 374 */ SyscallDesc("unused#374", unimplementedFunc), + /* 375 */ SyscallDesc("unused#375", unimplementedFunc), + /* 376 */ SyscallDesc("unused#376", unimplementedFunc), + /* 377 */ SyscallDesc("unused#377", unimplementedFunc), + /* 378 */ SyscallDesc("unused#378", unimplementedFunc), + /* 379 */ SyscallDesc("unused#379", unimplementedFunc), + /* 380 */ SyscallDesc("unused#380", unimplementedFunc), + /* 381 */ SyscallDesc("unused#381", unimplementedFunc), + /* 382 */ SyscallDesc("unused#382", unimplementedFunc), + /* 383 */ SyscallDesc("unused#383", unimplementedFunc), + /* 384 */ SyscallDesc("unused#384", unimplementedFunc), + /* 385 */ SyscallDesc("unused#385", unimplementedFunc), + /* 386 */ SyscallDesc("unused#386", unimplementedFunc), + /* 387 */ SyscallDesc("unused#387", unimplementedFunc), + /* 388 */ SyscallDesc("unused#388", unimplementedFunc), + /* 389 */ SyscallDesc("unused#389", unimplementedFunc), + /* 390 */ SyscallDesc("unused#390", unimplementedFunc), + /* 391 */ SyscallDesc("unused#391", unimplementedFunc), + /* 392 */ SyscallDesc("unused#392", unimplementedFunc), + /* 393 */ SyscallDesc("unused#393", unimplementedFunc), + /* 394 */ SyscallDesc("unused#394", unimplementedFunc), + /* 395 */ SyscallDesc("unused#395", unimplementedFunc), + /* 396 */ SyscallDesc("unused#396", unimplementedFunc), + /* 397 */ SyscallDesc("unused#397", unimplementedFunc), + /* 398 */ SyscallDesc("unused#398", unimplementedFunc), + /* 399 */ SyscallDesc("unused#399", unimplementedFunc), + /* 400 */ SyscallDesc("unused#400", unimplementedFunc), + /* 401 */ SyscallDesc("unused#401", unimplementedFunc), + /* 402 */ SyscallDesc("unused#402", unimplementedFunc), + /* 403 */ SyscallDesc("unused#403", unimplementedFunc), + /* 404 */ SyscallDesc("unused#404", unimplementedFunc), + /* 405 */ SyscallDesc("unused#405", unimplementedFunc), + /* 406 */ SyscallDesc("unused#406", unimplementedFunc), + /* 407 */ SyscallDesc("unused#407", unimplementedFunc), + /* 408 */ SyscallDesc("unused#408", unimplementedFunc), + /* 409 */ SyscallDesc("unused#409", unimplementedFunc), + /* 410 */ SyscallDesc("unused#410", unimplementedFunc), + /* 411 */ SyscallDesc("unused#411", unimplementedFunc), + /* 412 */ SyscallDesc("unused#412", unimplementedFunc), + /* 413 */ SyscallDesc("unused#413", unimplementedFunc), + /* 414 */ SyscallDesc("unused#414", unimplementedFunc), + /* 415 */ SyscallDesc("unused#415", unimplementedFunc), + /* 416 */ SyscallDesc("unused#416", unimplementedFunc), + /* 417 */ SyscallDesc("unused#417", unimplementedFunc), + /* 418 */ SyscallDesc("unused#418", unimplementedFunc), + /* 419 */ SyscallDesc("unused#419", unimplementedFunc), + /* 420 */ SyscallDesc("unused#420", unimplementedFunc), + /* 421 */ SyscallDesc("unused#421", unimplementedFunc), + /* 422 */ SyscallDesc("unused#422", unimplementedFunc), + /* 423 */ SyscallDesc("unused#423", unimplementedFunc), + /* 424 */ SyscallDesc("unused#424", unimplementedFunc), + /* 425 */ SyscallDesc("unused#425", unimplementedFunc), + /* 426 */ SyscallDesc("unused#426", unimplementedFunc), + /* 427 */ SyscallDesc("unused#427", unimplementedFunc), + /* 428 */ SyscallDesc("unused#428", unimplementedFunc), + /* 429 */ SyscallDesc("unused#429", unimplementedFunc), + /* 430 */ SyscallDesc("unused#430", unimplementedFunc), + /* 431 */ SyscallDesc("unused#431", unimplementedFunc), + /* 432 */ SyscallDesc("unused#432", unimplementedFunc), + /* 433 */ SyscallDesc("unused#433", unimplementedFunc), + /* 434 */ SyscallDesc("unused#434", unimplementedFunc), + /* 435 */ SyscallDesc("unused#435", unimplementedFunc), + /* 436 */ SyscallDesc("unused#436", unimplementedFunc), + /* 437 */ SyscallDesc("unused#437", unimplementedFunc), + /* 438 */ SyscallDesc("unused#438", unimplementedFunc), + /* 439 */ SyscallDesc("unused#439", unimplementedFunc), + /* 440 */ SyscallDesc("unused#440", unimplementedFunc), + /* 441 */ SyscallDesc("unused#441", unimplementedFunc), + /* 442 */ SyscallDesc("unused#442", unimplementedFunc), + /* 443 */ SyscallDesc("unused#443", unimplementedFunc), + /* 444 */ SyscallDesc("unused#444", unimplementedFunc), + /* 445 */ SyscallDesc("unused#445", unimplementedFunc), + /* 446 */ SyscallDesc("unused#446", unimplementedFunc), + /* 447 */ SyscallDesc("unused#447", unimplementedFunc), + /* 448 */ SyscallDesc("unused#448", unimplementedFunc), + /* 449 */ SyscallDesc("unused#449", unimplementedFunc), + /* 450 */ SyscallDesc("unused#450", unimplementedFunc), + /* 451 */ SyscallDesc("unused#451", unimplementedFunc), + /* 452 */ SyscallDesc("unused#452", unimplementedFunc), + /* 453 */ SyscallDesc("unused#453", unimplementedFunc), + /* 454 */ SyscallDesc("unused#454", unimplementedFunc), + /* 455 */ SyscallDesc("unused#455", unimplementedFunc), + /* 456 */ SyscallDesc("unused#456", unimplementedFunc), + /* 457 */ SyscallDesc("unused#457", unimplementedFunc), + /* 458 */ SyscallDesc("unused#458", unimplementedFunc), + /* 459 */ SyscallDesc("unused#459", unimplementedFunc), + /* 460 */ SyscallDesc("unused#460", unimplementedFunc), + /* 461 */ SyscallDesc("unused#461", unimplementedFunc), + /* 462 */ SyscallDesc("unused#462", unimplementedFunc), + /* 463 */ SyscallDesc("unused#463", unimplementedFunc), + /* 464 */ SyscallDesc("unused#464", unimplementedFunc), + /* 465 */ SyscallDesc("unused#465", unimplementedFunc), + /* 466 */ SyscallDesc("unused#466", unimplementedFunc), + /* 467 */ SyscallDesc("unused#467", unimplementedFunc), + /* 468 */ SyscallDesc("unused#468", unimplementedFunc), + /* 469 */ SyscallDesc("unused#469", unimplementedFunc), + /* 470 */ SyscallDesc("unused#470", unimplementedFunc), + /* 471 */ SyscallDesc("unused#471", unimplementedFunc), + /* 472 */ SyscallDesc("unused#472", unimplementedFunc), + /* 473 */ SyscallDesc("unused#473", unimplementedFunc), + /* 474 */ SyscallDesc("unused#474", unimplementedFunc), + /* 475 */ SyscallDesc("unused#475", unimplementedFunc), + /* 476 */ SyscallDesc("unused#476", unimplementedFunc), + /* 477 */ SyscallDesc("unused#477", unimplementedFunc), + /* 478 */ SyscallDesc("unused#478", unimplementedFunc), + /* 479 */ SyscallDesc("unused#479", unimplementedFunc), + /* 480 */ SyscallDesc("unused#480", unimplementedFunc), + /* 481 */ SyscallDesc("unused#481", unimplementedFunc), + /* 482 */ SyscallDesc("unused#482", unimplementedFunc), + /* 483 */ SyscallDesc("unused#483", unimplementedFunc), + /* 484 */ SyscallDesc("unused#484", unimplementedFunc), + /* 485 */ SyscallDesc("unused#485", unimplementedFunc), + /* 486 */ SyscallDesc("unused#486", unimplementedFunc), + /* 487 */ SyscallDesc("unused#487", unimplementedFunc), + /* 488 */ SyscallDesc("unused#488", unimplementedFunc), + /* 489 */ SyscallDesc("unused#489", unimplementedFunc), + /* 490 */ SyscallDesc("unused#490", unimplementedFunc), + /* 491 */ SyscallDesc("unused#491", unimplementedFunc), + /* 492 */ SyscallDesc("unused#492", unimplementedFunc), + /* 493 */ SyscallDesc("unused#493", unimplementedFunc), + /* 494 */ SyscallDesc("unused#494", unimplementedFunc), + /* 495 */ SyscallDesc("unused#495", unimplementedFunc), + /* 496 */ SyscallDesc("unused#496", unimplementedFunc), + /* 497 */ SyscallDesc("unused#497", unimplementedFunc), + /* 498 */ SyscallDesc("unused#498", unimplementedFunc), + /* 499 */ SyscallDesc("unused#499", unimplementedFunc), + /* 500 */ SyscallDesc("unused#500", unimplementedFunc), + /* 501 */ SyscallDesc("unused#501", unimplementedFunc), + /* 502 */ SyscallDesc("unused#502", unimplementedFunc), + /* 503 */ SyscallDesc("unused#503", unimplementedFunc), + /* 504 */ SyscallDesc("unused#504", unimplementedFunc), + /* 505 */ SyscallDesc("unused#505", unimplementedFunc), + /* 506 */ SyscallDesc("unused#506", unimplementedFunc), + /* 507 */ SyscallDesc("unused#507", unimplementedFunc), + /* 508 */ SyscallDesc("unused#508", unimplementedFunc), + /* 509 */ SyscallDesc("unused#509", unimplementedFunc), + /* 510 */ SyscallDesc("unused#510", unimplementedFunc), + /* 511 */ SyscallDesc("unused#511", unimplementedFunc), + /* 512 */ SyscallDesc("unused#512", unimplementedFunc), + /* 513 */ SyscallDesc("unused#513", unimplementedFunc), + /* 514 */ SyscallDesc("unused#514", unimplementedFunc), + /* 515 */ SyscallDesc("unused#515", unimplementedFunc), + /* 516 */ SyscallDesc("unused#516", unimplementedFunc), + /* 517 */ SyscallDesc("unused#517", unimplementedFunc), + /* 518 */ SyscallDesc("unused#518", unimplementedFunc), + /* 519 */ SyscallDesc("unused#519", unimplementedFunc), + /* 520 */ SyscallDesc("unused#520", unimplementedFunc), + /* 521 */ SyscallDesc("unused#521", unimplementedFunc), + /* 522 */ SyscallDesc("unused#522", unimplementedFunc), + /* 523 */ SyscallDesc("unused#523", unimplementedFunc), + /* 524 */ SyscallDesc("unused#524", unimplementedFunc), + /* 525 */ SyscallDesc("unused#525", unimplementedFunc), + /* 526 */ SyscallDesc("unused#526", unimplementedFunc), + /* 527 */ SyscallDesc("unused#527", unimplementedFunc), + /* 528 */ SyscallDesc("unused#528", unimplementedFunc), + /* 529 */ SyscallDesc("unused#529", unimplementedFunc), + /* 530 */ SyscallDesc("unused#530", unimplementedFunc), + /* 531 */ SyscallDesc("unused#531", unimplementedFunc), + /* 532 */ SyscallDesc("unused#532", unimplementedFunc), + /* 533 */ SyscallDesc("unused#533", unimplementedFunc), + /* 534 */ SyscallDesc("unused#534", unimplementedFunc), + /* 535 */ SyscallDesc("unused#535", unimplementedFunc), + /* 536 */ SyscallDesc("unused#536", unimplementedFunc), + /* 537 */ SyscallDesc("unused#537", unimplementedFunc), + /* 538 */ SyscallDesc("unused#538", unimplementedFunc), + /* 539 */ SyscallDesc("unused#539", unimplementedFunc), + /* 540 */ SyscallDesc("unused#540", unimplementedFunc), + /* 541 */ SyscallDesc("unused#541", unimplementedFunc), + /* 542 */ SyscallDesc("unused#542", unimplementedFunc), + /* 543 */ SyscallDesc("unused#543", unimplementedFunc), + /* 544 */ SyscallDesc("unused#544", unimplementedFunc), + /* 545 */ SyscallDesc("unused#545", unimplementedFunc), + /* 546 */ SyscallDesc("unused#546", unimplementedFunc), + /* 547 */ SyscallDesc("unused#547", unimplementedFunc), +}; + +static SyscallDesc syscallDescs64[] = { + /* 0 */ SyscallDesc("unused#000", unimplementedFunc), + /* 1 */ SyscallDesc("exit", exitFunc), + /* 2 */ SyscallDesc("unused#002", unimplementedFunc), + /* 3 */ SyscallDesc("read", readFunc), + /* 4 */ SyscallDesc("write", writeFunc), + /* 5 */ SyscallDesc("unused#005", unimplementedFunc), + /* 6 */ SyscallDesc("unused#006", unimplementedFunc), + /* 7 */ SyscallDesc("unused#007", unimplementedFunc), + /* 8 */ SyscallDesc("unused#008", unimplementedFunc), + /* 9 */ SyscallDesc("unused#009", unimplementedFunc), + /* 10 */ SyscallDesc("unused#010", unimplementedFunc), + /* 11 */ SyscallDesc("unused#011", unimplementedFunc), + /* 12 */ SyscallDesc("unused#012", unimplementedFunc), + /* 13 */ SyscallDesc("unused#013", unimplementedFunc), + /* 14 */ SyscallDesc("unused#014", unimplementedFunc), + /* 15 */ SyscallDesc("unused#015", unimplementedFunc), + /* 16 */ SyscallDesc("unused#016", unimplementedFunc), + /* 17 */ SyscallDesc("obreak", brkFunc), + /* 18 */ SyscallDesc("unused#018", unimplementedFunc), + /* 19 */ SyscallDesc("unused#019", unimplementedFunc), + /* 20 */ SyscallDesc("unused#020", unimplementedFunc), + /* 21 */ SyscallDesc("unused#021", unimplementedFunc), + /* 22 */ SyscallDesc("unused#022", unimplementedFunc), + /* 23 */ SyscallDesc("unused#023", unimplementedFunc), + /* 24 */ SyscallDesc("unused#024", unimplementedFunc), + /* 25 */ SyscallDesc("unused#025", unimplementedFunc), + /* 26 */ SyscallDesc("unused#026", unimplementedFunc), + /* 27 */ SyscallDesc("unused#027", unimplementedFunc), + /* 28 */ SyscallDesc("unused#028", unimplementedFunc), + /* 29 */ SyscallDesc("unused#029", unimplementedFunc), + /* 30 */ SyscallDesc("unused#030", unimplementedFunc), + /* 31 */ SyscallDesc("unused#031", unimplementedFunc), + /* 32 */ SyscallDesc("unused#032", unimplementedFunc), + /* 33 */ SyscallDesc("unused#033", unimplementedFunc), + /* 34 */ SyscallDesc("unused#034", unimplementedFunc), + /* 35 */ SyscallDesc("unused#035", unimplementedFunc), + /* 36 */ SyscallDesc("unused#036", unimplementedFunc), + /* 37 */ SyscallDesc("unused#037", unimplementedFunc), + /* 38 */ SyscallDesc("unused#038", unimplementedFunc), + /* 39 */ SyscallDesc("unused#039", unimplementedFunc), + /* 40 */ SyscallDesc("unused#040", unimplementedFunc), + /* 41 */ SyscallDesc("unused#041", unimplementedFunc), + /* 42 */ SyscallDesc("unused#042", unimplementedFunc), + /* 43 */ SyscallDesc("unused#043", unimplementedFunc), + /* 44 */ SyscallDesc("unused#044", unimplementedFunc), + /* 45 */ SyscallDesc("unused#045", unimplementedFunc), + /* 46 */ SyscallDesc("unused#046", unimplementedFunc), + /* 47 */ SyscallDesc("unused#047", unimplementedFunc), + /* 48 */ SyscallDesc("unused#048", unimplementedFunc), + /* 49 */ SyscallDesc("unused#049", unimplementedFunc), + /* 50 */ SyscallDesc("unused#050", unimplementedFunc), + /* 51 */ SyscallDesc("unused#051", unimplementedFunc), + /* 52 */ SyscallDesc("unused#052", unimplementedFunc), + /* 53 */ SyscallDesc("unused#053", unimplementedFunc), + /* 54 */ SyscallDesc("ioctl", ioctlFunc<ArmFreebsd64>), + /* 55 */ SyscallDesc("unused#055", unimplementedFunc), + /* 56 */ SyscallDesc("unused#056", unimplementedFunc), + /* 57 */ SyscallDesc("unused#057", unimplementedFunc), + /* 58 */ SyscallDesc("readlink", readlinkFunc), + /* 59 */ SyscallDesc("unused#059", unimplementedFunc), + /* 60 */ SyscallDesc("unused#060", unimplementedFunc), + /* 61 */ SyscallDesc("unused#061", unimplementedFunc), + /* 62 */ SyscallDesc("unused#062", unimplementedFunc), + /* 63 */ SyscallDesc("unused#063", unimplementedFunc), + /* 64 */ SyscallDesc("unused#064", unimplementedFunc), + /* 65 */ SyscallDesc("unused#065", unimplementedFunc), + /* 66 */ SyscallDesc("unused#066", unimplementedFunc), + /* 67 */ SyscallDesc("unused#067", unimplementedFunc), + /* 68 */ SyscallDesc("unused#068", unimplementedFunc), + /* 69 */ SyscallDesc("unused#069", unimplementedFunc), + /* 70 */ SyscallDesc("unused#070", unimplementedFunc), + /* 71 */ SyscallDesc("unused#071", unimplementedFunc), + /* 72 */ SyscallDesc("unused#072", unimplementedFunc), + /* 73 */ SyscallDesc("unused#073", unimplementedFunc), + /* 74 */ SyscallDesc("unused#074", unimplementedFunc), + /* 75 */ SyscallDesc("unused#075", unimplementedFunc), + /* 76 */ SyscallDesc("unused#076", unimplementedFunc), + /* 77 */ SyscallDesc("unused#077", unimplementedFunc), + /* 78 */ SyscallDesc("unused#078", unimplementedFunc), + /* 79 */ SyscallDesc("unused#079", unimplementedFunc), + /* 80 */ SyscallDesc("unused#080", unimplementedFunc), + /* 81 */ SyscallDesc("unused#081", unimplementedFunc), + /* 82 */ SyscallDesc("unused#082", unimplementedFunc), + /* 83 */ SyscallDesc("unused#083", unimplementedFunc), + /* 84 */ SyscallDesc("unused#084", unimplementedFunc), + /* 85 */ SyscallDesc("unused#085", unimplementedFunc), + /* 86 */ SyscallDesc("unused#086", unimplementedFunc), + /* 87 */ SyscallDesc("unused#087", unimplementedFunc), + /* 88 */ SyscallDesc("unused#088", unimplementedFunc), + /* 89 */ SyscallDesc("unused#089", unimplementedFunc), + /* 90 */ SyscallDesc("unused#090", unimplementedFunc), + /* 91 */ SyscallDesc("unused#091", unimplementedFunc), + /* 92 */ SyscallDesc("unused#092", unimplementedFunc), + /* 93 */ SyscallDesc("unused#093", unimplementedFunc), + /* 94 */ SyscallDesc("unused#094", unimplementedFunc), + /* 95 */ SyscallDesc("unused#095", unimplementedFunc), + /* 96 */ SyscallDesc("unused#096", unimplementedFunc), + /* 97 */ SyscallDesc("unused#097", unimplementedFunc), + /* 98 */ SyscallDesc("unused#098", unimplementedFunc), + /* 99 */ SyscallDesc("unused#099", unimplementedFunc), + /* 100 */ SyscallDesc("unused#100", unimplementedFunc), + /* 101 */ SyscallDesc("unused#101", unimplementedFunc), + /* 102 */ SyscallDesc("unused#102", unimplementedFunc), + /* 103 */ SyscallDesc("unused#103", unimplementedFunc), + /* 104 */ SyscallDesc("unused#104", unimplementedFunc), + /* 105 */ SyscallDesc("unused#105", unimplementedFunc), + /* 106 */ SyscallDesc("unused#106", unimplementedFunc), + /* 107 */ SyscallDesc("unused#107", unimplementedFunc), + /* 108 */ SyscallDesc("unused#108", unimplementedFunc), + /* 109 */ SyscallDesc("unused#109", unimplementedFunc), + /* 110 */ SyscallDesc("unused#110", unimplementedFunc), + /* 111 */ SyscallDesc("unused#111", unimplementedFunc), + /* 112 */ SyscallDesc("unused#112", unimplementedFunc), + /* 113 */ SyscallDesc("unused#113", unimplementedFunc), + /* 114 */ SyscallDesc("unused#114", unimplementedFunc), + /* 115 */ SyscallDesc("unused#115", unimplementedFunc), + /* 116 */ SyscallDesc("unused#116", unimplementedFunc), + /* 117 */ SyscallDesc("getrusage", getrusageFunc<ArmFreebsd64>), + /* 118 */ SyscallDesc("unused#118", unimplementedFunc), + /* 119 */ SyscallDesc("unused#119", unimplementedFunc), + /* 120 */ SyscallDesc("unused#120", unimplementedFunc), + /* 121 */ SyscallDesc("unused#121", unimplementedFunc), + /* 122 */ SyscallDesc("unused#122", unimplementedFunc), + /* 123 */ SyscallDesc("unused#123", unimplementedFunc), + /* 124 */ SyscallDesc("unused#124", unimplementedFunc), + /* 125 */ SyscallDesc("unused#125", unimplementedFunc), + /* 126 */ SyscallDesc("unused#126", unimplementedFunc), + /* 127 */ SyscallDesc("unused#127", unimplementedFunc), + /* 128 */ SyscallDesc("unused#128", unimplementedFunc), + /* 129 */ SyscallDesc("unused#129", unimplementedFunc), + /* 130 */ SyscallDesc("unused#130", unimplementedFunc), + /* 131 */ SyscallDesc("unused#131", unimplementedFunc), + /* 132 */ SyscallDesc("unused#132", unimplementedFunc), + /* 133 */ SyscallDesc("unused#133", unimplementedFunc), + /* 134 */ SyscallDesc("unused#134", unimplementedFunc), + /* 135 */ SyscallDesc("unused#135", unimplementedFunc), + /* 136 */ SyscallDesc("unused#136", unimplementedFunc), + /* 137 */ SyscallDesc("unused#137", unimplementedFunc), + /* 138 */ SyscallDesc("unused#138", unimplementedFunc), + /* 139 */ SyscallDesc("unused#139", unimplementedFunc), + /* 140 */ SyscallDesc("unused#140", unimplementedFunc), + /* 141 */ SyscallDesc("unused#141", unimplementedFunc), + /* 142 */ SyscallDesc("unused#142", unimplementedFunc), + /* 143 */ SyscallDesc("unused#143", unimplementedFunc), + /* 144 */ SyscallDesc("unused#144", unimplementedFunc), + /* 145 */ SyscallDesc("unused#145", unimplementedFunc), + /* 146 */ SyscallDesc("unused#146", unimplementedFunc), + /* 147 */ SyscallDesc("unused#147", unimplementedFunc), + /* 148 */ SyscallDesc("unused#148", unimplementedFunc), + /* 149 */ SyscallDesc("unused#149", unimplementedFunc), + /* 150 */ SyscallDesc("unused#150", unimplementedFunc), + /* 151 */ SyscallDesc("unused#151", unimplementedFunc), + /* 152 */ SyscallDesc("unused#152", unimplementedFunc), + /* 153 */ SyscallDesc("unused#153", unimplementedFunc), + /* 154 */ SyscallDesc("unused#154", unimplementedFunc), + /* 155 */ SyscallDesc("unused#155", unimplementedFunc), + /* 156 */ SyscallDesc("unused#156", unimplementedFunc), + /* 157 */ SyscallDesc("unused#157", unimplementedFunc), + /* 158 */ SyscallDesc("unused#158", unimplementedFunc), + /* 159 */ SyscallDesc("unused#159", unimplementedFunc), + /* 160 */ SyscallDesc("unused#160", unimplementedFunc), + /* 161 */ SyscallDesc("unused#161", unimplementedFunc), + /* 162 */ SyscallDesc("unused#162", unimplementedFunc), + /* 163 */ SyscallDesc("unused#163", unimplementedFunc), + /* 164 */ SyscallDesc("unused#164", unimplementedFunc), + /* 165 */ SyscallDesc("unused#165", unimplementedFunc), + /* 166 */ SyscallDesc("unused#166", unimplementedFunc), + /* 167 */ SyscallDesc("unused#167", unimplementedFunc), + /* 168 */ SyscallDesc("unused#168", unimplementedFunc), + /* 169 */ SyscallDesc("unused#169", unimplementedFunc), + /* 170 */ SyscallDesc("unused#170", unimplementedFunc), + /* 171 */ SyscallDesc("unused#171", unimplementedFunc), + /* 172 */ SyscallDesc("unused#172", unimplementedFunc), + /* 173 */ SyscallDesc("unused#173", unimplementedFunc), + /* 174 */ SyscallDesc("unused#174", unimplementedFunc), + /* 175 */ SyscallDesc("unused#175", unimplementedFunc), + /* 176 */ SyscallDesc("unused#176", unimplementedFunc), + /* 177 */ SyscallDesc("unused#177", unimplementedFunc), + /* 178 */ SyscallDesc("unused#178", unimplementedFunc), + /* 179 */ SyscallDesc("unused#179", unimplementedFunc), + /* 180 */ SyscallDesc("unused#180", unimplementedFunc), + /* 181 */ SyscallDesc("unused#181", unimplementedFunc), + /* 182 */ SyscallDesc("unused#182", unimplementedFunc), + /* 183 */ SyscallDesc("unused#183", unimplementedFunc), + /* 184 */ SyscallDesc("unused#184", unimplementedFunc), + /* 185 */ SyscallDesc("unused#185", unimplementedFunc), + /* 186 */ SyscallDesc("unused#186", unimplementedFunc), + /* 187 */ SyscallDesc("unused#187", unimplementedFunc), + /* 188 */ SyscallDesc("unused#188", unimplementedFunc), + /* 189 */ SyscallDesc("fstat", fstatFunc<ArmFreebsd64>), + /* 190 */ SyscallDesc("unused#190", unimplementedFunc), + /* 191 */ SyscallDesc("unused#191", unimplementedFunc), + /* 192 */ SyscallDesc("unused#192", unimplementedFunc), + /* 193 */ SyscallDesc("unused#193", unimplementedFunc), + /* 194 */ SyscallDesc("unused#194", unimplementedFunc), + /* 195 */ SyscallDesc("unused#195", unimplementedFunc), + /* 196 */ SyscallDesc("unused#196", unimplementedFunc), + /* 197 */ SyscallDesc("unused#197", unimplementedFunc), + /* 198 */ SyscallDesc("unused#198", unimplementedFunc), + /* 199 */ SyscallDesc("unused#199", unimplementedFunc), + /* 200 */ SyscallDesc("unused#200", unimplementedFunc), + /* 201 */ SyscallDesc("unused#201", unimplementedFunc), + /* 202 */ SyscallDesc("sysctl", sysctlFunc), + /* 203 */ SyscallDesc("unused#203", unimplementedFunc), + /* 204 */ SyscallDesc("unused#204", unimplementedFunc), + /* 205 */ SyscallDesc("unused#205", unimplementedFunc), + /* 206 */ SyscallDesc("unused#206", unimplementedFunc), + /* 207 */ SyscallDesc("unused#207", unimplementedFunc), + /* 208 */ SyscallDesc("unused#208", unimplementedFunc), + /* 209 */ SyscallDesc("unused#209", unimplementedFunc), + /* 210 */ SyscallDesc("unused#210", unimplementedFunc), + /* 211 */ SyscallDesc("unused#211", unimplementedFunc), + /* 212 */ SyscallDesc("unused#212", unimplementedFunc), + /* 213 */ SyscallDesc("unused#213", unimplementedFunc), + /* 214 */ SyscallDesc("unused#214", unimplementedFunc), + /* 215 */ SyscallDesc("unused#215", unimplementedFunc), + /* 216 */ SyscallDesc("unused#216", unimplementedFunc), + /* 217 */ SyscallDesc("unused#217", unimplementedFunc), + /* 218 */ SyscallDesc("unused#218", unimplementedFunc), + /* 219 */ SyscallDesc("unused#219", unimplementedFunc), + /* 220 */ SyscallDesc("unused#220", unimplementedFunc), + /* 221 */ SyscallDesc("unused#221", unimplementedFunc), + /* 222 */ SyscallDesc("unused#222", unimplementedFunc), + /* 223 */ SyscallDesc("unused#223", unimplementedFunc), + /* 224 */ SyscallDesc("unused#224", unimplementedFunc), + /* 225 */ SyscallDesc("unused#225", unimplementedFunc), + /* 226 */ SyscallDesc("unused#226", unimplementedFunc), + /* 227 */ SyscallDesc("unused#227", unimplementedFunc), + /* 228 */ SyscallDesc("unused#228", unimplementedFunc), + /* 229 */ SyscallDesc("unused#229", unimplementedFunc), + /* 230 */ SyscallDesc("unused#230", unimplementedFunc), + /* 231 */ SyscallDesc("unused#231", unimplementedFunc), + /* 232 */ SyscallDesc("unused#232", unimplementedFunc), + /* 233 */ SyscallDesc("unused#233", unimplementedFunc), + /* 234 */ SyscallDesc("unused#234", unimplementedFunc), + /* 235 */ SyscallDesc("unused#235", unimplementedFunc), + /* 236 */ SyscallDesc("unused#236", unimplementedFunc), + /* 237 */ SyscallDesc("unused#237", unimplementedFunc), + /* 238 */ SyscallDesc("unused#238", unimplementedFunc), + /* 239 */ SyscallDesc("unused#239", unimplementedFunc), + /* 240 */ SyscallDesc("unused#240", unimplementedFunc), + /* 241 */ SyscallDesc("unused#241", unimplementedFunc), + /* 242 */ SyscallDesc("unused#242", unimplementedFunc), + /* 243 */ SyscallDesc("unused#243", unimplementedFunc), + /* 244 */ SyscallDesc("unused#244", unimplementedFunc), + /* 245 */ SyscallDesc("unused#245", unimplementedFunc), + /* 246 */ SyscallDesc("unused#246", unimplementedFunc), + /* 247 */ SyscallDesc("unused#247", unimplementedFunc), + /* 248 */ SyscallDesc("unused#248", unimplementedFunc), + /* 249 */ SyscallDesc("unused#249", unimplementedFunc), + /* 250 */ SyscallDesc("unused#250", unimplementedFunc), + /* 251 */ SyscallDesc("unused#251", unimplementedFunc), + /* 252 */ SyscallDesc("unused#252", unimplementedFunc), + /* 253 */ SyscallDesc("issetugid", issetugidFunc), + /* 254 */ SyscallDesc("unused#254", unimplementedFunc), + /* 255 */ SyscallDesc("unused#255", unimplementedFunc), + /* 256 */ SyscallDesc("unused#256", unimplementedFunc), + /* 257 */ SyscallDesc("unused#257", unimplementedFunc), + /* 258 */ SyscallDesc("unused#258", unimplementedFunc), + /* 259 */ SyscallDesc("unused#259", unimplementedFunc), + /* 260 */ SyscallDesc("unused#260", unimplementedFunc), + /* 261 */ SyscallDesc("unused#261", unimplementedFunc), + /* 262 */ SyscallDesc("unused#262", unimplementedFunc), + /* 263 */ SyscallDesc("unused#263", unimplementedFunc), + /* 264 */ SyscallDesc("unused#264", unimplementedFunc), + /* 265 */ SyscallDesc("unused#265", unimplementedFunc), + /* 266 */ SyscallDesc("unused#266", unimplementedFunc), + /* 267 */ SyscallDesc("unused#267", unimplementedFunc), + /* 268 */ SyscallDesc("unused#268", unimplementedFunc), + /* 269 */ SyscallDesc("unused#269", unimplementedFunc), + /* 270 */ SyscallDesc("unused#270", unimplementedFunc), + /* 271 */ SyscallDesc("unused#271", unimplementedFunc), + /* 272 */ SyscallDesc("unused#272", unimplementedFunc), + /* 273 */ SyscallDesc("unused#273", unimplementedFunc), + /* 274 */ SyscallDesc("unused#274", unimplementedFunc), + /* 275 */ SyscallDesc("unused#275", unimplementedFunc), + /* 276 */ SyscallDesc("unused#276", unimplementedFunc), + /* 277 */ SyscallDesc("unused#277", unimplementedFunc), + /* 278 */ SyscallDesc("unused#278", unimplementedFunc), + /* 279 */ SyscallDesc("unused#279", unimplementedFunc), + /* 280 */ SyscallDesc("unused#280", unimplementedFunc), + /* 281 */ SyscallDesc("unused#281", unimplementedFunc), + /* 282 */ SyscallDesc("unused#282", unimplementedFunc), + /* 283 */ SyscallDesc("unused#283", unimplementedFunc), + /* 284 */ SyscallDesc("unused#284", unimplementedFunc), + /* 285 */ SyscallDesc("unused#285", unimplementedFunc), + /* 286 */ SyscallDesc("unused#286", unimplementedFunc), + /* 287 */ SyscallDesc("unused#287", unimplementedFunc), + /* 288 */ SyscallDesc("unused#288", unimplementedFunc), + /* 289 */ SyscallDesc("unused#289", unimplementedFunc), + /* 290 */ SyscallDesc("unused#290", unimplementedFunc), + /* 291 */ SyscallDesc("unused#291", unimplementedFunc), + /* 292 */ SyscallDesc("unused#292", unimplementedFunc), + /* 293 */ SyscallDesc("unused#293", unimplementedFunc), + /* 294 */ SyscallDesc("unused#294", unimplementedFunc), + /* 295 */ SyscallDesc("unused#295", unimplementedFunc), + /* 296 */ SyscallDesc("unused#296", unimplementedFunc), + /* 297 */ SyscallDesc("unused#297", unimplementedFunc), + /* 298 */ SyscallDesc("unused#298", unimplementedFunc), + /* 299 */ SyscallDesc("unused#299", unimplementedFunc), + /* 300 */ SyscallDesc("unused#300", unimplementedFunc), + /* 301 */ SyscallDesc("unused#301", unimplementedFunc), + /* 302 */ SyscallDesc("unused#302", unimplementedFunc), + /* 303 */ SyscallDesc("unused#303", unimplementedFunc), + /* 304 */ SyscallDesc("unused#304", unimplementedFunc), + /* 305 */ SyscallDesc("unused#305", unimplementedFunc), + /* 306 */ SyscallDesc("unused#306", unimplementedFunc), + /* 307 */ SyscallDesc("unused#307", unimplementedFunc), + /* 308 */ SyscallDesc("unused#308", unimplementedFunc), + /* 309 */ SyscallDesc("unused#309", unimplementedFunc), + /* 310 */ SyscallDesc("unused#310", unimplementedFunc), + /* 311 */ SyscallDesc("unused#311", unimplementedFunc), + /* 312 */ SyscallDesc("unused#312", unimplementedFunc), + /* 313 */ SyscallDesc("unused#313", unimplementedFunc), + /* 314 */ SyscallDesc("unused#314", unimplementedFunc), + /* 315 */ SyscallDesc("unused#315", unimplementedFunc), + /* 316 */ SyscallDesc("unused#316", unimplementedFunc), + /* 317 */ SyscallDesc("unused#317", unimplementedFunc), + /* 318 */ SyscallDesc("unused#318", unimplementedFunc), + /* 319 */ SyscallDesc("unused#319", unimplementedFunc), + /* 320 */ SyscallDesc("unused#320", unimplementedFunc), + /* 321 */ SyscallDesc("unused#321", unimplementedFunc), + /* 322 */ SyscallDesc("unused#322", unimplementedFunc), + /* 323 */ SyscallDesc("unused#323", unimplementedFunc), + /* 324 */ SyscallDesc("unused#324", unimplementedFunc), + /* 325 */ SyscallDesc("unused#325", unimplementedFunc), + /* 326 */ SyscallDesc("unused#326", unimplementedFunc), + /* 327 */ SyscallDesc("unused#327", unimplementedFunc), + /* 328 */ SyscallDesc("unused#328", unimplementedFunc), + /* 329 */ SyscallDesc("unused#329", unimplementedFunc), + /* 330 */ SyscallDesc("unused#330", unimplementedFunc), + /* 331 */ SyscallDesc("unused#331", unimplementedFunc), + /* 332 */ SyscallDesc("unused#332", unimplementedFunc), + /* 333 */ SyscallDesc("unused#333", unimplementedFunc), + /* 334 */ SyscallDesc("unused#334", unimplementedFunc), + /* 335 */ SyscallDesc("unused#335", unimplementedFunc), + /* 336 */ SyscallDesc("unused#336", unimplementedFunc), + /* 337 */ SyscallDesc("unused#337", unimplementedFunc), + /* 338 */ SyscallDesc("unused#338", unimplementedFunc), + /* 339 */ SyscallDesc("unused#339", unimplementedFunc), + /* 340 */ SyscallDesc("unused#340", unimplementedFunc), + /* 341 */ SyscallDesc("unused#341", unimplementedFunc), + /* 342 */ SyscallDesc("unused#342", unimplementedFunc), + /* 343 */ SyscallDesc("unused#343", unimplementedFunc), + /* 344 */ SyscallDesc("unused#344", unimplementedFunc), + /* 345 */ SyscallDesc("unused#345", unimplementedFunc), + /* 346 */ SyscallDesc("unused#346", unimplementedFunc), + /* 347 */ SyscallDesc("unused#347", unimplementedFunc), + /* 348 */ SyscallDesc("unused#348", unimplementedFunc), + /* 349 */ SyscallDesc("unused#349", unimplementedFunc), + /* 350 */ SyscallDesc("unused#350", unimplementedFunc), + /* 351 */ SyscallDesc("unused#351", unimplementedFunc), + /* 352 */ SyscallDesc("unused#352", unimplementedFunc), + /* 353 */ SyscallDesc("unused#353", unimplementedFunc), + /* 354 */ SyscallDesc("unused#354", unimplementedFunc), + /* 355 */ SyscallDesc("unused#355", unimplementedFunc), + /* 356 */ SyscallDesc("unused#356", unimplementedFunc), + /* 357 */ SyscallDesc("unused#357", unimplementedFunc), + /* 358 */ SyscallDesc("unused#358", unimplementedFunc), + /* 359 */ SyscallDesc("unused#359", unimplementedFunc), + /* 360 */ SyscallDesc("unused#360", unimplementedFunc), + /* 361 */ SyscallDesc("unused#361", unimplementedFunc), + /* 362 */ SyscallDesc("unused#362", unimplementedFunc), + /* 363 */ SyscallDesc("unused#363", unimplementedFunc), + /* 364 */ SyscallDesc("unused#364", unimplementedFunc), + /* 365 */ SyscallDesc("unused#365", unimplementedFunc), + /* 366 */ SyscallDesc("unused#366", unimplementedFunc), + /* 367 */ SyscallDesc("unused#367", unimplementedFunc), + /* 368 */ SyscallDesc("unused#368", unimplementedFunc), + /* 369 */ SyscallDesc("unused#369", unimplementedFunc), + /* 370 */ SyscallDesc("unused#370", unimplementedFunc), + /* 371 */ SyscallDesc("unused#371", unimplementedFunc), + /* 372 */ SyscallDesc("unused#372", unimplementedFunc), + /* 373 */ SyscallDesc("unused#373", unimplementedFunc), + /* 374 */ SyscallDesc("unused#374", unimplementedFunc), + /* 375 */ SyscallDesc("unused#375", unimplementedFunc), + /* 376 */ SyscallDesc("unused#376", unimplementedFunc), + /* 377 */ SyscallDesc("unused#377", unimplementedFunc), + /* 378 */ SyscallDesc("unused#378", unimplementedFunc), + /* 379 */ SyscallDesc("unused#379", unimplementedFunc), + /* 380 */ SyscallDesc("unused#380", unimplementedFunc), + /* 381 */ SyscallDesc("unused#381", unimplementedFunc), + /* 382 */ SyscallDesc("unused#382", unimplementedFunc), + /* 383 */ SyscallDesc("unused#383", unimplementedFunc), + /* 384 */ SyscallDesc("unused#384", unimplementedFunc), + /* 385 */ SyscallDesc("unused#385", unimplementedFunc), + /* 386 */ SyscallDesc("unused#386", unimplementedFunc), + /* 387 */ SyscallDesc("unused#387", unimplementedFunc), + /* 388 */ SyscallDesc("unused#388", unimplementedFunc), + /* 389 */ SyscallDesc("unused#389", unimplementedFunc), + /* 390 */ SyscallDesc("unused#390", unimplementedFunc), + /* 391 */ SyscallDesc("unused#391", unimplementedFunc), + /* 392 */ SyscallDesc("unused#392", unimplementedFunc), + /* 393 */ SyscallDesc("unused#393", unimplementedFunc), + /* 394 */ SyscallDesc("unused#394", unimplementedFunc), + /* 395 */ SyscallDesc("unused#395", unimplementedFunc), + /* 396 */ SyscallDesc("unused#396", unimplementedFunc), + /* 397 */ SyscallDesc("unused#397", unimplementedFunc), + /* 398 */ SyscallDesc("unused#398", unimplementedFunc), + /* 399 */ SyscallDesc("unused#399", unimplementedFunc), + /* 400 */ SyscallDesc("unused#400", unimplementedFunc), + /* 401 */ SyscallDesc("unused#401", unimplementedFunc), + /* 402 */ SyscallDesc("unused#402", unimplementedFunc), + /* 403 */ SyscallDesc("unused#403", unimplementedFunc), + /* 404 */ SyscallDesc("unused#404", unimplementedFunc), + /* 405 */ SyscallDesc("unused#405", unimplementedFunc), + /* 406 */ SyscallDesc("unused#406", unimplementedFunc), + /* 407 */ SyscallDesc("unused#407", unimplementedFunc), + /* 408 */ SyscallDesc("unused#408", unimplementedFunc), + /* 409 */ SyscallDesc("unused#409", unimplementedFunc), + /* 410 */ SyscallDesc("unused#410", unimplementedFunc), + /* 411 */ SyscallDesc("unused#411", unimplementedFunc), + /* 412 */ SyscallDesc("unused#412", unimplementedFunc), + /* 413 */ SyscallDesc("unused#413", unimplementedFunc), + /* 414 */ SyscallDesc("unused#414", unimplementedFunc), + /* 415 */ SyscallDesc("unused#415", unimplementedFunc), + /* 416 */ SyscallDesc("unused#416", unimplementedFunc), + /* 417 */ SyscallDesc("unused#417", unimplementedFunc), + /* 418 */ SyscallDesc("unused#418", unimplementedFunc), + /* 419 */ SyscallDesc("unused#419", unimplementedFunc), + /* 420 */ SyscallDesc("unused#420", unimplementedFunc), + /* 421 */ SyscallDesc("unused#421", unimplementedFunc), + /* 422 */ SyscallDesc("unused#422", unimplementedFunc), + /* 423 */ SyscallDesc("unused#423", unimplementedFunc), + /* 424 */ SyscallDesc("unused#424", unimplementedFunc), + /* 425 */ SyscallDesc("unused#425", unimplementedFunc), + /* 426 */ SyscallDesc("unused#426", unimplementedFunc), + /* 427 */ SyscallDesc("unused#427", unimplementedFunc), + /* 428 */ SyscallDesc("unused#428", unimplementedFunc), + /* 429 */ SyscallDesc("unused#429", unimplementedFunc), + /* 430 */ SyscallDesc("unused#430", unimplementedFunc), + /* 431 */ SyscallDesc("unused#431", unimplementedFunc), + /* 432 */ SyscallDesc("unused#432", unimplementedFunc), + /* 433 */ SyscallDesc("unused#433", unimplementedFunc), + /* 434 */ SyscallDesc("unused#434", unimplementedFunc), + /* 435 */ SyscallDesc("unused#435", unimplementedFunc), + /* 436 */ SyscallDesc("unused#436", unimplementedFunc), + /* 437 */ SyscallDesc("unused#437", unimplementedFunc), + /* 438 */ SyscallDesc("unused#438", unimplementedFunc), + /* 439 */ SyscallDesc("unused#439", unimplementedFunc), + /* 440 */ SyscallDesc("unused#440", unimplementedFunc), + /* 441 */ SyscallDesc("unused#441", unimplementedFunc), + /* 442 */ SyscallDesc("unused#442", unimplementedFunc), + /* 443 */ SyscallDesc("unused#443", unimplementedFunc), + /* 444 */ SyscallDesc("unused#444", unimplementedFunc), + /* 445 */ SyscallDesc("unused#445", unimplementedFunc), + /* 446 */ SyscallDesc("unused#446", unimplementedFunc), + /* 447 */ SyscallDesc("unused#447", unimplementedFunc), + /* 448 */ SyscallDesc("unused#448", unimplementedFunc), + /* 449 */ SyscallDesc("unused#449", unimplementedFunc), + /* 450 */ SyscallDesc("unused#450", unimplementedFunc), + /* 451 */ SyscallDesc("unused#451", unimplementedFunc), + /* 452 */ SyscallDesc("unused#452", unimplementedFunc), + /* 453 */ SyscallDesc("unused#453", unimplementedFunc), + /* 454 */ SyscallDesc("unused#454", unimplementedFunc), + /* 455 */ SyscallDesc("unused#455", unimplementedFunc), + /* 456 */ SyscallDesc("unused#456", unimplementedFunc), + /* 457 */ SyscallDesc("unused#457", unimplementedFunc), + /* 458 */ SyscallDesc("unused#458", unimplementedFunc), + /* 459 */ SyscallDesc("unused#459", unimplementedFunc), + /* 460 */ SyscallDesc("unused#460", unimplementedFunc), + /* 461 */ SyscallDesc("unused#461", unimplementedFunc), + /* 462 */ SyscallDesc("unused#462", unimplementedFunc), + /* 463 */ SyscallDesc("unused#463", unimplementedFunc), + /* 464 */ SyscallDesc("unused#464", unimplementedFunc), + /* 465 */ SyscallDesc("unused#465", unimplementedFunc), + /* 466 */ SyscallDesc("unused#466", unimplementedFunc), + /* 467 */ SyscallDesc("unused#467", unimplementedFunc), + /* 468 */ SyscallDesc("unused#468", unimplementedFunc), + /* 469 */ SyscallDesc("unused#469", unimplementedFunc), + /* 470 */ SyscallDesc("unused#470", unimplementedFunc), + /* 471 */ SyscallDesc("unused#471", unimplementedFunc), + /* 472 */ SyscallDesc("unused#472", unimplementedFunc), + /* 473 */ SyscallDesc("unused#473", unimplementedFunc), + /* 474 */ SyscallDesc("unused#474", unimplementedFunc), + /* 475 */ SyscallDesc("unused#475", unimplementedFunc), + /* 476 */ SyscallDesc("unused#476", unimplementedFunc), + /* 477 */ SyscallDesc("mmap", mmapFunc<ArmFreebsd64>), + /* 478 */ SyscallDesc("unused#478", unimplementedFunc), + /* 479 */ SyscallDesc("unused#479", unimplementedFunc), + /* 480 */ SyscallDesc("unused#480", unimplementedFunc), + /* 481 */ SyscallDesc("unused#481", unimplementedFunc), + /* 482 */ SyscallDesc("unused#482", unimplementedFunc), + /* 483 */ SyscallDesc("unused#483", unimplementedFunc), + /* 484 */ SyscallDesc("unused#484", unimplementedFunc), + /* 485 */ SyscallDesc("unused#485", unimplementedFunc), + /* 486 */ SyscallDesc("unused#486", unimplementedFunc), + /* 487 */ SyscallDesc("unused#487", unimplementedFunc), + /* 488 */ SyscallDesc("unused#488", unimplementedFunc), + /* 489 */ SyscallDesc("unused#489", unimplementedFunc), + /* 490 */ SyscallDesc("unused#490", unimplementedFunc), + /* 491 */ SyscallDesc("unused#491", unimplementedFunc), + /* 492 */ SyscallDesc("unused#492", unimplementedFunc), + /* 493 */ SyscallDesc("unused#493", unimplementedFunc), + /* 494 */ SyscallDesc("unused#494", unimplementedFunc), + /* 495 */ SyscallDesc("unused#495", unimplementedFunc), + /* 496 */ SyscallDesc("unused#496", unimplementedFunc), + /* 497 */ SyscallDesc("unused#497", unimplementedFunc), + /* 498 */ SyscallDesc("unused#498", unimplementedFunc), + /* 499 */ SyscallDesc("unused#499", unimplementedFunc), + /* 500 */ SyscallDesc("unused#500", unimplementedFunc), + /* 501 */ SyscallDesc("unused#501", unimplementedFunc), + /* 502 */ SyscallDesc("unused#502", unimplementedFunc), + /* 503 */ SyscallDesc("unused#503", unimplementedFunc), + /* 504 */ SyscallDesc("unused#504", unimplementedFunc), + /* 505 */ SyscallDesc("unused#505", unimplementedFunc), + /* 506 */ SyscallDesc("unused#506", unimplementedFunc), + /* 507 */ SyscallDesc("unused#507", unimplementedFunc), + /* 508 */ SyscallDesc("unused#508", unimplementedFunc), + /* 509 */ SyscallDesc("unused#509", unimplementedFunc), + /* 510 */ SyscallDesc("unused#510", unimplementedFunc), + /* 511 */ SyscallDesc("unused#511", unimplementedFunc), + /* 512 */ SyscallDesc("unused#512", unimplementedFunc), + /* 513 */ SyscallDesc("unused#513", unimplementedFunc), + /* 514 */ SyscallDesc("unused#514", unimplementedFunc), + /* 515 */ SyscallDesc("unused#515", unimplementedFunc), + /* 516 */ SyscallDesc("unused#516", unimplementedFunc), + /* 517 */ SyscallDesc("unused#517", unimplementedFunc), + /* 518 */ SyscallDesc("unused#518", unimplementedFunc), + /* 519 */ SyscallDesc("unused#519", unimplementedFunc), + /* 520 */ SyscallDesc("unused#520", unimplementedFunc), + /* 521 */ SyscallDesc("unused#521", unimplementedFunc), + /* 522 */ SyscallDesc("unused#522", unimplementedFunc), + /* 523 */ SyscallDesc("unused#523", unimplementedFunc), + /* 524 */ SyscallDesc("unused#524", unimplementedFunc), + /* 525 */ SyscallDesc("unused#525", unimplementedFunc), + /* 526 */ SyscallDesc("unused#526", unimplementedFunc), + /* 527 */ SyscallDesc("unused#527", unimplementedFunc), + /* 528 */ SyscallDesc("unused#528", unimplementedFunc), + /* 529 */ SyscallDesc("unused#529", unimplementedFunc), + /* 530 */ SyscallDesc("unused#530", unimplementedFunc), + /* 531 */ SyscallDesc("unused#531", unimplementedFunc), + /* 532 */ SyscallDesc("unused#532", unimplementedFunc), + /* 533 */ SyscallDesc("unused#533", unimplementedFunc), + /* 534 */ SyscallDesc("unused#534", unimplementedFunc), + /* 535 */ SyscallDesc("unused#535", unimplementedFunc), + /* 536 */ SyscallDesc("unused#536", unimplementedFunc), + /* 537 */ SyscallDesc("unused#537", unimplementedFunc), + /* 538 */ SyscallDesc("unused#538", unimplementedFunc), + /* 539 */ SyscallDesc("unused#539", unimplementedFunc), + /* 540 */ SyscallDesc("unused#540", unimplementedFunc), + /* 541 */ SyscallDesc("unused#541", unimplementedFunc), + /* 542 */ SyscallDesc("unused#542", unimplementedFunc), + /* 543 */ SyscallDesc("unused#543", unimplementedFunc), + /* 544 */ SyscallDesc("unused#544", unimplementedFunc), + /* 545 */ SyscallDesc("unused#545", unimplementedFunc), + /* 546 */ SyscallDesc("unused#546", unimplementedFunc), + /* 547 */ SyscallDesc("unused#547", unimplementedFunc), +}; + +ArmFreebsdProcess32::ArmFreebsdProcess32(LiveProcessParams * params, + ObjectFile *objFile, ObjectFile::Arch _arch) + : ArmLiveProcess32(params, objFile, _arch) +{ + SyscallTable table; + + table.descs = syscallDescs32; + table.size = sizeof(syscallDescs32) / sizeof(SyscallDesc); + table.base = 0; + syscallTables.push_back(table); +} + +ArmFreebsdProcess64::ArmFreebsdProcess64(LiveProcessParams * params, + ObjectFile *objFile, ObjectFile::Arch _arch) + : ArmLiveProcess64(params, objFile, _arch) +{ + SyscallTable table; + + table.descs = syscallDescs64; + table.size = sizeof(syscallDescs64) / sizeof(SyscallDesc); + table.base = 0; + syscallTables.push_back(table); +} + +SyscallDesc* +ArmFreebsdProcessBits::getFreebsdDesc(int callnum) +{ + + for (unsigned i = 0; i < syscallTables.size(); i++) { + SyscallDesc *desc = syscallTables[i].getDesc(callnum); + if (desc) + return desc; + } + return NULL; +} + +SyscallDesc * +ArmFreebsdProcessBits::SyscallTable::getDesc(int callnum) const +{ + + int offset = callnum - base; + if (offset < 0 || offset >= size) + return NULL; + return &descs[offset]; +} + +SyscallDesc* +ArmFreebsdProcess32::getDesc(int callnum) +{ + + return getFreebsdDesc(callnum); +} + +SyscallDesc* +ArmFreebsdProcess64::getDesc(int callnum) +{ + + return getFreebsdDesc(callnum); +} + +void +ArmFreebsdProcess32::initState() +{ + ArmLiveProcess32::initState(); + // The 32 bit equivalent of the comm page would be set up here. +} + +void +ArmFreebsdProcess64::initState() +{ + ArmLiveProcess64::initState(); + // The 64 bit equivalent of the comm page would be set up here. +} diff --git a/src/arch/arm/freebsd/process.hh b/src/arch/arm/freebsd/process.hh new file mode 100644 index 000000000..4907c2020 --- /dev/null +++ b/src/arch/arm/freebsd/process.hh @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by the University of Cambridge Computer + * Laboratory as part of the CTSRD Project, with support from the UK Higher + * Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __ARCH_ARM_FREEBSD_PROCESS_HH__ +#define __ARCH_ARM_FREEBSD_PROCESS_HH__ + +#include <vector> + +#include "arch/arm/process.hh" + +class ArmFreebsdProcessBits +{ + protected: + SyscallDesc* getFreebsdDesc(int callnum); + + struct SyscallTable + { + int base; + SyscallDesc *descs; + int size; + + SyscallDesc *getDesc(int offset) const; + }; + + std::vector<SyscallTable> syscallTables; +}; + +/// A process with emulated Arm/Freebsd syscalls. +class ArmFreebsdProcess32 : public ArmLiveProcess32, public ArmFreebsdProcessBits +{ + public: + ArmFreebsdProcess32(LiveProcessParams * params, ObjectFile *objFile, + ObjectFile::Arch _arch); + + void initState(); + + /// Explicitly import the otherwise hidden getSyscallArg + using ArmLiveProcess::getSyscallArg; + + /// A page to hold "kernel" provided functions. The name might be wrong. + static const Addr commPage; + + SyscallDesc* getDesc(int callnum); +}; + +/// A process with emulated Arm/Freebsd syscalls. +class ArmFreebsdProcess64 : public ArmLiveProcess64, public ArmFreebsdProcessBits +{ + public: + ArmFreebsdProcess64(LiveProcessParams * params, ObjectFile *objFile, + ObjectFile::Arch _arch); + + void initState(); + SyscallDesc* getDesc(int callnum); +}; + +#endif // __ARCH_ARM_FREEBSD_PROCESS_HH__ diff --git a/src/arch/arm/freebsd/system.cc b/src/arch/arm/freebsd/system.cc new file mode 100644 index 000000000..95e712e7a --- /dev/null +++ b/src/arch/arm/freebsd/system.cc @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by the University of Cambridge Computer + * Laboratory as part of the CTSRD Project, with support from the UK Higher + * Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "arch/arm/freebsd/system.hh" + +#include "arch/arm/isa_traits.hh" +#include "arch/arm/utility.hh" +#include "arch/generic/freebsd/threadinfo.hh" +#include "base/loader/dtb_object.hh" +#include "base/loader/object_file.hh" +#include "base/loader/symtab.hh" +#include "cpu/base.hh" +#include "cpu/pc_event.hh" +#include "cpu/thread_context.hh" +#include "debug/Loader.hh" +#include "kern/freebsd/events.hh" +#include "mem/fs_translating_port_proxy.hh" +#include "mem/physical.hh" +#include "sim/stat_control.hh" + +using namespace ArmISA; +using namespace FreeBSD; + +FreebsdArmSystem::FreebsdArmSystem(Params *p) + : GenericArmSystem(p), dumpStatsPCEventF(nullptr), + enableContextSwitchStatsDump(p->enable_context_switch_stats_dump), + taskFile(nullptr), kernelPanicEvent(nullptr), kernelOopsEvent(nullptr), + bootReleaseAddr(p->boot_release_addr) +{ + if (p->panic_on_panic) { + kernelPanicEvent = addKernelFuncEventOrPanic<PanicPCEvent>( + "panic", "Kernel panic in simulated kernel"); + } else { +#ifndef NDEBUG + kernelPanicEvent = addKernelFuncEventOrPanic<BreakPCEvent>("panic"); +#endif + } + + if (p->panic_on_oops) { + kernelOopsEvent = addKernelFuncEventOrPanic<PanicPCEvent>( + "oops_exit", "Kernel oops in guest"); + } + + uDelaySkipEvent = addKernelFuncEvent<UDelayEvent>( + "DELAY", "DELAY", 1000, 0); +} + +bool +FreebsdArmSystem::adderBootUncacheable(Addr a) +{ + + return false; +} + +void +FreebsdArmSystem::initState() +{ + // Moved from the constructor to here since it relies on the + // address map being resolved in the interconnect + + // Call the initialisation of the super class + GenericArmSystem::initState(); + + // Load symbols at physical address, we might not want + // to do this permanently, for but early bootup work + // it is helpful. + if (params()->early_kernel_symbols) { + kernel->loadGlobalSymbols(kernelSymtab, loadAddrMask); + kernel->loadGlobalSymbols(debugSymbolTable, loadAddrMask); + } + + // Setup boot data structure + Addr addr = 0; + + // Check if the kernel image has a symbol that tells us it supports + // device trees. + bool kernel_has_fdt_support = + kernelSymtab->findAddress("fdt_get_range", addr); + bool dtb_file_specified = params()->dtb_filename != ""; + + if (!dtb_file_specified) + fatal("dtb file is not specified\n"); + + if (!kernel_has_fdt_support) + fatal("kernel must have fdt support\n"); + + // Kernel supports flattened device tree and dtb file specified. + // Using Device Tree Blob to describe system configuration. + inform("Loading DTB file: %s at address %#x\n", params()->dtb_filename, + params()->atags_addr + loadAddrOffset); + + ObjectFile *dtb_file = createObjectFile(params()->dtb_filename, true); + if (!dtb_file) { + fatal("couldn't load DTB file: %s\n", params()->dtb_filename); + } + + DtbObject *_dtb_file = dynamic_cast<DtbObject*>(dtb_file); + + if (_dtb_file) { + if (!_dtb_file->addBootCmdLine(params()->boot_osflags.c_str(), + params()->boot_osflags.size())) { + warn("couldn't append bootargs to DTB file: %s\n", + params()->dtb_filename); + } + } else { + warn("dtb_file cast failed; couldn't append bootargs " + "to DTB file: %s\n", params()->dtb_filename); + } + + Addr ra = _dtb_file->findReleaseAddr(); + if (ra) + bootReleaseAddr = ra & ~ULL(0x7F); + + dtb_file->setTextBase(params()->atags_addr + loadAddrOffset); + dtb_file->loadSections(physProxy); + delete dtb_file; + + // Kernel boot requirements to set up r0, r1 and r2 in ARMv7 + for (int i = 0; i < threadContexts.size(); i++) { + threadContexts[i]->setIntReg(0, 0); + threadContexts[i]->setIntReg(1, params()->machine_type); + threadContexts[i]->setIntReg(2, params()->atags_addr + loadAddrOffset); + } +} + +FreebsdArmSystem::~FreebsdArmSystem() +{ + if (uDelaySkipEvent) + delete uDelaySkipEvent; + if (constUDelaySkipEvent) + delete constUDelaySkipEvent; + + if (dumpStatsPCEventF) + delete dumpStatsPCEventF; +} + +FreebsdArmSystem * +FreebsdArmSystemParams::create() +{ + return new FreebsdArmSystem(this); +} + +void +FreebsdArmSystem::startup() +{ +} diff --git a/src/arch/arm/freebsd/system.hh b/src/arch/arm/freebsd/system.hh new file mode 100644 index 000000000..e0a533e13 --- /dev/null +++ b/src/arch/arm/freebsd/system.hh @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by the University of Cambridge Computer + * Laboratory as part of the CTSRD Project, with support from the UK Higher + * Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __ARCH_ARM_FREEBSD_SYSTEM_HH__ +#define __ARCH_ARM_FREEBSD_SYSTEM_HH__ + +#include <cstdio> +#include <map> +#include <string> +#include <vector> + +#include "arch/arm/system.hh" +#include "base/output.hh" +#include "kern/freebsd/events.hh" +#include "params/FreebsdArmSystem.hh" +#include "sim/core.hh" + +class DumpStatsPCEventF; + +class FreebsdArmSystem : public GenericArmSystem +{ + protected: + DumpStatsPCEventF *dumpStatsPCEventF; + + public: + /** Boilerplate params code */ + typedef FreebsdArmSystemParams Params; + const Params * + params() const + { + return dynamic_cast<const Params *>(_params); + } + + /** When enabled, dump stats/task info on context switches for + * Streamline and per-thread cache occupancy studies, etc. */ + bool enableContextSwitchStatsDump; + + /** This map stores a mapping of OS process IDs to internal Task IDs. The + * mapping is done because the stats system doesn't tend to like vectors + * that are much greater than 1000 items and the entire process space is + * 65K. */ + std::map<uint32_t, uint32_t> taskMap; + + /** This is a file that is placed in the run directory that prints out + * mappings between taskIds and OS process IDs */ + std::ostream* taskFile; + + FreebsdArmSystem(Params *p); + ~FreebsdArmSystem(); + + void initState(); + + bool adderBootUncacheable(Addr a); + + void startup(); + + /** This function creates a new task Id for the given pid. + * @param tc thread context that is currentyl executing */ + void mapPid(ThreadContext* tc, uint32_t pid); + + private: + /** Event to halt the simulator if the kernel calls panic() */ + PCEvent *kernelPanicEvent; + + /** Event to halt the simulator if the kernel calls oopses */ + PCEvent *kernelOopsEvent; + + /** + * PC based event to skip udelay(<time>) calls and quiesce the + * processor for the appropriate amount of time. This is not functionally + * required but does speed up simulation. + */ + FreeBSD::UDelayEvent *uDelaySkipEvent; + + /** Another PC based skip event for const_udelay(). Similar to the udelay + * skip, but this function precomputes the first multiply that is done + * in the generic case since the parameter is known at compile time. + * Thus we need to do some division to get back to us. + */ + FreeBSD::UDelayEvent *constUDelaySkipEvent; + + /** These variables store addresses of important data structures + * that are normaly kept coherent at boot with cache mainetence operations. + * Since these operations aren't supported in gem5, we keep them coherent + * by making them uncacheable until all processors in the system boot. + */ + Addr secDataPtrAddr; + Addr secDataAddr; + Addr penReleaseAddr; + Addr pen64ReleaseAddr; + Addr bootReleaseAddr; +}; + +class DumpStatsPCEventF : public PCEvent +{ + public: + DumpStatsPCEventF(PCEventQueue *q, const std::string &desc, Addr addr) + : PCEvent(q, desc, addr) + {} + + virtual void process(ThreadContext* tc); +}; + + +#endif // __ARCH_ARM_FREEBSD_SYSTEM_HH__ + diff --git a/src/arch/arm/linux/system.cc b/src/arch/arm/linux/system.cc index e9586f199..216e9ddc0 100644 --- a/src/arch/arm/linux/system.cc +++ b/src/arch/arm/linux/system.cc @@ -61,7 +61,7 @@ using namespace ArmISA; using namespace Linux; LinuxArmSystem::LinuxArmSystem(Params *p) - : ArmSystem(p), dumpStatsPCEvent(nullptr), + : GenericArmSystem(p), dumpStatsPCEvent(nullptr), enableContextSwitchStatsDump(p->enable_context_switch_stats_dump), taskFile(nullptr), kernelPanicEvent(nullptr), kernelOopsEvent(nullptr), bootReleaseAddr(p->boot_release_addr) @@ -133,7 +133,7 @@ LinuxArmSystem::initState() // address map being resolved in the interconnect // Call the initialisation of the super class - ArmSystem::initState(); + GenericArmSystem::initState(); // Load symbols at physical address, we might not want // to do this permanently, for but early bootup work diff --git a/src/arch/arm/linux/system.hh b/src/arch/arm/linux/system.hh index 4ce6ac49e..32e3568b3 100644 --- a/src/arch/arm/linux/system.hh +++ b/src/arch/arm/linux/system.hh @@ -56,7 +56,7 @@ class DumpStatsPCEvent; -class LinuxArmSystem : public ArmSystem +class LinuxArmSystem : public GenericArmSystem { protected: DumpStatsPCEvent *dumpStatsPCEvent; diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc index a08e6ee45..ba56f0cdc 100644 --- a/src/arch/arm/process.cc +++ b/src/arch/arm/process.cc @@ -181,31 +181,43 @@ ArmLiveProcess::argsInit(int pageSize, IntRegIndex spIndex) //Auxilliary vectors are loaded only for elf formatted executables. ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile); if (elfObject) { - IntType features = - Arm_Swp | - Arm_Half | - Arm_Thumb | -// Arm_26Bit | - Arm_FastMult | -// Arm_Fpa | - Arm_Vfp | - Arm_Edsp | -// Arm_Java | -// Arm_Iwmmxt | -// Arm_Crunch | - Arm_ThumbEE | - Arm_Neon | - Arm_Vfpv3 | - Arm_Vfpv3d16 | - 0; - - //Bits which describe the system hardware capabilities - //XXX Figure out what these should be - auxv.push_back(auxv_t(M5_AT_HWCAP, features)); + + if (objFile->getOpSys() == ObjectFile::Linux) { + IntType features = + Arm_Swp | + Arm_Half | + Arm_Thumb | +// Arm_26Bit | + Arm_FastMult | +// Arm_Fpa | + Arm_Vfp | + Arm_Edsp | +// Arm_Java | +// Arm_Iwmmxt | +// Arm_Crunch | + Arm_ThumbEE | + Arm_Neon | + Arm_Vfpv3 | + Arm_Vfpv3d16 | + 0; + + //Bits which describe the system hardware capabilities + //XXX Figure out what these should be + auxv.push_back(auxv_t(M5_AT_HWCAP, features)); + //Frequency at which times() increments + auxv.push_back(auxv_t(M5_AT_CLKTCK, 0x64)); + //Whether to enable "secure mode" in the executable + auxv.push_back(auxv_t(M5_AT_SECURE, 0)); + // Pointer to 16 bytes of random data + auxv.push_back(auxv_t(M5_AT_RANDOM, 0)); + //The filename of the program + auxv.push_back(auxv_t(M5_AT_EXECFN, 0)); + //The string "v71" -- ARM v7 architecture + auxv.push_back(auxv_t(M5_AT_PLATFORM, 0)); + } + //The system page size auxv.push_back(auxv_t(M5_AT_PAGESZ, ArmISA::PageBytes)); - //Frequency at which times() increments - auxv.push_back(auxv_t(M5_AT_CLKTCK, 0x64)); // For statically linked executables, this is the virtual address of the // program header tables if they appear in the executable image auxv.push_back(auxv_t(M5_AT_PHDR, elfObject->programHeaderTable())); @@ -217,7 +229,6 @@ ArmLiveProcess::argsInit(int pageSize, IntRegIndex spIndex) //to 0 for regular executables. It should be something else //(not sure what) for dynamic libraries. auxv.push_back(auxv_t(M5_AT_BASE, 0)); - //XXX Figure out what this should be. auxv.push_back(auxv_t(M5_AT_FLAGS, 0)); //The entry point to the program @@ -227,16 +238,6 @@ ArmLiveProcess::argsInit(int pageSize, IntRegIndex spIndex) auxv.push_back(auxv_t(M5_AT_EUID, euid())); auxv.push_back(auxv_t(M5_AT_GID, gid())); auxv.push_back(auxv_t(M5_AT_EGID, egid())); - //Whether to enable "secure mode" in the executable - auxv.push_back(auxv_t(M5_AT_SECURE, 0)); - - // Pointer to 16 bytes of random data - auxv.push_back(auxv_t(M5_AT_RANDOM, 0)); - - //The filename of the program - auxv.push_back(auxv_t(M5_AT_EXECFN, 0)); - //The string "v71" -- ARM v7 architecture - auxv.push_back(auxv_t(M5_AT_PLATFORM, 0)); } //Figure out how big the initial stack nedes to be @@ -456,11 +457,33 @@ ArmLiveProcess64::setSyscallArg(ThreadContext *tc, void ArmLiveProcess32::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) { + + if (objFile->getOpSys() == ObjectFile::FreeBSD) { + // Decode return value + if (sysret.encodedValue() >= 0) + // FreeBSD checks the carry bit to determine if syscall is succeeded + tc->setCCReg(CCREG_C, 0); + else { + sysret = -sysret.encodedValue(); + } + } + tc->setIntReg(ReturnValueReg, sysret.encodedValue()); } void ArmLiveProcess64::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) { + + if (objFile->getOpSys() == ObjectFile::FreeBSD) { + // Decode return value + if (sysret.encodedValue() >= 0) + // FreeBSD checks the carry bit to determine if syscall is succeeded + tc->setCCReg(CCREG_C, 0); + else { + sysret = -sysret.encodedValue(); + } + } + tc->setIntReg(ReturnValueReg, sysret.encodedValue()); } diff --git a/src/arch/arm/system.cc b/src/arch/arm/system.cc index 398aa408c..eebb220d8 100644 --- a/src/arch/arm/system.cc +++ b/src/arch/arm/system.cc @@ -244,8 +244,26 @@ ArmSystem::haveLargeAsid64(ThreadContext *tc) { return dynamic_cast<ArmSystem *>(tc->getSystemPtr())->haveLargeAsid64(); } + ArmSystem * ArmSystemParams::create() { return new ArmSystem(this); } + +void +GenericArmSystem::initState() +{ + // Moved from the constructor to here since it relies on the + // address map being resolved in the interconnect + + // Call the initialisation of the super class + ArmSystem::initState(); +} + +GenericArmSystem * +GenericArmSystemParams::create() +{ + + return new GenericArmSystem(this); +} diff --git a/src/arch/arm/system.hh b/src/arch/arm/system.hh index f906dc2d2..599734fd3 100644 --- a/src/arch/arm/system.hh +++ b/src/arch/arm/system.hh @@ -49,6 +49,7 @@ #include "dev/arm/generic_timer.hh" #include "kern/linux/events.hh" #include "params/ArmSystem.hh" +#include "params/GenericArmSystem.hh" #include "sim/sim_object.hh" #include "sim/system.hh" @@ -265,8 +266,25 @@ class ArmSystem : public System /** Returns true if ASID is 16 bits for the system of a specific thread * context while in AArch64 (ARMv8) */ static bool haveLargeAsid64(ThreadContext *tc); +}; +class GenericArmSystem : public ArmSystem +{ + public: + typedef GenericArmSystemParams Params; + const Params * + params() const + { + return dynamic_cast<const Params *>(_params); + } + + GenericArmSystem(Params *p) : ArmSystem(p) {}; + virtual ~GenericArmSystem() {}; + + /** + * Initialise the system + */ + virtual void initState(); }; #endif - diff --git a/src/arch/generic/freebsd/threadinfo.hh b/src/arch/generic/freebsd/threadinfo.hh new file mode 100644 index 000000000..af9dd85bf --- /dev/null +++ b/src/arch/generic/freebsd/threadinfo.hh @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by the University of Cambridge Computer + * Laboratory as part of the CTSRD Project, with support from the UK Higher + * Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __ARCH_GENERIC_FREEBSD_THREADINFO_HH__ +#define __ARCH_GENERIC_FREEBSD_THREADINFO_HH__ + +#include "cpu/thread_context.hh" +#include "sim/system.hh" +#include "sim/vptr.hh" + +namespace FreeBSD { + +class ThreadInfo +{ + private: + ThreadContext *tc; + System *sys; + + public: + ThreadInfo(ThreadContext *_tc) + : tc(_tc), sys(tc->getSystemPtr()) + { + + } + ~ThreadInfo() + {} +}; + +} // namespace FreeBSD + +#endif // __ARCH_GENERIC_FREEBSD_THREADINFO_HH__ diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc index 4abf0a432..ed4fee37a 100644 --- a/src/base/loader/elf_object.cc +++ b/src/base/loader/elf_object.cc @@ -150,6 +150,9 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) case ELFOSABI_ARM: opSys = ObjectFile::LinuxArmOABI; break; + case ELFOSABI_FREEBSD: + opSys = ObjectFile::FreeBSD; + break; default: opSys = ObjectFile::UnknownOpSys; } @@ -160,7 +163,8 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) Elf_Scn *section; GElf_Shdr shdr; Elf_Data *data; - uint32_t osAbi;; + uint32_t osAbi; + uint32_t *elem; int secIdx = 1; // Get the first section @@ -194,6 +198,16 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) opSys = ObjectFile::Solaris; if (!strcmp(".stab.index", elf_strptr(elf, ehdr.e_shstrndx, shdr.sh_name))) opSys = ObjectFile::Solaris; + if (shdr.sh_type == SHT_NOTE && !strcmp(".note.tag", + elf_strptr(elf, ehdr.e_shstrndx, shdr.sh_name))) { + data = elf_rawdata(section, NULL); + assert(data->d_buf); + elem = (uint32_t *)data->d_buf; + if (elem[0] == 0x8) { //size of name + if (memcmp((void *)&elem[3], "FreeBSD", 0x8) == 0) + opSys = ObjectFile::FreeBSD; + } + } section = elf_getscn(elf, ++secIdx); } // while sections diff --git a/src/base/loader/object_file.hh b/src/base/loader/object_file.hh index 09cde5b53..37f2aa585 100644 --- a/src/base/loader/object_file.hh +++ b/src/base/loader/object_file.hh @@ -63,7 +63,8 @@ class ObjectFile Tru64, Linux, Solaris, - LinuxArmOABI + LinuxArmOABI, + FreeBSD }; protected: diff --git a/src/base/output.cc b/src/base/output.cc index da9a551fa..ce1b49a82 100644 --- a/src/base/output.cc +++ b/src/base/output.cc @@ -32,6 +32,7 @@ #include <sys/stat.h> #include <sys/types.h> #include <dirent.h> +#include <unistd.h> #include <cassert> #include <cerrno> diff --git a/src/base/vnc/vncserver.cc b/src/base/vnc/vncserver.cc index 77a4316ab..6dc2f2f10 100644 --- a/src/base/vnc/vncserver.cc +++ b/src/base/vnc/vncserver.cc @@ -44,16 +44,24 @@ #include <sys/ioctl.h> #include <sys/stat.h> + +#if defined(__FreeBSD__) +#include <termios.h> + +#else #include <sys/termios.h> -#include <sys/types.h> + +#endif +#include "base/vnc/vncserver.hh" + #include <fcntl.h> #include <poll.h> +#include <sys/types.h> #include <unistd.h> #include <cerrno> #include <cstdio> -#include "base/vnc/vncserver.hh" #include "base/atomicio.hh" #include "base/bitmap.hh" #include "base/misc.hh" diff --git a/src/dev/arm/gic_pl390.cc b/src/dev/arm/gic_pl390.cc index ced246485..b4dc37682 100644 --- a/src/dev/arm/gic_pl390.cc +++ b/src/dev/arm/gic_pl390.cc @@ -276,6 +276,9 @@ Pl390::readCpu(PacketPtr pkt) ctx_id); switch(daddr) { + case ICCIIDR: + pkt->set<uint32_t>(0); + break; case ICCICR: pkt->set<uint32_t>(cpuEnabled[ctx_id]); break; @@ -525,7 +528,8 @@ Pl390::writeCpu(PacketPtr pkt) } else { uint32_t int_num = 1 << intNumToBit(iar.ack_id); if (!(activeInt[intNumToWord(iar.ack_id)] & int_num)) - panic("Done handling interrupt that isn't active?\n"); + warn("Done handling interrupt that isn't active: %d\n", + intNumToBit(iar.ack_id)); activeInt[intNumToWord(iar.ack_id)] &= ~int_num; } updateRunPri(); diff --git a/src/dev/terminal.cc b/src/dev/terminal.cc index 895069774..b4fb50f6e 100644 --- a/src/dev/terminal.cc +++ b/src/dev/terminal.cc @@ -34,7 +34,16 @@ */ #include <sys/ioctl.h> + +#if defined(__FreeBSD__) +#include <termios.h> + +#else #include <sys/termios.h> + +#endif +#include "dev/terminal.hh" + #include <poll.h> #include <unistd.h> @@ -53,7 +62,6 @@ #include "debug/Terminal.hh" #include "debug/TerminalVerbose.hh" #include "dev/platform.hh" -#include "dev/terminal.hh" #include "dev/uart.hh" using namespace std; diff --git a/src/kern/SConscript b/src/kern/SConscript index 8fe602b32..7bcf54213 100644 --- a/src/kern/SConscript +++ b/src/kern/SConscript @@ -37,6 +37,7 @@ Source('kernel_stats.cc') Source('linux/events.cc') Source('linux/linux.cc') Source('linux/printk.cc') +Source('freebsd/events.cc') Source('operatingsystem.cc') Source('system_events.cc') diff --git a/src/kern/freebsd/events.cc b/src/kern/freebsd/events.cc new file mode 100644 index 000000000..2f4ceb056 --- /dev/null +++ b/src/kern/freebsd/events.cc @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by the University of Cambridge Computer + * Laboratory as part of the CTSRD Project, with support from the UK Higher + * Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "kern/freebsd/events.hh" + +#include <sstream> + +#include "arch/utility.hh" +#include "base/trace.hh" +#include "cpu/thread_context.hh" +#include "debug/DebugPrintf.hh" +#include "kern/system_events.hh" +#include "sim/arguments.hh" +#include "sim/pseudo_inst.hh" +#include "sim/system.hh" + +namespace FreeBSD { + +void +UDelayEvent::process(ThreadContext *tc) +{ + int arg_num; + + arg_num = 0; + + // Get the time in native size + uint64_t time = TheISA::getArgument(tc, arg_num, (uint16_t)-1, false); + + //DPRINTFN("DELAY(%d)\n", time); + + // convert parameter to ns + if (argDivToNs) + time /= argDivToNs; + + time *= argMultToNs; + + SkipFuncEvent::process(tc); + + PseudoInst::quiesceNs(tc, time); +} + +} // namespace FreeBSD diff --git a/src/kern/freebsd/events.hh b/src/kern/freebsd/events.hh new file mode 100644 index 000000000..1d3faa935 --- /dev/null +++ b/src/kern/freebsd/events.hh @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by the University of Cambridge Computer + * Laboratory as part of the CTSRD Project, with support from the UK Higher + * Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __KERN_FREEBSD_EVENTS_HH__ +#define __KERN_FREEBSD_EVENTS_HH__ + +#include "kern/system_events.hh" + +namespace FreeBSD { + +/** A class to skip udelay() and related calls in the kernel. + * This class has two additional parameters that take the argument to udelay and + * manipulated it to come up with ns and eventually ticks to quiesce for. + * See descriptions of argDivToNs and argMultToNs below. + */ +class UDelayEvent : public SkipFuncEvent +{ + private: + /** value to divide arg by to create ns. This is present beacues the linux + * kernel code sometime precomputes the first multiply that is done in + * udelay() if the parameter is a constant. We need to undo it so here is + * how. */ + uint64_t argDivToNs; + + /** value to multiple arg by to create ns. Nominally, this is 1000 to + * convert us to ns, but since linux can do some preprocessing of constant + * values something else might be required. */ + uint64_t argMultToNs; + + public: + UDelayEvent(PCEventQueue *q, const std::string &desc, Addr addr, + uint64_t mult, uint64_t div) + : SkipFuncEvent(q, desc, addr), argDivToNs(div), argMultToNs(mult) {} + virtual void process(ThreadContext *xc); +}; + +} + +#endif diff --git a/src/kern/freebsd/freebsd.hh b/src/kern/freebsd/freebsd.hh new file mode 100644 index 000000000..e3d5cf5be --- /dev/null +++ b/src/kern/freebsd/freebsd.hh @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> + * All rights reserved. + * + * This software was developed by the University of Cambridge Computer + * Laboratory as part of the CTSRD Project, with support from the UK Higher + * Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __FREEBSD_HH__ +#define __FREEBSD_HH__ + +#include <string> + +#include "base/types.hh" +#include "kern/operatingsystem.hh" + +class ThreadContext; +class LiveProcess; + +/// +/// This class encapsulates the types, structures, constants, +/// functions, and syscall-number mappings specific to the Alpha FreeBSD +/// syscall interface. +/// +class FreeBSD : public OperatingSystem +{ + + public: + + //@{ + /// Basic FreeBSD types. + typedef uint64_t size_t; + typedef uint64_t off_t; + typedef int64_t time_t; + typedef int64_t clock_t; + typedef uint32_t uid_t; + typedef uint32_t gid_t; + //@} + + /// Clock ticks per second, for times(). + static const int M5_SC_CLK_TCK = 100; + + //@{ + /// ioctl() command codes. + static const unsigned TGT_TIOCGETA = 0x402c7413; + static const unsigned TGT_TIOCSETA = 0x802c7414; + static const unsigned TGT_TIOCSETAW = 0x802c7415; + static const unsigned TGT_FIONREAD = 0x4004667f; + //@} + + /// Return true for the ioctl codes for which we return ENOTTY + /// *without* printing a warning, since we know that ENOTTY is the + /// correct thing to return (and not just a sign that we don't + /// recognize the ioctl code. + static bool + isTtyReq(unsigned req) + { + switch (req) { + case TGT_TIOCGETA: + case TGT_TIOCSETA: + case TGT_TIOCSETAW: + case TGT_FIONREAD: + return true; + default: + return false; + } + } + + /// Resource constants for getrlimit(). + static const unsigned TGT_RLIMIT_CPU = 0; + static const unsigned TGT_RLIMIT_FSIZE = 1; + static const unsigned TGT_RLIMIT_DATA = 2; + static const unsigned TGT_RLIMIT_STACK = 3; + static const unsigned TGT_RLIMIT_CORE = 4; + static const unsigned TGT_RLIMIT_RSS = 5; + static const unsigned TGT_RLIMIT_MEMLOCK = 6; + static const unsigned TGT_RLIMIT_NPROC = 7; + static const unsigned TGT_RLIMIT_NOFILE = 8; + static const unsigned TGT_RLIMIT_SBSIZE = 9; + static const unsigned TGT_RLIMIT_VMEM = 10; + static const unsigned TGT_RLIMIT_AS = TGT_RLIMIT_VMEM; + static const unsigned TGT_RLIMIT_NPTS = 11; + static const unsigned TGT_RLIMIT_SWAP = 12; + static const unsigned TGT_RLIMIT_KQUEUES = 13; + + /// For getrusage(). + static const int TGT_RUSAGE_SELF = 0; + static const int TGT_RUSAGE_CHILDREN = -1; + static const int TGT_RUSAGE_THREAD = 1; + + // for *at syscalls + static const int TGT_AT_FDCWD = -100; + +}; // class FreeBSD + +#endif // __FREEBSD_HH__ diff --git a/src/sim/process.cc b/src/sim/process.cc index ea6308de6..35f981d1e 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -77,6 +77,7 @@ #include "arch/mips/linux/process.hh" #elif THE_ISA == ARM_ISA #include "arch/arm/linux/process.hh" +#include "arch/arm/freebsd/process.hh" #elif THE_ISA == X86_ISA #include "arch/x86/linux/process.hh" #elif THE_ISA == POWER_ISA @@ -736,6 +737,15 @@ LiveProcess::create(LiveProcessParams * params) objFile->getArch()); } break; + case ObjectFile::FreeBSD: + if (arch == ObjectFile::Arm64) { + process = new ArmFreebsdProcess64(params, objFile, + objFile->getArch()); + } else { + process = new ArmFreebsdProcess32(params, objFile, + objFile->getArch()); + } + break; case ObjectFile::LinuxArmOABI: fatal("M5 does not support ARM OABI binaries. Please recompile with an" " EABI compiler."); |