1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2010 Imagination Technologies
6 #ifndef __ASM_METAG_USER_GATEWAY_H
7 #define __ASM_METAG_USER_GATEWAY_H
11 /* Page of kernel code accessible to userspace. */
12 #define USER_GATEWAY_PAGE 0x6ffff000
13 /* Offset of TLS pointer array in gateway page. */
14 #define USER_GATEWAY_TLS 0x100
18 extern char __user_gateway_start;
19 extern char __user_gateway_end;
21 /* Kernel mapping of the gateway page. */
22 extern void *gateway_page;
24 static inline void set_gateway_tls(void __user *tls_ptr)
26 void **gateway_tls = (void **)(gateway_page + USER_GATEWAY_TLS +
27 hard_processor_id() * 4);
29 *gateway_tls = (__force void *)tls_ptr;
30 #ifdef CONFIG_METAG_META12
31 /* Avoid cache aliases on virtually tagged cache. */
32 __builtin_dcache_flush((void *)USER_GATEWAY_PAGE + USER_GATEWAY_TLS +
33 hard_processor_id() * sizeof(void *));
37 extern int __kuser_get_tls(void);
38 extern char *__kuser_get_tls_end[];
40 extern int __kuser_cmpxchg(int, int, unsigned long *);
41 extern char *__kuser_cmpxchg_end[];