1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/StringView.h>
#include <AK/Types.h>
#include <Kernel/API/POSIX/sys/auxv.h>
static_assert(sizeof(auxv_t) % sizeof(FlatPtr) == 0);
namespace ELF {
struct AuxiliaryValue {
enum Type {
Null = AT_NULL,
Ignore = AT_IGNORE,
ExecFileDescriptor = AT_EXECFD,
Phdr = AT_PHDR,
Phent = AT_PHENT,
Phnum = AT_PHNUM,
PageSize = AT_PAGESZ,
BaseAddress = AT_BASE,
Flags = AT_FLAGS,
Entry = AT_ENTRY,
NotELF = AT_NOTELF,
Uid = AT_UID,
EUid = AT_EUID,
Gid = AT_GID,
EGid = AT_EGID,
Platform = AT_PLATFORM,
HwCap = AT_HWCAP,
ClockTick = AT_CLKTCK,
Secure = AT_SECURE,
BasePlatform = AT_BASE_PLATFORM,
Random = AT_RANDOM,
HwCap2 = AT_HWCAP2,
ExecFilename = AT_EXECFN,
ExeBaseAddress = AT_EXE_BASE,
ExeSize = AT_EXE_SIZE
};
AuxiliaryValue(Type type, long val)
{
auxv.a_type = type;
auxv.a_un.a_val = val;
}
AuxiliaryValue(Type type, void* ptr)
{
auxv.a_type = type;
auxv.a_un.a_ptr = (void*)ptr;
}
AuxiliaryValue(Type type, StringView string)
: optional_string(string)
{
auxv.a_type = type;
auxv.a_un.a_ptr = nullptr;
}
auxv_t auxv {};
StringView optional_string;
};
}
|