1#![allow(dead_code)]
6#![allow(non_camel_case_types)]
7#![allow(non_upper_case_globals)]
8
9use crate::error;
10use crate::errors::Errno;
11use inspect_stubs::track_stub;
12
13#[derive(Clone, Copy, PartialEq)]
14#[repr(usize)]
15pub enum ElfNoteType {
16 PrStatus = 1,
18 FpRegSet = 2,
20 X86_XState = 0x202,
22 ArmTaggedAddrCtrl = 0x409,
24 ArmPacEnabledKeys = 0x40a,
26}
27
28impl TryFrom<usize> for ElfNoteType {
29 type Error = Errno;
30
31 fn try_from(v: usize) -> Result<Self, Errno> {
32 match v {
33 x if x == ElfNoteType::PrStatus as usize => Ok(ElfNoteType::PrStatus),
34 x if x == ElfNoteType::FpRegSet as usize => Ok(ElfNoteType::FpRegSet),
35 x if x == ElfNoteType::X86_XState as usize => Ok(ElfNoteType::X86_XState),
36 x if x == ElfNoteType::ArmTaggedAddrCtrl as usize => {
37 track_stub!(TODO("https://fxbug.dev/441149562"), "NT_ARM_TAGGED_ADDR_CTRL");
38 error!(ENOTSUP)
39 }
40 x if x == ElfNoteType::ArmPacEnabledKeys as usize => {
41 track_stub!(TODO("https://fxbug.dev/441149562"), "NT_ARM_PAC_ENABLED_KEYS");
42 error!(ENOTSUP)
43 }
44 _ => error!(EINVAL),
45 }
46 }
47}