Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
alignment.c File Reference
#include <linux/compiler.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
#include <asm/tlbflush.h>
#include <asm/unaligned.h>
#include "mm.h"

Go to the source code of this file.

Data Structures

union  offset_union
 

Macros

#define CODING_BITS(i)   (i & 0xe0000120)
 
#define LDST_P_BIT(i)   (i & (1 << 28)) /* Preindex */
 
#define LDST_U_BIT(i)   (i & (1 << 27)) /* Add offset */
 
#define LDST_W_BIT(i)   (i & (1 << 25)) /* Writeback */
 
#define LDST_L_BIT(i)   (i & (1 << 24)) /* Load */
 
#define LDST_P_EQ_U(i)   ((((i) ^ ((i) >> 1)) & (1 << 27)) == 0)
 
#define LDSTH_I_BIT(i)   (i & (1 << 26)) /* half-word immed */
 
#define LDM_S_BIT(i)   (i & (1 << 26)) /* write ASR from BSR */
 
#define LDM_H_BIT(i)   (i & (1 << 6)) /* select r0-r15 or r16-r31 */
 
#define RN_BITS(i)   ((i >> 19) & 31) /* Rn */
 
#define RD_BITS(i)   ((i >> 14) & 31) /* Rd */
 
#define RM_BITS(i)   (i & 31) /* Rm */
 
#define REGMASK_BITS(i)   (((i & 0x7fe00) >> 3) | (i & 0x3f))
 
#define OFFSET_BITS(i)   (i & 0x03fff)
 
#define SHIFT_BITS(i)   ((i >> 9) & 0x1f)
 
#define SHIFT_TYPE(i)   (i & 0xc0)
 
#define SHIFT_LSL   0x00
 
#define SHIFT_LSR   0x40
 
#define SHIFT_ASR   0x80
 
#define SHIFT_RORRRX   0xc0
 
#define TYPE_ERROR   0
 
#define TYPE_FAULT   1
 
#define TYPE_LDST   2
 
#define TYPE_DONE   3
 
#define TYPE_SWAP   4
 
#define TYPE_COLS   5 /* Coprocessor load/store */
 
#define get8_unaligned_check(val, addr, err)
 
#define get8t_unaligned_check(val, addr, err)
 
#define get16_unaligned_check(val, addr)
 
#define put16_unaligned_check(val, addr)
 
#define __put32_unaligned_check(ins, val, addr)
 
#define get32_unaligned_check(val, addr)
 
#define put32_unaligned_check(val, addr)   __put32_unaligned_check("stb.u", val, addr)
 
#define get32t_unaligned_check(val, addr)
 
#define put32t_unaligned_check(val, addr)   __put32_unaligned_check("stb.u", val, addr)
 

Functions

 fs_initcall (alignment_init)
 

Macro Definition Documentation

#define __put32_unaligned_check (   ins,
  val,
  addr 
)
Value:
do { \
unsigned int err = 0, v = val, a = addr; \
__asm__( \
"1: "ins" %1, [%2], #1\n" \
" mov %1, %1 >> #8\n" \
"2: "ins" %1, [%2], #1\n" \
" mov %1, %1 >> #8\n" \
"3: "ins" %1, [%2], #1\n" \
" mov %1, %1 >> #8\n" \
"4: "ins" %1, [%2]\n" \
"5:\n" \
" .pushsection .fixup,\"ax\"\n" \
" .align 2\n" \
"6: mov %0, #1\n" \
" b 5b\n" \
" .popsection\n" \
" .pushsection __ex_table,\"a\"\n" \
" .align 3\n" \
" .long 1b, 6b\n" \
" .long 2b, 6b\n" \
" .long 3b, 6b\n" \
" .long 4b, 6b\n" \
" .popsection\n" \
: "=r" (err), "=&r" (v), "=&r" (a) \
: "0" (err), "1" (v), "2" (a)); \
if (err) \
goto fault; \
} while (0)

Definition at line 134 of file alignment.c.

#define CODING_BITS (   i)    (i & 0xe0000120)

Definition at line 29 of file alignment.c.

#define get16_unaligned_check (   val,
  addr 
)
Value:
do { \
unsigned int err = 0, v, a = addr; \
get8_unaligned_check(val, a, err); \
get8_unaligned_check(v, a, err); \
val |= v << 8; \
if (err) \
goto fault; \
} while (0)

Definition at line 100 of file alignment.c.

#define get32_unaligned_check (   val,
  addr 
)
Value:
do { \
unsigned int err = 0, v, a = addr; \
get8_unaligned_check(val, a, err); \
get8_unaligned_check(v, a, err); \
val |= v << 8; \
get8_unaligned_check(v, a, err); \
val |= v << 16; \
get8_unaligned_check(v, a, err); \
val |= v << 24; \
if (err) \
goto fault; \
} while (0)

Definition at line 164 of file alignment.c.

#define get32t_unaligned_check (   val,
  addr 
)
Value:
do { \
unsigned int err = 0, v, a = addr; \
get8t_unaligned_check(val, a, err); \
get8t_unaligned_check(v, a, err); \
val |= v << 8; \
get8t_unaligned_check(v, a, err); \
val |= v << 16; \
get8t_unaligned_check(v, a, err); \
val |= v << 24; \
if (err) \
goto fault; \
} while (0)

