auxv.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #define AT_NULL 0 /* No length, last entry's a_type has this value */
  8. #define AT_IGNORE 1 /* Entry has no meaning, a_un undefined */
  9. #define AT_EXECFD 2 /* a_val contains a file descriptor of the main program image */
  10. #define AT_PHDR 3 /* a_ptr contains pointer to program header table of main program image */
  11. #define AT_PHENT 4 /* a_val holds size of program header table entries */
  12. #define AT_PHNUM 5 /* a_val holds number of program header table entries */
  13. #define AT_PAGESZ 6 /* a_val gives system page size in bytes */
  14. #define AT_BASE 7 /* a_ptr holds base address that Loader was loaded into memory */
  15. #define AT_FLAGS 8 /* a_val holds 1 bit flags. Undefined flags are 0 */
  16. #define AT_ENTRY 9 /* a_ptr holds entry point of the main program */
  17. #define AT_NOTELF 10 /* a_val non-zero if the program is not ELF */
  18. #define AT_UID 11 /* a_val holds real user id of process */
  19. #define AT_EUID 12 /* a_val holds effective user id of process */
  20. #define AT_GID 13 /* a_val holds real group id of process */
  21. #define AT_EGID 14 /* a_val holds effective group id of process */
  22. #define AT_PLATFORM 15 /* a_val points to a string containing platform name */
  23. #define AT_HWCAP 16 /* a_val contains bitmask of CPU features. Equivalent to CPUID 1.EDX*/
  24. #define AT_CLKTCK 17 /* a_val contains frequency at which times() increments. (Re: Spec. What is times()?) */
  25. #define AT_SECURE 23 /* a_val holds 1 if program in secure mode (e.g. suid). Otherwise 0 */
  26. #define AT_BASE_PLATFORM 24 /* a_ptr points to a string identifying base platform name, which might be different from platform (e.g x86_64 when in i386 compat) */
  27. #define AT_RANDOM 25 /* a_ptr points to 16 securely generated random bytes */
  28. #define AT_HWCAP2 26 /* a_val holds extended hw feature mask. Currently 0 */
  29. #define AT_EXECFN 31 /* a_ptr points to filename of executed program */
  30. #define AT_EXE_BASE 32 /* a_ptr holds base address where main program was loaded into memory */
  31. #define AT_EXE_SIZE 33 /* a_val holds the size of the main program in memory */
  32. /* Auxiliary Vector types, from Intel386 ABI ver 1.0 section 2.3.3 */
  33. typedef struct
  34. {
  35. long a_type; /* Note: Extended to long from int, for ease of compatibility w/64 bit */
  36. union {
  37. long a_val;
  38. void* a_ptr;
  39. void (*a_fnc)(void); /* In spec, not used */
  40. } a_un;
  41. } auxv_t;