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