• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU)
3  * Licensed under the Mulan PSL v2.
4  * You can use this software according to the terms and conditions of the Mulan PSL v2.
5  * You may obtain a copy of Mulan PSL v2 at:
6  *     http://license.coscl.org.cn/MulanPSL2
7  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
8  * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
9  * PURPOSE.
10  * See the Mulan PSL v2 for more details.
11  */
12 #pragma once
13 
14 struct process_metadata {
15     unsigned long phdr_addr;
16     unsigned long phentsize;
17     unsigned long phnum;
18     unsigned long flags;
19     unsigned long entry;
20 };
21 
22 #define ENV_SIZE_ON_STACK   0x1000
23 #define ROOT_BIN_HDR_SIZE   216
24 #define ROOT_MEM_SIZE_OFF   0
25 #define ROOT_ENTRY_OFF      8
26 #define ROOT_FLAGS_OFF      16
27 #define ROOT_PHENT_SIZE_OFF 24
28 #define ROOT_PHNUM_OFF      32
29 #define ROOT_PHDR_ADDR_OFF  40
30 #define ROOT_PHDR_OFF       48
31 #define ROOT_PHENT_SIZE     56
32 
33 /* Program header content(64bit) */
34 #define PHDR_TYPE_OFF   0
35 #define PHDR_FLAGS_OFF  4
36 #define PHDR_OFFSET_OFF 8
37 #define PHDR_VADDR_OFF  16
38 #define PHDR_PADDR_OFF  24
39 #define PHDR_FILESZ_OFF 32
40 #define PHDR_MEMSZ_OF   40
41 #define PHDR_ALIGN_OFF  48
42 
43 #define PHDR_FLAGS_R (1 << 2)
44 #define PHDR_FLAGS_W (1 << 1)
45 #define PHDR_FLAGS_X (1 << 0)
46