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/moduleparam.h>
#include <linux/compiler.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
#include <asm/cp15.h>
#include <asm/system_info.h>
#include <asm/unaligned.h>
#include "fault.h"

Go to the source code of this file.

Data Structures

union  offset_union
 

Macros

#define CODING_BITS(i)   (i & 0x0e000000)
 
#define LDST_I_BIT(i)   (i & (1 << 26)) /* Immediate constant */
 
#define LDST_P_BIT(i)   (i & (1 << 24)) /* Preindex */
 
#define LDST_U_BIT(i)   (i & (1 << 23)) /* Add offset */
 
#define LDST_W_BIT(i)   (i & (1 << 21)) /* Writeback */
 
#define LDST_L_BIT(i)   (i & (1 << 20)) /* Load */
 
#define LDST_P_EQ_U(i)   ((((i) ^ ((i) >> 1)) & (1 << 23)) == 0)
 
#define LDSTHD_I_BIT(i)   (i & (1 << 22)) /* double/half-word immed */
 
#define LDM_S_BIT(i)   (i & (1 << 22)) /* write CPSR from SPSR */
 
#define RN_BITS(i)   ((i >> 16) & 15) /* Rn */
 
#define RD_BITS(i)   ((i >> 12) & 15) /* Rd */
 
#define RM_BITS(i)   (i & 15) /* Rm */
 
#define REGMASK_BITS(i)   (i & 0xffff)
 
#define OFFSET_BITS(i)   (i & 0x0fff)
 
#define IS_SHIFT(i)   (i & 0x0ff0)
 
#define SHIFT_BITS(i)   ((i >> 7) & 0x1f)
 
#define SHIFT_TYPE(i)   (i & 0x60)
 
#define SHIFT_LSL   0x00
 
#define SHIFT_LSR   0x20
 
#define SHIFT_ASR   0x40
 
#define SHIFT_RORRRX   0x60
 
#define BAD_INSTR   0xdeadc0de
 
#define IS_T32(hi16)   (((hi16) & 0xe000) == 0xe000 && ((hi16) & 0x1800))
 
#define UM_WARN   (1 << 0)
 
#define UM_FIXUP   (1 << 1)
 
#define UM_SIGNAL   (1 << 2)
 
#define TYPE_ERROR   0
 
#define TYPE_FAULT   1
 
#define TYPE_LDST   2
 
#define TYPE_DONE   3
 
#define BE   0
 
#define FIRST_BYTE_16
 
#define FIRST_BYTE_32
 
#define NEXT_BYTE   "lsr #8"
 
#define __get8_unaligned_check(ins, val, addr, err)
 
#define __get16_unaligned_check(ins, val, addr)
 
#define get16_unaligned_check(val, addr)   __get16_unaligned_check("ldrb",val,addr)
 
#define get16t_unaligned_check(val, addr)   __get16_unaligned_check("ldrbt",val,addr)
 
#define __get32_unaligned_check(ins, val, addr)
 
#define get32_unaligned_check(val, addr)   __get32_unaligned_check("ldrb",val,addr)
 
#define get32t_unaligned_check(val, addr)   __get32_unaligned_check("ldrbt",val,addr)
 
#define __put16_unaligned_check(ins, val, addr)
 
#define put16_unaligned_check(val, addr)   __put16_unaligned_check("strb",val,addr)
 
#define put16t_unaligned_check(val, addr)   __put16_unaligned_check("strbt",val,addr)
 
#define __put32_unaligned_check(ins, val, addr)
 
#define put32_unaligned_check(val, addr)   __put32_unaligned_check("strb", val, addr)
 
#define put32t_unaligned_check(val, addr)   __put32_unaligned_check("strbt", val, addr)
 

Functions

 core_param (alignment, ai_usermode, int, 0600)
 
 fs_initcall (alignment_init)
 

Macro Definition Documentation

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

Definition at line 211 of file alignment.c.

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

Definition at line 228 of file alignment.c.