Definition at line 181 of file alignment.c.

#define get8_unaligned_check (   val,
  addr,
  err 
)
Value:
"1: ldb.u %1, [%2], #1\n" \
"2:\n" \
" .pushsection .fixup,\"ax\"\n" \
" .align 2\n" \
"3: mov %0, #1\n" \
" b 2b\n" \
" .popsection\n" \
" .pushsection __ex_table,\"a\"\n" \
" .align 3\n" \
" .long 1b, 3b\n" \
" .popsection\n" \
: "=r" (err), "=&r" (val), "=r" (addr) \
: "0" (err), "2" (addr))

Definition at line 68 of file alignment.c.

#define get8t_unaligned_check (   val,
  addr,
  err 
)
Value:
"1: ldb.u %1, [%2], #1\n" \
"2:\n" \
" .pushsection .fixup,\"ax\"\n" \
" .align 2\n" \
"3: mov %0, #1\n" \
" b 2b\n" \
" .popsection\n" \
" .pushsection __ex_table,\"a\"\n" \
" .align 3\n" \
" .long 1b, 3b\n" \
" .popsection\n" \
: "=r" (err), "=&r" (val), "=r" (addr) \
: "0" (err), "2" (addr))

Definition at line 84 of file alignment.c.

#define LDM_H_BIT (   i)    (i & (1 << 6)) /* select r0-r15 or r16-r31 */

Definition at line 40 of file alignment.c.

#define LDM_S_BIT (   i)    (i & (1 << 26)) /* write ASR from BSR */

Definition at line 39 of file alignment.c.

#define LDST_L_BIT (   i)    (i & (1 << 24)) /* Load */

Definition at line 34 of file alignment.c.

#define LDST_P_BIT (   i)    (i & (1 << 28)) /* Preindex */

Definition at line 31 of file alignment.c.

#define LDST_P_EQ_U (   i)    ((((i) ^ ((i) >> 1)) & (1 << 27)) == 0)

Definition at line 36 of file alignment.c.

#define LDST_U_BIT (   i)    (i & (1 << 27)) /* Add offset */

Definition at line 32 of file alignment.c.

#define LDST_W_BIT (   i)    (i & (1 << 25)) /* Writeback */

Definition at line 33 of file alignment.c.

#define LDSTH_I_BIT (   i)    (i & (1 << 26)) /* half-word immed */

Definition at line 38 of file alignment.c.

#define OFFSET_BITS (   i)    (i & 0x03fff)

Definition at line 47 of file alignment.c.

#define put16_unaligned_check (   val,
  addr 
)
Value:
do { \
unsigned int err = 0, v = val, a = addr; \
__asm__( \
"1: stb.u %1, [%2], #1\n" \
" mov %1, %1 >> #8\n" \
"2: stb.u %1, [%2]\n" \
"3:\n" \
" .pushsection .fixup,\"ax\"\n" \
" .align 2\n" \
"4: mov %0, #1\n" \
" b 3b\n" \
" .popsection\n" \
" .pushsection __ex_table,\"a\"\n" \
" .align 3\n" \
" .long 1b, 4b\n" \
" .long 2b, 4b\n" \
" .popsection\n" \
: "=r" (err), "=&r" (v), "=&r" (a) \
: "0" (err), "1" (v), "2" (a)); \
if (err) \
goto fault; \
} while (0)

Definition at line 110 of file alignment.c.

#define put32_unaligned_check (   val,
  addr 
)    __put32_unaligned_check("stb.u", val, addr)

Definition at line 178 of file alignment.c.

#define put32t_unaligned_check (   val,
  addr 
)    __put32_unaligned_check("stb.u", val, addr)

Definition at line 195 of file alignment.c.

#define RD_BITS (   i)    ((i >> 14) & 31) /* Rd */

Definition at line 43 of file alignment.c.

#define REGMASK_BITS (   i)    (((i & 0x7fe00) >> 3) | (i & 0x3f))

Definition at line 46 of file alignment.c.

#define RM_BITS (   i)    (i & 31) /* Rm */

Definition at line 44 of file alignment.c.

#define RN_BITS (   i)    ((i >> 19) & 31) /* Rn */

Definition at line 42 of file alignment.c.

#define SHIFT_ASR   0x80

Definition at line 53 of file alignment.c.

#define SHIFT_BITS (   i)    ((i >> 9) & 0x1f)

Definition at line 49 of file alignment.c.

#define SHIFT_LSL   0x00

Definition at line 51 of file alignment.c.

#define SHIFT_LSR   0x40

Definition at line 52 of file alignment.c.

#define SHIFT_RORRRX   0xc0

Definition at line 54 of file alignment.c.

#define SHIFT_TYPE (   i)    (i & 0xc0)

Definition at line 50 of file alignment.c.

#define TYPE_COLS   5 /* Coprocessor load/store */

Definition at line 66 of file alignment.c.

#define TYPE_DONE   3

Definition at line 64 of file alignment.c.

#define TYPE_ERROR   0

Definition at line 61 of file alignment.c.

#define TYPE_FAULT   1

Definition at line 62 of file alignment.c.

#define TYPE_LDST   2

Definition at line 63 of file alignment.c.

#define TYPE_SWAP   4

Definition at line 65 of file alignment.c.

Function Documentation

fs_initcall ( alignment_init  )