Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
uasm.c File Reference
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/init.h>
#include <asm/inst.h>
#include <asm/elf.h>
#include <asm/bugs.h>
#include <asm/uasm.h>

Go to the source code of this file.

Data Structures

struct  insn
 

Macros

#define OP_MASK   0x3f
 
#define OP_SH   26
 
#define RS_MASK   0x1f
 
#define RS_SH   21
 
#define RT_MASK   0x1f
 
#define RT_SH   16
 
#define RD_MASK   0x1f
 
#define RD_SH   11
 
#define RE_MASK   0x1f
 
#define RE_SH   6
 
#define IMM_MASK   0xffff
 
#define IMM_SH   0
 
#define JIMM_MASK   0x3ffffff
 
#define JIMM_SH   0
 
#define FUNC_MASK   0x3f
 
#define FUNC_SH   0
 
#define SET_MASK   0x7
 
#define SET_SH   0
 
#define SCIMM_MASK   0xfffff
 
#define SCIMM_SH   6
 
#define M(a, b, c, d, e, f)
 
#define I_u1u2u3(op)
 
#define I_u2u1u3(op)
 
#define I_u3u1u2(op)
 
#define I_u1u2s3(op)
 
#define I_u2s3u1(op)
 
#define I_u2u1s3(op)
 
#define I_u2u1msbu3(op)
 
#define I_u2u1msb32u3(op)
 
#define I_u2u1msbdu3(op)
 
#define I_u1u2(op)
 
#define I_u1s2(op)
 
#define I_u1(op)
 
#define I_0(op)
 

Enumerations

enum  fields {
  RS = 0x001, RT = 0x002, RD = 0x004, RE = 0x008,
  SIMM = 0x010, UIMM = 0x020, BIMM = 0x040, JIMM = 0x080,
  FUNC = 0x100, SET = 0x200, SCIMM = 0x400
}
 
enum  opcode {
  insn_invalid, insn_addiu, insn_addu, insn_and,
  insn_andi, insn_bbit0, insn_bbit1, insn_beq,
  insn_beql, insn_bgez, insn_bgezl, insn_bltz,
  insn_bltzl, insn_bne, insn_cache, insn_daddiu,
  insn_daddu, insn_dins, insn_dinsm, insn_dmfc0,
  insn_dmtc0, insn_drotr, insn_drotr32, insn_dsll,
  insn_dsll32, insn_dsra, insn_dsrl, insn_dsrl32,
  insn_dsubu, insn_eret, insn_ext, insn_ins,
  insn_j, insn_jal, insn_jr, insn_ld,
  insn_ldx, insn_ll, insn_lld, insn_lui,
  insn_lw, insn_lwx, insn_mfc0, insn_mtc0,
  insn_or, insn_ori, insn_pref, insn_rfe,
  insn_rotr, insn_sc, insn_scd, insn_sd,
  insn_sll, insn_sra, insn_srl, insn_subu,
  insn_sw, insn_syscall, insn_tlbp, insn_tlbr,
  insn_tlbwi, insn_tlbwr, insn_xor, insn_xori
}
 

Functions

 I_u2u1s3 (_addiu)
 
 UASM_EXPORT_SYMBOL (uasm_build_label)
 
int __uasminit uasm_in_compat_space_p (long addr)
 
 UASM_EXPORT_SYMBOL (uasm_in_compat_space_p)
 
int __uasminit uasm_rel_hi (long val)
 
 UASM_EXPORT_SYMBOL (uasm_rel_hi)
 
int __uasminit uasm_rel_lo (long val)
 
 UASM_EXPORT_SYMBOL (uasm_rel_lo)
 
void __uasminit UASM_i_LA_mostly (u32 **buf, unsigned int rs, long addr)
 
 UASM_EXPORT_SYMBOL (UASM_i_LA_mostly)
 
void __uasminit UASM_i_LA (u32 **buf, unsigned int rs, long addr)
 
 UASM_EXPORT_SYMBOL (UASM_i_LA)
 
void __uasminit uasm_r_mips_pc16 (struct uasm_reloc **rel, u32 *addr, int lid)
 
 UASM_EXPORT_SYMBOL (uasm_r_mips_pc16)
 
void __uasminit uasm_resolve_relocs (struct uasm_reloc *rel, struct uasm_label *lab)
 
 UASM_EXPORT_SYMBOL (uasm_resolve_relocs)
 
