1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) 2010 Imagination Technologies 4 */ 5 6 #ifndef __ASM_METAG_USER_GATEWAY_H 7 #define __ASM_METAG_USER_GATEWAY_H 8 9 #include <asm/page.h> 10 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 15 16 #ifndef __ASSEMBLY__ 17 18 extern char __user_gateway_start; 19 extern char __user_gateway_end; 20 21 /* Kernel mapping of the gateway page. */ 22 extern void *gateway_page; 23 set_gateway_tls(void __user * tls_ptr)24static inline void set_gateway_tls(void __user *tls_ptr) 25 { 26 void **gateway_tls = (void **)(gateway_page + USER_GATEWAY_TLS + 27 hard_processor_id() * 4); 28 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 *)); 34 #endif 35 } 36 37 extern int __kuser_get_tls(void); 38 extern char *__kuser_get_tls_end[]; 39 40 extern int __kuser_cmpxchg(int, int, unsigned long *); 41 extern char *__kuser_cmpxchg_end[]; 42 43 #endif 44 45 #endif 46