2 * Copyright (C) 2010 Imagination Technologies
5 #ifndef __ASM_METAG_USER_GATEWAY_H
6 #define __ASM_METAG_USER_GATEWAY_H
10 /* Page of kernel code accessible to userspace. */
11 #define USER_GATEWAY_PAGE 0x6ffff000
12 /* Offset of TLS pointer array in gateway page. */
13 #define USER_GATEWAY_TLS 0x100
17 extern char __user_gateway_start;
18 extern char __user_gateway_end;
20 /* Kernel mapping of the gateway page. */
21 extern void *gateway_page;
23 static inline void set_gateway_tls(void __user *tls_ptr)
25 void **gateway_tls = (void **)(gateway_page + USER_GATEWAY_TLS +
26 hard_processor_id() * 4);
28 *gateway_tls = (__force void *)tls_ptr;
29 #ifdef CONFIG_METAG_META12
30 /* Avoid cache aliases on virtually tagged cache. */
31 __builtin_dcache_flush((void *)USER_GATEWAY_PAGE + USER_GATEWAY_TLS +
32 hard_processor_id() * sizeof(void *));
36 extern int __kuser_get_tls(void);
37 extern char *__kuser_get_tls_end[];
39 extern int __kuser_cmpxchg(int, int, unsigned long *);
40 extern char *__kuser_cmpxchg_end[];