/*
- * Copyright (c) 2010-2013, 2015 ARM Limited
+ * Copyright (c) 2010-2013, 2015, 2020 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
{ base + 342, "tee" },
{ base + 343, "vmsplice" },
{ base + 344, "move_pages" },
- { base + 345, "getcpu" },
+ { base + 345, "getcpu", getcpuFunc },
{ base + 346, "epoll_pwait" },
{ base + 347, "sys_kexec_load" },
{ base + 348, "sys_utimensat" },
{ base + 165, "getrusage", getrusageFunc<ArmLinux64> },
{ base + 166, "umask" },
{ base + 167, "prctl" },
- { base + 168, "getcpu" },
+ { base + 168, "getcpu", getcpuFunc },
{ base + 169, "gettimeofday", gettimeofdayFunc<ArmLinux64> },
{ base + 170, "settimeofday" },
{ base + 171, "adjtimex" },
{ 306, "syncfs" },
{ 307, "sendmmsg" },
{ 308, "setns" },
- { 309, "getcpu" },
+ { 309, "getcpu", getcpuFunc },
{ 310, "proess_vm_readv" },
{ 311, "proess_vm_writev" },
{ 312, "kcmp" },
{ 315, "tee" },
{ 316, "vmsplice" },
{ 317, "move_pages" },
- { 318, "getcpu" },
+ { 318, "getcpu", getcpuFunc },
{ 319, "epoll_pwait" },
{ 320, "utimensat" },
{ 321, "signalfd" },
return (status == -1) ? -errno : status;
}
+SyscallReturn
+getcpuFunc(SyscallDesc *desc, ThreadContext *tc,
+ Addr cpu_ptr, Addr node_ptr, Addr tcache_ptr)
+{
+ bool error = false;
+
+ // unsigned is the same size (4) on all Linux supported ISAs.
+ if (cpu_ptr != 0) {
+ TypedBufferArg<uint32_t> result(cpu_ptr);
+ *result = htog(tc->contextId(),
+ tc->getSystemPtr()->getGuestByteOrder());
+ error |= !result.copyOut(tc->getVirtProxy());
+ }
+
+ // Set a fixed NUMA node 0.
+ if (node_ptr != 0) {
+ TypedBufferArg<uint32_t> result(node_ptr);
+ *result = 0;
+ error |= !result.copyOut(tc->getVirtProxy());
+ }
+
+ return error ? -EFAULT : 0;
+}
/*
- * Copyright (c) 2012-2013, 2015, 2019 ARM Limited
+ * Copyright (c) 2012-2013, 2015, 2019-2020 ARM Limited
* Copyright (c) 2015 Advanced Micro Devices, Inc.
* All rights reserved
*
int tgt_fd, int level, int optname,
Addr valPtr, socklen_t len);
+SyscallReturn getcpuFunc(SyscallDesc *desc, ThreadContext *tc,
+ Addr cpu_ptr, Addr node_ptr, Addr tcache_ptr);
+
// Target getsockname() handler.
SyscallReturn getsocknameFunc(SyscallDesc *desc, ThreadContext *tc,
int tgt_fd, Addr addrPtr, Addr lenPtr);