| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-mcmse -fshort-enums" } */ |
| 3 |
/* ARMv8-M expectation with target { ! arm_cmse_clear_ok }. */ |
| 4 |
/* ARMv8.1-M expectation with target arm_cmse_clear_ok. */ |
| 5 |
/* { dg-final { check-function-bodies "**" "" "" } } */ |
| 6 |
|
| 7 |
#include <arm_cmse.h> |
| 8 |
#include <stdbool.h> |
| 9 |
|
| 10 |
enum offset |
| 11 |
{ |
| 12 |
zero = 0, |
| 13 |
one = 1, |
| 14 |
two = 2 |
| 15 |
}; |
| 16 |
|
| 17 |
typedef unsigned char __attribute__ ((cmse_nonsecure_call)) ns_unsign_foo_t (void); |
| 18 |
typedef signed char __attribute__ ((cmse_nonsecure_call)) ns_sign_foo_t (void); |
| 19 |
typedef unsigned short __attribute__ ((cmse_nonsecure_call)) ns_short_unsign_foo_t (void); |
| 20 |
typedef signed short __attribute__ ((cmse_nonsecure_call)) ns_short_sign_foo_t (void); |
| 21 |
typedef enum offset __attribute__ ((cmse_nonsecure_call)) ns_enum_foo_t (void); |
| 22 |
typedef bool __attribute__ ((cmse_nonsecure_call)) ns_bool_foo_t (void); |
| 23 |
|
| 24 |
/* |
| 25 |
**unsignNonsecure0: { target arm_cmse_clear_ok } |
| 26 |
** ... |
| 27 |
** blxns r[0-3] |
| 28 |
** ... |
| 29 |
** uxtb r0, r0 |
| 30 |
** ... |
| 31 |
*/ |
| 32 |
/* |
| 33 |
**unsignNonsecure0: { target { ! arm_cmse_clear_ok } } |
| 34 |
** ... |
| 35 |
** bl __gnu_cmse_nonsecure_call |
| 36 |
** uxtb r0, r0 |
| 37 |
** ... |
| 38 |
*/ |
| 39 |
unsigned char unsignNonsecure0 (ns_unsign_foo_t * ns_foo_p) |
| 40 |
{ |
| 41 |
return ns_foo_p (); |
| 42 |
} |
| 43 |
|
| 44 |
/* |
| 45 |
**signNonsecure0: { target arm_cmse_clear_ok } |
| 46 |
** ... |
| 47 |
** blxns r[0-3] |
| 48 |
** ... |
| 49 |
** sxtb r0, r0 |
| 50 |
** ... |
| 51 |
*/ |
| 52 |
/* |
| 53 |
**signNonsecure0: { target { ! arm_cmse_clear_ok } } |
| 54 |
** ... |
| 55 |
** bl __gnu_cmse_nonsecure_call |
| 56 |
** sxtb r0, r0 |
| 57 |
** ... |
| 58 |
*/ |
| 59 |
signed char signNonsecure0 (ns_sign_foo_t * ns_foo_p) |
| 60 |
{ |
| 61 |
return ns_foo_p (); |
| 62 |
} |
| 63 |
|
| 64 |
/* |
| 65 |
**shortUnsignNonsecure0: { target arm_cmse_clear_ok } |
| 66 |
** ... |
| 67 |
** blxns r[0-3] |
| 68 |
** ... |
| 69 |
** uxth r0, r0 |
| 70 |
** ... |
| 71 |
*/ |
| 72 |
/* |
| 73 |
**shortUnsignNonsecure0: { target { ! arm_cmse_clear_ok } } |
| 74 |
** ... |
| 75 |
** bl __gnu_cmse_nonsecure_call |
| 76 |
** uxth r0, r0 |
| 77 |
** ... |
| 78 |
*/ |
| 79 |
unsigned short shortUnsignNonsecure0 (ns_short_unsign_foo_t * ns_foo_p) |
| 80 |
{ |
| 81 |
return ns_foo_p (); |
| 82 |
} |
| 83 |
|
| 84 |
/* |
| 85 |
**shortSignNonsecure0: { target arm_cmse_clear_ok } |
| 86 |
** ... |
| 87 |
** blxns r[0-3] |
| 88 |
** ... |
| 89 |
** sxth r0, r0 |
| 90 |
** ... |
| 91 |
*/ |
| 92 |
/* |
| 93 |
**shortSignNonsecure0: { target { ! arm_cmse_clear_ok } } |
| 94 |
** ... |
| 95 |
** bl __gnu_cmse_nonsecure_call |
| 96 |
** sxth r0, r0 |
| 97 |
** ... |
| 98 |
*/ |
| 99 |
signed short shortSignNonsecure0 (ns_short_sign_foo_t * ns_foo_p) |
| 100 |
{ |
| 101 |
return ns_foo_p (); |
| 102 |
} |
| 103 |
|
| 104 |
/* |
| 105 |
**enumNonsecure0: { target arm_cmse_clear_ok } |
| 106 |
** ... |
| 107 |
** blxns r[0-3] |
| 108 |
** ... |
| 109 |
** uxtb r0, r0 |
| 110 |
** ... |
| 111 |
*/ |
| 112 |
/* |
| 113 |
**enumNonsecure0: { target { ! arm_cmse_clear_ok } } |
| 114 |
** ... |
| 115 |
** bl __gnu_cmse_nonsecure_call |
| 116 |
** uxtb r0, r0 |
| 117 |
** ... |
| 118 |
*/ |
| 119 |
unsigned char __attribute__((noipa)) enumNonsecure0 (ns_enum_foo_t * ns_foo_p) |
| 120 |
{ |
| 121 |
return ns_foo_p (); |
| 122 |
} |
| 123 |
|
| 124 |
/* |
| 125 |
**boolNonsecure0: { target arm_cmse_clear_ok } |
| 126 |
** ... |
| 127 |
** blxns r[0-3] |
| 128 |
** ... |
| 129 |
** uxtb r0, r0 |
| 130 |
** ... |
| 131 |
*/ |
| 132 |
/* |
| 133 |
**boolNonsecure0: { target { ! arm_cmse_clear_ok } } |
| 134 |
** ... |
| 135 |
** bl __gnu_cmse_nonsecure_call |
| 136 |
** uxtb r0, r0 |
| 137 |
** ... |
| 138 |
*/ |
| 139 |
unsigned char boolNonsecure0 (ns_bool_foo_t * ns_foo_p) |
| 140 |
{ |
| 141 |
return ns_foo_p (); |
| 142 |
} |