void __uasminit uasm_move_relocs (struct uasm_reloc *rel, u32 *first, u32 *end, long off)
 
 UASM_EXPORT_SYMBOL (uasm_move_relocs)
 
void __uasminit uasm_move_labels (struct uasm_label *lab, u32 *first, u32 *end, long off)
 
 UASM_EXPORT_SYMBOL (uasm_move_labels)
 
void __uasminit uasm_copy_handler (struct uasm_reloc *rel, struct uasm_label *lab, u32 *first, u32 *end, u32 *target)
 
 UASM_EXPORT_SYMBOL (uasm_copy_handler)
 
int __uasminit uasm_insn_has_bdelay (struct uasm_reloc *rel, u32 *addr)
 
 UASM_EXPORT_SYMBOL (uasm_insn_has_bdelay)
 
void __uasminit uasm_il_bltz (u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
 
 UASM_EXPORT_SYMBOL (uasm_il_bltz)
 
void __uasminit uasm_il_b (u32 **p, struct uasm_reloc **r, int lid)
 
 UASM_EXPORT_SYMBOL (uasm_il_b)
 
void __uasminit uasm_il_beqz (u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
 
 UASM_EXPORT_SYMBOL (uasm_il_beqz)
 
void __uasminit uasm_il_beqzl (u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
 
 UASM_EXPORT_SYMBOL (uasm_il_beqzl)
 
void __uasminit uasm_il_bne (u32 **p, struct uasm_reloc **r, unsigned int reg1, unsigned int reg2, int lid)
 
 UASM_EXPORT_SYMBOL (uasm_il_bne)
 
void __uasminit uasm_il_bnez (u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
 
 UASM_EXPORT_SYMBOL (uasm_il_bnez)
 
void __uasminit uasm_il_bgezl (u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
 
 UASM_EXPORT_SYMBOL (uasm_il_bgezl)
 
void __uasminit uasm_il_bgez (u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
 
 UASM_EXPORT_SYMBOL (uasm_il_bgez)
 
void __uasminit uasm_il_bbit0 (u32 **p, struct uasm_reloc **r, unsigned int reg, unsigned int bit, int lid)
 
 UASM_EXPORT_SYMBOL (uasm_il_bbit0)
 
void __uasminit uasm_il_bbit1 (u32 **p, struct uasm_reloc **r, unsigned int reg, unsigned int bit, int lid)
 
 UASM_EXPORT_SYMBOL (uasm_il_bbit1)
 

Macro Definition Documentation

#define FUNC_MASK   0x3f

Definition at line 52 of file uasm.c.

#define FUNC_SH   0

Definition at line 53 of file uasm.c.

#define I_0 (   op)
Value:
Ip_0(op) \
{ \
build_insn(buf, insn##op); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 376 of file uasm.c.

#define I_u1 (   op)
Value:
{ \
build_insn(buf, insn##op, a); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 369 of file uasm.c.

#define I_u1s2 (   op)
Value:
{ \
build_insn(buf, insn##op, a, b); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 362 of file uasm.c.

#define I_u1u2 (   op)
Value:
{ \
build_insn(buf, insn##op, a, b); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 355 of file uasm.c.

#define I_u1u2s3 (   op)
Value:
{ \
build_insn(buf, insn##op, a, b, c); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 313 of file uasm.c.

#define I_u1u2u3 (   op)
Value:
{ \
build_insn(buf, insn##op, a, b, c); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 292 of file uasm.c.

#define I_u2s3u1 (   op)
Value:
{ \
build_insn(buf, insn##op, c, a, b); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 320 of file uasm.c.

#define I_u2u1msb32u3 (   op)
Value:
{ \
build_insn(buf, insn##op, b, a, c+d-33, c); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 341 of file uasm.c.

#define I_u2u1msbdu3 (   op)
Value:
{ \
build_insn(buf, insn##op, b, a, d-1, c); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 348 of file uasm.c.

#define I_u2u1msbu3 (   op)
Value:
{ \
build_insn(buf, insn##op, b, a, c+d-1, c); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 334 of file uasm.c.

#define I_u2u1s3 (   op)
Value:
{ \
build_insn(buf, insn##op, b, a, c); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 327 of file uasm.c.

#define I_u2u1u3 (   op)
Value:
{ \
build_insn(buf, insn##op, b, a, c); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 299 of file uasm.c.

#define I_u3u1u2 (   op)
Value:
{ \
build_insn(buf, insn##op, b, c, a); \
} \
UASM_EXPORT_SYMBOL(uasm_i##op);

Definition at line 306 of file uasm.c.

#define IMM_MASK   0xffff

Definition at line 48 of file uasm.c.

#define IMM_SH   0

Definition at line 49 of file uasm.c.

#define JIMM_MASK   0x3ffffff

Definition at line 50 of file uasm.c.

#define JIMM_SH   0

Definition at line 51 of file uasm.c.

#define M (   a,
  b,
  c,
  d,
  e,
  f 
)
Value:
((a) << OP_SH \
| (b) << RS_SH \
| (c) << RT_SH \
| (d) << RD_SH \
| (e) << RE_SH \
| (f) << FUNC_SH)

Definition at line 81 of file uasm.c.

#define OP_MASK   0x3f

Definition at line 38 of file uasm.c.

#define OP_SH   26

Definition at line 39 of file uasm.c.

#define RD_MASK   0x1f

Definition at line 44 of file uasm.c.

#define RD_SH   11

Definition at line 45 of file uasm.c.

#define RE_MASK   0x1f

Definition at line 46 of file uasm.c.

#define RE_SH   6

Definition at line 47 of file uasm.c.

#define RS_MASK   0x1f

Definition at line 40 of file uasm.c.

#define RS_SH   21

Definition at line 41 of file uasm.c.

#define RT_MASK   0x1f

Definition at line 42 of file uasm.c.

#define RT_SH   16

Definition at line 43 of file uasm.c.

#define SCIMM_MASK   0xfffff

Definition at line 56 of file uasm.c.

#define SCIMM_SH   6

Definition at line 57 of file uasm.c.

#define SET_MASK   0x7

Definition at line 54 of file uasm.c.

#define SET_SH   0

Definition at line 55 of file uasm.c.

Enumeration Type Documentation

enum fields
Enumerator:
RS 
RT 
RD 
RE 
SIMM 
UIMM 
BIMM 
JIMM 
FUNC 
SET 
SCIMM 

Definition at line 24 of file uasm.c.

enum u8 opcode
Enumerator:
insn_invalid 
insn_addiu 
insn_addu 
insn_and 
insn_andi 
insn_bbit0 
insn_bbit1 
insn_beq 
insn_beql 
insn_bgez 
insn_bgezl 
insn_bltz 
insn_bltzl 
insn_bne 
insn_cache 
insn_daddiu 
insn_daddu 
insn_dins 
insn_dinsm 
insn_dmfc0 
insn_dmtc0 
insn_drotr 
insn_drotr32 
insn_dsll 
insn_dsll32 
insn_dsra 
insn_dsrl 
insn_dsrl32 
insn_dsubu 
insn_eret 
insn_ext 
insn_ins 
insn_j 
insn_jal 
insn_jr 
insn_ld 
insn_ldx 
insn_ll 
insn_lld 
insn_lui 
insn_lw 
insn_lwx 
insn_mfc0 
insn_mtc0 
insn_or 
insn_ori 
insn_pref 
insn_rfe 
insn_rotr 
insn_sc 
insn_scd 
insn_sd 
insn_sll 
insn_sra 
insn_srl 
insn_subu 
insn_sw 
insn_syscall 
insn_tlbp 
insn_tlbr 
insn_tlbwi 
insn_tlbwr 
insn_xor 
insn_xori 

Definition at line 59 of file uasm.c.

Function Documentation

I_u2u1s3 ( _addiu  )

Definition at line 383 of file uasm.c.

void __uasminit uasm_copy_handler ( struct uasm_reloc rel,
struct uasm_label lab,
u32 first,
u32 end,
u32 target 
)

Definition at line 603 of file uasm.c.

UASM_EXPORT_SYMBOL ( uasm_build_label  )
UASM_EXPORT_SYMBOL ( uasm_in_compat_space_p  )
UASM_EXPORT_SYMBOL ( uasm_rel_hi  )
UASM_EXPORT_SYMBOL ( uasm_rel_lo  )
UASM_EXPORT_SYMBOL ( UASM_i_LA_mostly  )
UASM_EXPORT_SYMBOL ( UASM_i_LA  )
UASM_EXPORT_SYMBOL ( uasm_r_mips_pc16  )
UASM_EXPORT_SYMBOL ( uasm_resolve_relocs  )
UASM_EXPORT_SYMBOL ( uasm_move_relocs  )
UASM_EXPORT_SYMBOL ( uasm_move_labels  )
UASM_EXPORT_SYMBOL ( uasm_copy_handler  )
UASM_EXPORT_SYMBOL ( uasm_insn_has_bdelay  )
UASM_EXPORT_SYMBOL ( uasm_il_bltz  )
UASM_EXPORT_SYMBOL ( uasm_il_b  )
UASM_EXPORT_SYMBOL ( uasm_il_beqz  )
UASM_EXPORT_SYMBOL ( uasm_il_beqzl  )
UASM_EXPORT_SYMBOL ( uasm_il_bne  )
UASM_EXPORT_SYMBOL ( uasm_il_bnez  )
UASM_EXPORT_SYMBOL ( uasm_il_bgezl  )
UASM_EXPORT_SYMBOL ( uasm_il_bgez  )
UASM_EXPORT_SYMBOL ( uasm_il_bbit0  )
UASM_EXPORT_SYMBOL ( uasm_il_bbit1  )
void __uasminit UASM_i_LA ( u32 **  buf,
unsigned int  rs,
long  addr 
)

Definition at line 532 of file uasm.c.

void __uasminit UASM_i_LA_mostly ( u32 **  buf,
unsigned int  rs,
long  addr 
)

Definition at line 515 of file uasm.c.

void __uasminit uasm_il_b ( u32 **  p,
struct uasm_reloc **  r,
int  lid 
)

Definition at line 638 of file uasm.c.

void __uasminit uasm_il_bbit0 ( u32 **  p,
struct uasm_reloc **  r,
unsigned int  reg,
unsigned int  bit,
int  lid 
)

Definition at line 695 of file uasm.c.

void __uasminit uasm_il_bbit1 ( u32 **  p,
struct uasm_reloc **  r,
unsigned int  reg,
unsigned int  bit,
int  lid 
)

Definition at line 704 of file uasm.c.

void __uasminit uasm_il_beqz ( u32 **  p,
struct uasm_reloc **  r,
unsigned int  reg,
int  lid 
)

Definition at line 646 of file uasm.c.

void __uasminit uasm_il_beqzl ( u32 **  p,
struct uasm_reloc **  r,
unsigned int  reg,
int  lid 
)

Definition at line 654 of file uasm.c.

void __uasminit uasm_il_bgez ( u32 **  p,
struct uasm_reloc **  r,
unsigned int  reg,
int  lid 
)

Definition at line 687 of file uasm.c.

void __uasminit uasm_il_bgezl ( u32 **  p,
struct uasm_reloc **  r,
unsigned int  reg,
int  lid 
)

Definition at line 679 of file uasm.c.

void __uasminit uasm_il_bltz ( u32 **  p,
struct uasm_reloc **  r,
unsigned int  reg,
int  lid 
)

Definition at line 630 of file uasm.c.

void __uasminit uasm_il_bne ( u32 **  p,
struct uasm_reloc **  r,
unsigned int  reg1,
unsigned int  reg2,
int  lid 
)

Definition at line 662 of file uasm.c.

void __uasminit uasm_il_bnez ( u32 **  p,
struct uasm_reloc **  r,
unsigned int  reg,
int  lid 
)

Definition at line 671 of file uasm.c.

int __uasminit uasm_in_compat_space_p ( long  addr)

Definition at line 474 of file uasm.c.

int __uasminit uasm_insn_has_bdelay ( struct uasm_reloc rel,
u32 addr 
)

Definition at line 615 of file uasm.c.

void __uasminit uasm_move_labels ( struct uasm_label lab,
u32 first,
u32 end,
long  off 
)

Definition at line 594 of file uasm.c.

void __uasminit uasm_move_relocs ( struct uasm_reloc rel,
u32 first,
u32 end,
long  off 
)

Definition at line 585 of file uasm.c.

void __uasminit uasm_r_mips_pc16 ( struct uasm_reloc **  rel,
u32 addr,
int  lid 
)

Definition at line 546 of file uasm.c.

int __uasminit uasm_rel_hi ( long  val)

Definition at line 503 of file uasm.c.

int __uasminit uasm_rel_lo ( long  val)

Definition at line 509 of file uasm.c.

void __uasminit uasm_resolve_relocs ( struct uasm_reloc rel,
struct uasm_label lab 
)

Definition at line 573 of file uasm.c.