1use crate::errors::Errno;
6use crate::{error, uapi};
7use inspect_stubs::track_stub;
8
9#[derive(Clone, Copy, PartialEq)]
10#[repr(usize)]
11pub enum ElfNoteType {
12 PrStatus = uapi::NT_PRSTATUS as usize,
13 FpRegSet = uapi::NT_PRFPREG as usize,
14 X86XState = uapi::NT_X86_XSTATE as usize,
15 ArmTaggedAddrCtrl = uapi::NT_ARM_TAGGED_ADDR_CTRL as usize,
16 ArmPacEnabledKeys = uapi::NT_ARM_PAC_ENABLED_KEYS as usize,
17}
18
19impl TryFrom<usize> for ElfNoteType {
20 type Error = Errno;
21
22 fn try_from(v: usize) -> Result<Self, Errno> {
23 match v {
24 x if x == ElfNoteType::PrStatus as usize => Ok(ElfNoteType::PrStatus),
25 x if x == ElfNoteType::FpRegSet as usize => Ok(ElfNoteType::FpRegSet),
26 x if x == ElfNoteType::X86XState as usize => Ok(ElfNoteType::X86XState),
27 x if x == ElfNoteType::ArmTaggedAddrCtrl as usize => {
28 track_stub!(TODO("https://fxbug.dev/441149562"), "NT_ARM_TAGGED_ADDR_CTRL");
29 error!(ENOTSUP)
30 }
31 x if x == ElfNoteType::ArmPacEnabledKeys as usize => {
32 track_stub!(TODO("https://fxbug.dev/441149562"), "NT_ARM_PAC_ENABLED_KEYS");
33 error!(ENOTSUP)
34 }
35 _ => error!(EINVAL),
36 }
37 }
38}