| 1 | /* |
| 2 | * Generic prctl unalign functions for linux-user |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 5 | */ |
| 6 | #ifndef GENERIC_TARGET_PRCTL_UNALIGN_H |
| 7 | #define GENERIC_TARGET_PRCTL_UNALIGN_H |
| 8 | |
| 9 | static abi_long do_prctl_get_unalign(CPUArchState *env, target_long arg2) |
| 10 | { |
| 11 | CPUState *cs = env_cpu(env); |
| 12 | uint32_t res = PR_UNALIGN_NOPRINT; |
| 13 | if (cs->prctl_unalign_sigbus) { |
| 14 | res |= PR_UNALIGN_SIGBUS; |
| 15 | } |
| 16 | return put_user_u32(res, arg2); |
| 17 | } |
| 18 | #define do_prctl_get_unalign do_prctl_get_unalign |
| 19 | |
| 20 | static abi_long do_prctl_set_unalign(CPUArchState *env, target_long arg2) |
| 21 | { |
| 22 | env_cpu(env)->prctl_unalign_sigbus = arg2 & PR_UNALIGN_SIGBUS; |
| 23 | return 0; |
| 24 | } |
| 25 | #define do_prctl_set_unalign do_prctl_set_unalign |
| 26 | |
| 27 | #endif /* GENERIC_TARGET_PRCTL_UNALIGN_H */ |