OLD | NEW |
(Empty) | |
| 1 @ Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 2 @ Use of this source code is governed by a BSD-style license that can be |
| 3 @ found in the LICENSE file. |
| 4 |
| 5 .code 16 |
| 6 .syntax unified |
| 7 .globl _start |
| 8 .thumb_func |
| 9 _start: |
| 10 |
| 11 @ Test forwards jumps |
| 12 b bundle_good |
| 13 b middle_good |
| 14 b middle_bad |
| 15 |
| 16 @ Nop pad to bundle alignment |
| 17 nop |
| 18 nop |
| 19 nop |
| 20 nop |
| 21 nop |
| 22 nop |
| 23 nop |
| 24 nop |
| 25 nop |
| 26 nop |
| 27 |
| 28 bundle_good: |
| 29 nop |
| 30 middle_good: |
| 31 bic lr, lr, #0xf0000000 |
| 32 orr lr, lr, #0x0000000f |
| 33 middle_bad: |
| 34 bx lr |
| 35 |
| 36 @ Test backwards jumps |
| 37 |
| 38 b bundle_good |
| 39 b middle_good |
| 40 b middle_bad |
| 41 |
| 42 @ Another nop pad |
| 43 nop |
| 44 nop |
| 45 nop |
| 46 nop |
| 47 |
| 48 @ Test similar jumps with variations on the mask |
| 49 |
| 50 bic lr, lr, #0xc0000000 @ 1GiB mask |
| 51 orr lr, lr, #0x0000000f |
| 52 bx lr @ should succeed |
| 53 |
| 54 bic lr, lr, #0x80000000 @ 2GiB mask |
| 55 orr lr, lr, #0x0000000f |
| 56 bx lr @ must fail |
| 57 |
| 58 bic lr, lr, #0xe0000000 @ in between mask |
| 59 orr lr, lr, #0x0000000f |
| 60 bx lr @ also succeeds |
| 61 |
| 62 @ Test the OR mask now |
| 63 |
| 64 bic lr, lr, #0xc0000000 @ 1GiB mask |
| 65 orr lr, lr, #0x0000001f |
| 66 bx lr @ should fail (additional bit set) |
| 67 |
| 68 bic lr, lr, #0xc0000000 |
| 69 bx lr @ must fail (no oring) |
| 70 |
| 71 bic lr, lr, #0xc0000000 @ in between mask |
| 72 orr lr, lr, #0x0000000e |
| 73 bx lr @ must fail (too few bits set) |
| 74 |
OLD | NEW |