Ard Biesheuvel | 214fad5 | 2017-03-31 08:55:33 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 Linaro, Ltd. <ard.biesheuvel@linaro.org> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | #include <linux/linkage.h> |
| 11 | |
| 12 | ENTRY(absolute_data64) |
| 13 | ldr x0, 0f |
| 14 | ret |
| 15 | 0: .quad sym64_abs |
| 16 | ENDPROC(absolute_data64) |
| 17 | |
| 18 | ENTRY(absolute_data32) |
| 19 | ldr w0, 0f |
| 20 | ret |
| 21 | 0: .long sym32_abs |
| 22 | ENDPROC(absolute_data32) |
| 23 | |
| 24 | ENTRY(absolute_data16) |
| 25 | adr x0, 0f |
| 26 | ldrh w0, [x0] |
| 27 | ret |
| 28 | 0: .short sym16_abs, 0 |
| 29 | ENDPROC(absolute_data16) |
| 30 | |
| 31 | ENTRY(signed_movw) |
| 32 | movz x0, #:abs_g2_s:sym64_abs |
| 33 | movk x0, #:abs_g1_nc:sym64_abs |
| 34 | movk x0, #:abs_g0_nc:sym64_abs |
| 35 | ret |
| 36 | ENDPROC(signed_movw) |
| 37 | |
| 38 | ENTRY(unsigned_movw) |
| 39 | movz x0, #:abs_g3:sym64_abs |
| 40 | movk x0, #:abs_g2_nc:sym64_abs |
| 41 | movk x0, #:abs_g1_nc:sym64_abs |
| 42 | movk x0, #:abs_g0_nc:sym64_abs |
| 43 | ret |
| 44 | ENDPROC(unsigned_movw) |
| 45 | |
| 46 | #ifndef CONFIG_ARM64_ERRATUM_843419 |
| 47 | |
| 48 | ENTRY(relative_adrp) |
| 49 | adrp x0, sym64_rel |
| 50 | add x0, x0, #:lo12:sym64_rel |
| 51 | ret |
| 52 | ENDPROC(relative_adrp) |
| 53 | |
| 54 | #endif |
| 55 | |
| 56 | ENTRY(relative_adr) |
| 57 | adr x0, sym64_rel |
| 58 | ret |
| 59 | ENDPROC(relative_adr) |
| 60 | |
| 61 | ENTRY(relative_data64) |
| 62 | adr x1, 0f |
| 63 | ldr x0, [x1] |
| 64 | add x0, x0, x1 |
| 65 | ret |
| 66 | 0: .quad sym64_rel - . |
| 67 | ENDPROC(relative_data64) |
| 68 | |
| 69 | ENTRY(relative_data32) |
| 70 | adr x1, 0f |
| 71 | ldr w0, [x1] |
| 72 | add x0, x0, x1 |
| 73 | ret |
| 74 | 0: .long sym64_rel - . |
| 75 | ENDPROC(relative_data32) |
| 76 | |
| 77 | ENTRY(relative_data16) |
| 78 | adr x1, 0f |
| 79 | ldrsh w0, [x1] |
| 80 | add x0, x0, x1 |
| 81 | ret |
| 82 | 0: .short sym64_rel - ., 0 |
| 83 | ENDPROC(relative_data16) |