forked from luck/tmp_suning_uos_patched
18aecc2b64
This support was partially present in the existing code (look for "__tilegx__" ifdefs) but with this change you can build a working kernel using the TILE-Gx toolchain and ARCH=tilegx. Most of these files are new, generally adding a foo_64.c file where previously there was just a foo_32.c file. The ARCH=tilegx directive redirects to arch/tile, not arch/tilegx, using the existing SRCARCH mechanism in the top-level Makefile. Changes to existing files: - <asm/bitops.h> and <asm/bitops_32.h> changed to factor the include of <asm-generic/bitops/non-atomic.h> in the common header. - <asm/compat.h> and arch/tile/kernel/compat.c changed to remove the "const" markers I had put on compat_sys_execve() when trying to match some recent similar changes to the non-compat execve. It turns out the compat version wasn't "upgraded" to use const. - <asm/opcode-tile_64.h> and <asm/opcode_constants_64.h> were previously included accidentally, with the 32-bit contents. Now they have the proper 64-bit contents. Finally, I had to hack the existing hacky drivers/input/input-compat.h to add yet another "#ifdef" for INPUT_COMPAT_TEST (same as x86_64). Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> [drivers/input]
56 lines
1.6 KiB
ArmAsm
56 lines
1.6 KiB
ArmAsm
/*
|
|
* Copyright 2011 Tilera Corporation. All Rights Reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation, version 2.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
|
* NON INFRINGEMENT. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* Atomically access user memory, but use MMU to avoid propagating
|
|
* kernel exceptions.
|
|
*/
|
|
|
|
#include <linux/linkage.h>
|
|
#include <asm/errno.h>
|
|
#include <asm/futex.h>
|
|
#include <asm/page.h>
|
|
#include <asm/processor.h>
|
|
|
|
/*
|
|
* Provide a set of atomic memory operations supporting <asm/futex.h>.
|
|
*
|
|
* r0: user address to manipulate
|
|
* r1: new value to write, or for cmpxchg, old value to compare against
|
|
* r2: (cmpxchg only) new value to write
|
|
*
|
|
* Return __get_user struct, r0 with value, r1 with error.
|
|
*/
|
|
#define FUTEX_OP(name, ...) \
|
|
STD_ENTRY(futex_##name) \
|
|
__VA_ARGS__; \
|
|
{ \
|
|
move r1, zero; \
|
|
jrp lr \
|
|
}; \
|
|
STD_ENDPROC(futex_##name); \
|
|
.pushsection __ex_table,"a"; \
|
|
.quad 1b, get_user_fault; \
|
|
.popsection
|
|
|
|
.pushsection .fixup,"ax"
|
|
get_user_fault:
|
|
{ movei r1, -EFAULT; jrp lr }
|
|
ENDPROC(get_user_fault)
|
|
.popsection
|
|
|
|
FUTEX_OP(cmpxchg, mtspr CMPEXCH_VALUE, r1; 1: cmpexch4 r0, r0, r2)
|
|
FUTEX_OP(set, 1: exch4 r0, r0, r1)
|
|
FUTEX_OP(add, 1: fetchadd4 r0, r0, r1)
|
|
FUTEX_OP(or, 1: fetchor4 r0, r0, r1)
|
|
FUTEX_OP(andn, nor r1, r1, zero; 1: fetchand4 r0, r0, r1)
|