#define __get8_unaligned_check (   ins,
  val,
  addr,
  err 
)
Value:
ARM( "1: "ins" %1, [%2], #1\n" ) \
THUMB( "1: "ins" %1, [%2]\n" ) \
THUMB( " add %2, %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 193 of file alignment.c.

#define __put16_unaligned_check (   ins,
  val,
  addr 
)
Value:
do { \
unsigned int err = 0, v = val, a = addr; \
__asm__( FIRST_BYTE_16 \
ARM( "1: "ins" %1, [%2], #1\n" ) \
THUMB( "1: "ins" %1, [%2]\n" ) \
THUMB( " add %2, %2, #1\n" ) \
" mov %1, %1, "NEXT_BYTE"\n" \
"2: "ins" %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 249 of file alignment.c.

#define __put32_unaligned_check (   ins,
  val,
  addr 
)

Definition at line 281 of file alignment.c.

#define BAD_INSTR   0xdeadc0de

Definition at line 69 of file alignment.c.

#define BE   0

Definition at line 187 of file alignment.c.

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

Definition at line 41 of file alignment.c.

#define FIRST_BYTE_16

Definition at line 188 of file alignment.c.

#define FIRST_BYTE_32

Definition at line 189 of file alignment.c.

#define get16_unaligned_check (   val,
  addr 
)    __get16_unaligned_check("ldrb",val,addr)

Definition at line 222 of file alignment.c.

#define get16t_unaligned_check (   val,
  addr 
)    __get16_unaligned_check("ldrbt",val,addr)

Definition at line 225 of file alignment.c.

#define get32_unaligned_check (   val,
  addr 
)    __get32_unaligned_check("ldrb",val,addr)

Definition at line 243 of file alignment.c.

#define get32t_unaligned_check (   val,
  addr 
)    __get32_unaligned_check("ldrbt",val,addr)

Definition at line 246 of file alignment.c.

#define IS_SHIFT (   i)    (i & 0x0ff0)

Definition at line 61 of file alignment.c.

#define IS_T32 (   hi16)    (((hi16) & 0xe000) == 0xe000 && ((hi16) & 0x1800))

Definition at line 72 of file alignment.c.

#define LDM_S_BIT (   i)    (i & (1 << 22)) /* write CPSR from SPSR */

Definition at line 52 of file alignment.c.

#define LDST_I_BIT (   i)    (i & (1 << 26)) /* Immediate constant */

Definition at line 43 of file alignment.c.

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

Definition at line 47 of file alignment.c.

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

Definition at line 44 of file alignment.c.

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

Definition at line 49 of file alignment.c.

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

Definition at line 45 of file alignment.c.

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

Definition at line 46 of file alignment.c.

#define LDSTHD_I_BIT (   i)    (i & (1 << 22)) /* double/half-word immed */

Definition at line 51 of file alignment.c.

#define NEXT_BYTE   "lsr #8"

Definition at line 190 of file alignment.c.

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

Definition at line 59 of file alignment.c.

#define put16_unaligned_check (   val,
  addr 
)    __put16_unaligned_check("strb",val,addr)

Definition at line 275 of file alignment.c.

#define put16t_unaligned_check (   val,
  addr 
)    __put16_unaligned_check("strbt",val,addr)

Definition at line 278 of file alignment.c.

#define put32_unaligned_check (   val,
  addr 
)    __put32_unaligned_check("strb", val, addr)

Definition at line 317 of file alignment.c.

#define put32t_unaligned_check (   val,
  addr 
)    __put32_unaligned_check("strbt", val, addr)

Definition at line 320 of file alignment.c.

#define RD_BITS (   i)    ((i >> 12) & 15) /* Rd */

Definition at line 55 of file alignment.c.

#define REGMASK_BITS (   i)    (i & 0xffff)

Definition at line 58 of file alignment.c.

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

Definition at line 56 of file alignment.c.

#define RN_BITS (   i)    ((i >> 16) & 15) /* Rn */

Definition at line 54 of file alignment.c.

#define SHIFT_ASR   0x40

Definition at line 66 of file alignment.c.

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

Definition at line 62 of file alignment.c.

#define SHIFT_LSL   0x00

Definition at line 64 of file alignment.c.

#define SHIFT_LSR   0x20

Definition at line 65 of file alignment.c.

#define SHIFT_RORRRX   0x60

Definition at line 67 of file alignment.c.

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

Definition at line 63 of file alignment.c.

#define TYPE_DONE   3

Definition at line 179 of file alignment.c.

#define TYPE_ERROR   0

Definition at line 176 of file alignment.c.

#define TYPE_FAULT   1

Definition at line 177 of file alignment.c.

#define TYPE_LDST   2

Definition at line 178 of file alignment.c.

#define UM_FIXUP   (1 << 1)

Definition at line 87 of file alignment.c.

#define UM_SIGNAL   (1 << 2)

Definition at line 88 of file alignment.c.

#define UM_WARN   (1 << 0)

Definition at line 86 of file alignment.c.

Function Documentation

core_param ( alignment  ,
ai_usermode  ,
int  ,
0600   
)
fs_initcall ( alignment_init  )