diff options
author | James Hogan | 2012-10-09 11:54:51 +0200 |
---|---|---|
committer | James Hogan | 2013-03-02 21:09:49 +0100 |
commit | 26025bbfbba33a9425be1b89eccb4664ea4c17b6 (patch) | |
tree | f8a7f754525812c4d758b638d9bcade297af67da /arch/metag/include/asm/user_gateway.h | |
parent | metag: Internal and external irqchips (diff) | |
download | kernel-qcow2-linux-26025bbfbba33a9425be1b89eccb4664ea4c17b6.tar.gz kernel-qcow2-linux-26025bbfbba33a9425be1b89eccb4664ea4c17b6.tar.xz kernel-qcow2-linux-26025bbfbba33a9425be1b89eccb4664ea4c17b6.zip |
metag: System Calls
Add metag system call and gateway page interfaces. The metag
architecture port uses the generic system call numbers from
asm-generic/unistd.h, as well as a user gateway page mapped at
0x6ffff000 which contains fast atomic primitives (depending on SMP) and
a fast method of accessing TLS data.
System calls use the SWITCH instruction with the immediate 0x440001 to
signal a system call.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Diffstat (limited to 'arch/metag/include/asm/user_gateway.h')
-rw-r--r-- | arch/metag/include/asm/user_gateway.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/arch/metag/include/asm/user_gateway.h b/arch/metag/include/asm/user_gateway.h new file mode 100644 index 000000000000..e404c09e3b74 --- /dev/null +++ b/arch/metag/include/asm/user_gateway.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Imagination Technologies + */ + +#ifndef __ASM_METAG_USER_GATEWAY_H +#define __ASM_METAG_USER_GATEWAY_H + +#include <asm/page.h> + +/* Page of kernel code accessible to userspace. */ +#define USER_GATEWAY_PAGE 0x6ffff000 +/* Offset of TLS pointer array in gateway page. */ +#define USER_GATEWAY_TLS 0x100 + +#ifndef __ASSEMBLY__ + +extern char __user_gateway_start; +extern char __user_gateway_end; + +/* Kernel mapping of the gateway page. */ +extern void *gateway_page; + +static inline void set_gateway_tls(void __user *tls_ptr) +{ + void **gateway_tls = (void **)(gateway_page + USER_GATEWAY_TLS + + hard_processor_id() * 4); + + *gateway_tls = (__force void *)tls_ptr; +#ifdef CONFIG_METAG_META12 + /* Avoid cache aliases on virtually tagged cache. */ + __builtin_dcache_flush((void *)USER_GATEWAY_PAGE + USER_GATEWAY_TLS + + hard_processor_id() * sizeof(void *)); +#endif +} + +extern int __kuser_get_tls(void); +extern char *__kuser_get_tls_end[]; + +extern int __kuser_cmpxchg(int, int, unsigned long *); +extern char *__kuser_cmpxchg_end[]; + +#endif + +#endif |