root/include/stubs_asm.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 // Common definitions for stubs_entry.S and stubs_entry_2.S macros
   2 
   3     .text
   4 
   5 #define DEF(n,a) \
   6     .globl n; n = a
   7 
   8 #ifndef THUMB_FW
   9 
  10 #if defined(OPT_FIRMWARE_PC24_CALL)
  11 
  12 #define NHSTUB(name, addr)\
  13     .globl _##name ;\
  14     .weak _##name ;\
  15     _##name = ## addr
  16 
  17 #define STUB(addr)\
  18     .globl sub_ ## addr ;\
  19     sub_ ## addr = 0x ## addr
  20 
  21 #else
  22 
  23 #define NHSTUB(name, addr)\
  24     .globl _##name ;\
  25     .weak _##name ;\
  26     _##name: ;\
  27         ldr  pc, = ## addr
  28 
  29 #define STUB(addr)\
  30     .globl sub_ ## addr ;\
  31     sub_ ## addr: ;\
  32         ldr  pc, =0x ## addr
  33 
  34 #endif
  35 
  36 #else // DIGIC 6
  37 
  38 // macros for ARMv7 Thumb2
  39 
  40 .syntax unified
  41 
  42 #define NHSTUB(name, addr)\
  43     .globl _##name ;\
  44     .weak _##name ;\
  45     _##name: ;\
  46     .code 16 ;\
  47     ldr.w pc, [pc, #0] ;\
  48     .long addr
  49 
  50 // for ExecuteEventProcedure...
  51 #define NHSTUB2(name, addr)\
  52     .globl _##name ;\
  53     .weak _##name ;\
  54     _##name: ;\
  55     .code 32 ;\
  56     ldr pc, [pc, #-4] ;\
  57     .code 16 ;\
  58     .long addr
  59 
  60 #define STUB(addr)\
  61     .globl sub_ ## addr ;\
  62     sub_ ## addr: ;\
  63     .code 16 ;\
  64     ldr.w pc, [pc, #0] ;\
  65     .long 0x ## addr | 1
  66 
  67 // to be used with 'blx <label>' instructions found in thumb fw routines
  68 #define STUB2(addr)\
  69     .globl sub_ ## addr ;\
  70     sub_ ## addr: ;\
  71     .code 32 ;\
  72     ldr   pc, [pc, #-4] ;\
  73     .code 16 ;\
  74     .long 0x ## addr
  75 
  76 #endif // DIGIC 6
  77 
  78 // allocate space for variables that are not found and CHDK may alter them
  79 #define FAKEDEF(n, m) \
  80     .globl n; n: ;\
  81     .rept m ; \
  82     .long 0 ; \
  83     .endr
  84 
  85 // Force finsig to ignore firmware version of a function - used when a custom
  86 // version is provided that completely replaces firmware code.
  87 //  e.g. IGNORE(MoveFocusLensToDistance) for a410 - alternate function supplied in focushack.c
  88 #define IGNORE(name)
  89 
  90 // Enable outputting constants from stubs_entry.S
  91 #define DEF_CONST(n, m) \
  92     .globl n; n: ;\
  93     .long m

/* [<][>][^][v][top][bottom][index][help] */