The jump_table stores two 32-bit words and one 32- (on 32-bit kernel) or one 64-bit word (on 64-bit kernel). Ensure that the last word is always 64-bit aligned on a 64-bit kernel by aligning the whole structure on sizeof(long).
Unified · Split
| @@ -15,10 +15,12 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran · 14 unmodified lines | |||
| 15 | asm_volatile_goto("1:\n\t" | 15 | asm_volatile_goto("1:\n\t" |
| 16 | "nop\n\t" | 16 | "nop\n\t" |
| 17 | ".pushsection __jump_table, \"aw\"\n\t" | 17 | ".pushsection __jump_table, \"aw\"\n\t" |
| 18 | ".align %1\n\t" | ||
| 18 | ".word 1b - ., %l[l_yes] - .\n\t" | 19 | ".word 1b - ., %l[l_yes] - .\n\t" |
| 19 | __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" | 20 | __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" |
| 20 | ".popsection\n\t" | 21 | ".popsection\n\t" |
| 21 | : : "i" (&((char *)key)[branch]) : : l_yes); | 22 | : : "i" (&((char *)key)[branch]), "i" (sizeof(long)) |
| 23 | : : l_yes); | ||
| 22 | 24 | ||
| 23 | return false; | 25 | return false; |
| 24 | l_yes: | 26 | l_yes: |
| @@ -30,10 +32,12 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool · 5 unmodified lines | |||
| 30 | asm_volatile_goto("1:\n\t" | 32 | asm_volatile_goto("1:\n\t" |
| 31 | "b,n %l[l_yes]\n\t" | 33 | "b,n %l[l_yes]\n\t" |
| 32 | ".pushsection __jump_table, \"aw\"\n\t" | 34 | ".pushsection __jump_table, \"aw\"\n\t" |
| 35 | ".align %1\n\t" | ||
| 33 | ".word 1b - ., %l[l_yes] - .\n\t" | 36 | ".word 1b - ., %l[l_yes] - .\n\t" |
| 34 | __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" | 37 | __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" |
| 35 | ".popsection\n\t" | 38 | ".popsection\n\t" |
| 36 | : : "i" (&((char *)key)[branch]) : : l_yes); | 39 | : : "i" (&((char *)key)[branch]), "i" (sizeof(long)) |
| 40 | : : l_yes); | ||
| 37 | 41 | ||
| 38 | return false; | 42 | return false; |
| 39 | l_yes: | 43 | l_yes: |