diff options
Diffstat (limited to 'arch/openrisc/include/asm/unaligned.h')
-rw-r--r-- | arch/openrisc/include/asm/unaligned.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/openrisc/include/asm/unaligned.h b/arch/openrisc/include/asm/unaligned.h new file mode 100644 index 000000000000..1141cbd6fd72 --- /dev/null +++ b/arch/openrisc/include/asm/unaligned.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * OpenRISC Linux | ||
3 | * | ||
4 | * Linux architectural port borrowing liberally from similar works of | ||
5 | * others. All original copyrights apply as per the original source | ||
6 | * declaration. | ||
7 | * | ||
8 | * OpenRISC implementation: | ||
9 | * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> | ||
10 | * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> | ||
11 | * et al. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | */ | ||
18 | |||
19 | #ifndef __ASM_OPENRISC_UNALIGNED_H | ||
20 | #define __ASM_OPENRISC_UNALIGNED_H | ||
21 | |||
22 | /* | ||
23 | * This is copied from the generic implementation and the C-struct | ||
24 | * variant replaced with the memmove variant. The GCC compiler | ||
25 | * for the OR32 arch optimizes too aggressively for the C-struct | ||
26 | * variant to work, so use the memmove variant instead. | ||
27 | * | ||
28 | * It may be worth considering implementing the unaligned access | ||
29 | * exception handler and allowing unaligned accesses (access_ok.h)... | ||
30 | * not sure if it would be much of a performance win without further | ||
31 | * investigation. | ||
32 | */ | ||
33 | #include <asm/byteorder.h> | ||
34 | |||
35 | #if defined(__LITTLE_ENDIAN) | ||
36 | # include <linux/unaligned/le_memmove.h> | ||
37 | # include <linux/unaligned/be_byteshift.h> | ||
38 | # include <linux/unaligned/generic.h> | ||
39 | # define get_unaligned __get_unaligned_le | ||
40 | # define put_unaligned __put_unaligned_le | ||
41 | #elif defined(__BIG_ENDIAN) | ||
42 | # include <linux/unaligned/be_memmove.h> | ||
43 | # include <linux/unaligned/le_byteshift.h> | ||
44 | # include <linux/unaligned/generic.h> | ||
45 | # define get_unaligned __get_unaligned_be | ||
46 | # define put_unaligned __put_unaligned_be | ||
47 | #else | ||
48 | # error need to define endianess | ||
49 | #endif | ||
50 | |||
51 | #endif /* __ASM_OPENRISC_UNALIGNED_H */ | ||