1 /*
2  *  arm sysarch() system call emulation
3  *
4  *  Copyright (c) 2013 Stacey D. Son
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef BSD_USER_ARCH_SYSARCH_H_
21 #define BSD_USER_ARCH_SYSARCH_H_
22 
23 #include "target_syscall.h"
24 #include "target_arch.h"
25 
26 static inline abi_long do_freebsd_arch_sysarch(CPUARMState *env, int op,
27         abi_ulong parms)
28 {
29     int ret = 0;
30 
31     switch (op) {
32     case TARGET_FREEBSD_ARM_SYNC_ICACHE:
33     case TARGET_FREEBSD_ARM_DRAIN_WRITEBUF:
34         break;
35 
36     case TARGET_FREEBSD_ARM_SET_TP:
37         target_cpu_set_tls(env, parms);
38         break;
39 
40     case TARGET_FREEBSD_ARM_GET_TP:
41         ret = target_cpu_get_tls(env);
42         break;
43 
44     default:
45         ret = -TARGET_EINVAL;
46         break;
47     }
48     return ret;
49 }
50 
51 static inline void do_freebsd_arch_print_sysarch(
52         const struct syscallname *name, abi_long arg1, abi_long arg2,
53         abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6)
54 {
55 
56     switch (arg1) {
57     case TARGET_FREEBSD_ARM_SYNC_ICACHE:
58         gemu_log("%s(ARM_SYNC_ICACHE, ...)", name->name);
59         break;
60 
61     case TARGET_FREEBSD_ARM_DRAIN_WRITEBUF:
62         gemu_log("%s(ARM_DRAIN_WRITEBUF, ...)", name->name);
63         break;
64 
65     case TARGET_FREEBSD_ARM_SET_TP:
66         gemu_log("%s(ARM_SET_TP, 0x" TARGET_ABI_FMT_lx ")", name->name, arg2);
67         break;
68 
69     case TARGET_FREEBSD_ARM_GET_TP:
70         gemu_log("%s(ARM_GET_TP, 0x" TARGET_ABI_FMT_lx ")", name->name, arg2);
71         break;
72 
73     default:
74         gemu_log("UNKNOWN OP: %d, " TARGET_ABI_FMT_lx ")", (int)arg1, arg2);
75     }
76 }
77 
78 #endif /*!BSD_USER_ARCH_SYSARCH_H_ */
79