| 235 | } |
| 236 | |
| 237 | void initThreadVars(struct Thread_tag *thread) |
| 238 | { |
| 239 | ThreadVars* tv = getThreadVars(); |
| 240 | tv->magic = THREADVARS_MAGIC; |
| 241 | tv->reent = thread != NULL ? &thread->reent : _impure_ptr; |
| 242 | tv->thread_ptr = thread; |
| 243 | #pragma GCC diagnostic push |
| 244 | #pragma GCC diagnostic ignored "-Warray-bounds" |
| 245 | tv->tls_tp = (thread != NULL ? (u8*)thread->stacktop : __tls_start) - 8; // Arm ELF TLS ABI mandates an 8-byte header |
| 246 | #pragma GCC diagnostic pop |
| 247 | tv->srv_blocking_policy = false; |
| 248 | |
| 249 | // Kernel does not initialize fpscr at all, so we must do it ourselves |
| 250 | // https://developer.arm.com/documentation/ddi0360/f/vfp-programmers-model/vfp11-system-registers/floating-point-status-and-control-register--fpscr |
| 251 | |
| 252 | // All flags clear, all interrupts disabled, all instruction scalar. |
| 253 | // As for the 3 below fields: default NaN mode, flush-to-zero both enabled & round to nearest. |
| 254 | __builtin_arm_set_fpscr(BIT(25) | BIT(24) | (0u << 22)); |
| 255 | } |
| 256 | |
| 257 | void __system_initSyscalls(void) |
| 258 | { |
no test coverage detected