Changeset 8c193d83 in mainline
- Timestamp:
- 2019-02-23T17:47:52Z (6 years ago)
- Parents:
- ab87db5
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-11 15:28:25)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-23 17:47:52)
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
abi/include/abi/cap.h
rab87db5 r8c193d83 39 39 #include <stdint.h> 40 40 41 #define CAP_NIL 0 41 enum { 42 CAP_NIL = 0, 43 }; 42 44 43 45 typedef void *cap_handle_t; -
abi/include/abi/ddi/arg.h
rab87db5 r8c193d83 38 38 #include <stdint.h> 39 39 40 #define DMAMEM_FLAGS_ANONYMOUS 0x01 40 enum { 41 DMAMEM_FLAGS_ANONYMOUS = 0x01, 42 }; 41 43 42 44 /** Structure encapsulating arguments for SYS_PHYSMEM_MAP syscall. */ -
abi/include/abi/elf.h
rab87db5 r8c193d83 42 42 * Current ELF version 43 43 */ 44 #define EV_CURRENT 1 44 enum { 45 EV_CURRENT = 1, 46 }; 45 47 46 48 /** 47 49 * ELF types 48 50 */ 49 #define ET_NONE 0 /* No type */ 50 #define ET_REL 1 /* Relocatable file */ 51 #define ET_EXEC 2 /* Executable */ 52 #define ET_DYN 3 /* Shared object */ 53 #define ET_CORE 4 /* Core */ 54 #define ET_LOPROC 0xff00 /* Processor specific */ 55 #define ET_HIPROC 0xffff /* Processor specific */ 51 enum elf_type { 52 ET_NONE = 0, /* No type */ 53 ET_REL = 1, /* Relocatable file */ 54 ET_EXEC = 2, /* Executable */ 55 ET_DYN = 3, /* Shared object */ 56 ET_CORE = 4, /* Core */ 57 }; 58 59 enum { 60 ET_LOPROC = 0xff00, /* Lowest processor specific */ 61 ET_HIPROC = 0xffff, /* Highest processor specific */ 62 }; 56 63 57 64 /** 58 65 * ELF machine types 59 66 */ 60 #define EM_NO 0 /* No machine */ 61 #define EM_SPARC 2 /* SPARC */ 62 #define EM_386 3 /* i386 */ 63 #define EM_MIPS 8 /* MIPS RS3000 */ 64 #define EM_MIPS_RS3_LE 10 /* MIPS RS3000 LE */ 65 #define EM_PPC 20 /* PPC32 */ 66 #define EM_PPC64 21 /* PPC64 */ 67 #define EM_ARM 40 /* ARM */ 68 #define EM_SPARCV9 43 /* SPARC64 */ 69 #define EM_IA_64 50 /* IA-64 */ 70 #define EM_X86_64 62 /* AMD64/EMT64 */ 71 #define EM_RISCV 243 /* RISC-V */ 67 enum elf_machine { 68 EM_NO = 0, /* No machine */ 69 EM_SPARC = 2, /* SPARC */ 70 EM_386 = 3, /* i386 */ 71 EM_MIPS = 8, /* MIPS RS3000 */ 72 EM_MIPS_RS3_LE = 10, /* MIPS RS3000 LE */ 73 EM_PPC = 20, /* PPC32 */ 74 EM_PPC64 = 21, /* PPC64 */ 75 EM_ARM = 40, /* ARM */ 76 EM_SPARCV9 = 43, /* SPARC64 */ 77 EM_IA_64 = 50, /* IA-64 */ 78 EM_X86_64 = 62, /* AMD64/EMT64 */ 79 EM_RISCV = 243, /* RISC-V */ 80 }; 72 81 73 82 /** 74 83 * ELF identification indexes 75 84 */ 76 #define EI_MAG0 0 77 #define EI_MAG1 1 78 #define EI_MAG2 2 79 #define EI_MAG3 3 80 #define EI_CLASS 4 /* File class */ 81 #define EI_DATA 5 /* Data encoding */ 82 #define EI_VERSION 6 /* File version */ 83 #define EI_OSABI 7 84 #define EI_ABIVERSION 8 85 #define EI_PAD 9 /* Start of padding bytes */ 86 #define EI_NIDENT 16 /* ELF identification table size */ 85 enum { 86 EI_MAG0 = 0, 87 EI_MAG1 = 1, 88 EI_MAG2 = 2, 89 EI_MAG3 = 3, 90 EI_CLASS = 4, /* File class */ 91 EI_DATA = 5, /* Data encoding */ 92 EI_VERSION = 6, /* File version */ 93 EI_OSABI = 7, 94 EI_ABIVERSION = 8, 95 EI_PAD = 9, /* Start of padding bytes */ 96 EI_NIDENT = 16, /* ELF identification table size */ 97 }; 87 98 88 99 /** 89 100 * ELF magic number 90 101 */ 91 #define ELFMAG0 0x7f 92 #define ELFMAG1 'E' 93 #define ELFMAG2 'L' 94 #define ELFMAG3 'F' 102 enum { 103 ELFMAG0 = 0x7f, 104 ELFMAG1 = 'E', 105 ELFMAG2 = 'L', 106 ELFMAG3 = 'F', 107 }; 95 108 96 109 /** 97 110 * ELF file classes 98 111 */ 99 #define ELFCLASSNONE 0 100 #define ELFCLASS32 1 101 #define ELFCLASS64 2 112 enum elf_class { 113 ELFCLASSNONE = 0, 114 ELFCLASS32 = 1, 115 ELFCLASS64 = 2, 116 }; 102 117 103 118 /** 104 119 * ELF data encoding types 105 120 */ 106 #define ELFDATANONE 0 107 #define ELFDATA2LSB 1 /* Least significant byte first (little endian) */ 108 #define ELFDATA2MSB 2 /* Most signigicant byte first (big endian) */ 121 enum elf_data_encoding { 122 ELFDATANONE = 0, 123 ELFDATA2LSB = 1, /* Least significant byte first (little endian) */ 124 ELFDATA2MSB = 2, /* Most signigicant byte first (big endian) */ 125 }; 109 126 110 127 /** 111 128 * ELF section types 112 129 */ 113 #define SHT_NULL 0 114 #define SHT_PROGBITS 1 115 #define SHT_SYMTAB 2 116 #define SHT_STRTAB 3 117 #define SHT_RELA 4 118 #define SHT_HASH 5 119 #define SHT_DYNAMIC 6 120 #define SHT_NOTE 7 121 #define SHT_NOBITS 8 122 #define SHT_REL 9 123 #define SHT_SHLIB 10 124 #define SHT_DYNSYM 11 125 #define SHT_LOOS 0x60000000 126 #define SHT_HIOS 0x6fffffff 127 #define SHT_LOPROC 0x70000000 128 #define SHT_HIPROC 0x7fffffff 129 #define SHT_LOUSER 0x80000000 130 #define SHT_HIUSER 0xffffffff 130 enum elf_section_type { 131 SHT_NULL = 0, 132 SHT_PROGBITS = 1, 133 SHT_SYMTAB = 2, 134 SHT_STRTAB = 3, 135 SHT_RELA = 4, 136 SHT_HASH = 5, 137 SHT_DYNAMIC = 6, 138 SHT_NOTE = 7, 139 SHT_NOBITS = 8, 140 SHT_REL = 9, 141 SHT_SHLIB = 10, 142 SHT_DYNSYM = 11, 143 }; 144 145 enum { 146 SHT_LOOS = 0x60000000, 147 SHT_HIOS = 0x6fffffff, 148 SHT_LOPROC = 0x70000000, 149 SHT_HIPROC = 0x7fffffff, 150 SHT_LOUSER = 0x80000000, 151 SHT_HIUSER = 0xffffffff, 152 }; 131 153 132 154 /** 133 155 * ELF section flags 134 156 */ 135 #define SHF_WRITE 0x1 136 #define SHF_ALLOC 0x2 137 #define SHF_EXECINSTR 0x4 138 #define SHF_TLS 0x400 139 #define SHF_MASKPROC 0xf0000000 140 141 /** Macros for decomposing elf_symbol.st_info into binging and type */ 142 #define ELF_ST_BIND(i) ((i) >> 4) 143 #define ELF_ST_TYPE(i) ((i) & 0x0f) 144 #define ELF_ST_INFO(b, t) (((b) << 4) + ((t) & 0x0f)) 157 enum { 158 SHF_WRITE = 0x1, 159 SHF_ALLOC = 0x2, 160 SHF_EXECINSTR = 0x4, 161 SHF_TLS = 0x400, 162 SHF_MASKPROC = 0xf0000000, 163 }; 164 165 /** Functions for decomposing elf_symbol.st_info into binding and type */ 166 static inline uint8_t elf_st_bind(uint8_t info) 167 { 168 return info >> 4; 169 } 170 171 static inline uint8_t elf_st_type(uint8_t info) 172 { 173 return info & 0x0f; 174 } 175 176 static inline uint8_t elf_st_info(uint8_t bind, uint8_t type) 177 { 178 return (bind << 4) | (type & 0x0f); 179 } 145 180 146 181 /** 147 182 * Symbol binding 148 183 */ 149 #define STB_LOCAL 0 150 #define STB_GLOBAL 1 151 #define STB_WEAK 2 152 #define STB_LOPROC 13 153 #define STB_HIPROC 15 184 enum elf_symbol_binding { 185 STB_LOCAL = 0, 186 STB_GLOBAL = 1, 187 STB_WEAK = 2, 188 }; 189 190 enum { 191 STB_LOPROC = 13, 192 STB_HIPROC = 15, 193 }; 154 194 155 195 /** 156 196 * Symbol types 157 197 */ 158 #define STT_NOTYPE 0 159 #define STT_OBJECT 1 160 #define STT_FUNC 2 161 #define STT_SECTION 3 162 #define STT_FILE 4 163 #define STT_TLS 6 164 #define STT_LOPROC 13 165 #define STT_HIPROC 15 198 enum elf_symbol_type { 199 STT_NOTYPE = 0, 200 STT_OBJECT = 1, 201 STT_FUNC = 2, 202 STT_SECTION = 3, 203 STT_FILE = 4, 204 STT_TLS = 6, 205 }; 206 207 enum { 208 STT_LOPROC = 13, 209 STT_HIPROC = 15, 210 }; 166 211 167 212 /** 168 213 * Program segment types 169 214 */ 170 #define PT_NULL 0 171 #define PT_LOAD 1 172 #define PT_DYNAMIC 2 173 #define PT_INTERP 3 174 #define PT_NOTE 4 175 #define PT_SHLIB 5 176 #define PT_PHDR 6 177 #define PT_TLS 7 178 #define PT_LOOS 0x60000000 179 #define PT_GNU_EH_FRAME 0x6474e550 180 #define PT_GNU_STACK 0x6474e551 181 #define PT_GNU_RELRO 0x6474e552 182 #define PT_HIOS 0x6fffffff 183 #define PT_LOPROC 0x70000000 184 #define PT_HIPROC 0x7fffffff 215 enum elf_segment_type { 216 PT_NULL = 0, 217 PT_LOAD = 1, 218 PT_DYNAMIC = 2, 219 PT_INTERP = 3, 220 PT_NOTE = 4, 221 PT_SHLIB = 5, 222 PT_PHDR = 6, 223 PT_TLS = 7, 224 225 PT_GNU_EH_FRAME = 0x6474e550, 226 PT_GNU_STACK = 0x6474e551, 227 PT_GNU_RELRO = 0x6474e552, 228 }; 229 230 enum { 231 PT_LOOS = 0x60000000, 232 PT_HIOS = 0x6fffffff, 233 PT_LOPROC = 0x70000000, 234 PT_HIPROC = 0x7fffffff, 235 }; 185 236 186 237 /** 187 238 * Program segment attributes. 188 239 */ 189 #define PF_X 1 190 #define PF_W 2 191 #define PF_R 4 240 enum elf_segment_access { 241 PF_X = 1, 242 PF_W = 2, 243 PF_R = 4, 244 }; 192 245 193 246 /** -
abi/include/abi/ipc/interfaces.h
rab87db5 r8c193d83 40 40 #include <abi/fourcc.h> 41 41 42 #define IFACE_EXCHANGE_MASK 0x03 43 #define IFACE_MOD_MASK 0x04 42 enum { 43 IFACE_EXCHANGE_MASK = 0x03, 44 IFACE_MOD_MASK = 0x04, 45 }; 44 46 45 47 /** Interface exchange management style -
abi/include/abi/ipc/ipc.h
rab87db5 r8c193d83 41 41 #include <_bits/errno.h> 42 42 43 /** Length of data being transferred with IPC call 44 * 45 * The uspace may not be able to utilize the full length 46 * 47 */ 48 #define IPC_CALL_LEN 6 43 /* Miscellaneous constants */ 44 enum { 45 /** Length of data being transferred with IPC call 46 * 47 * The uspace may not be able to utilize the full length 48 * 49 */ 50 IPC_CALL_LEN = 6, 49 51 50 /** Maximum active async calls per phone */ 51 #define IPC_MAX_ASYNC_CALLS 64 52 /** Maximum active async calls per phone */ 53 IPC_MAX_ASYNC_CALLS = 64, 54 55 /** 56 * Maximum buffer size allowed for IPC_M_DATA_WRITE and 57 * IPC_M_DATA_READ requests. 58 */ 59 DATA_XFER_LIMIT = 64 * 1024, 60 }; 52 61 53 62 /* Flags for calls */ 63 enum { 64 /** This is answer to a call */ 65 IPC_CALL_ANSWERED = 1 << 0, 54 66 55 /** This is answer to a call*/56 #define IPC_CALL_ANSWERED (1 << 0) 67 /** Answer will not be passed to userspace, will be discarded */ 68 IPC_CALL_DISCARD_ANSWER = 1 << 1, 57 69 58 /** Answer will not be passed to userspace, will be discarded */59 #define IPC_CALL_DISCARD_ANSWER (1 << 1) 70 /** Call was forwarded */ 71 IPC_CALL_FORWARDED = 1 << 2, 60 72 61 /** Call was forwarded*/62 #define IPC_CALL_FORWARDED (1 << 2) 73 /** Interrupt notification */ 74 IPC_CALL_NOTIF = 1 << 3, 63 75 64 /** Interrupt notification */ 65 #define IPC_CALL_NOTIF (1 << 3) 66 67 /** The call was automatically answered by the kernel due to error */ 68 #define IPC_CALL_AUTO_REPLY (1 << 4) 69 70 /** 71 * Maximum buffer size allowed for IPC_M_DATA_WRITE and 72 * IPC_M_DATA_READ requests. 73 */ 74 #define DATA_XFER_LIMIT (64 * 1024) 76 /** The call was automatically answered by the kernel due to error */ 77 IPC_CALL_AUTO_REPLY = 1 << 4, 78 }; 75 79 76 80 /* Forwarding flags. */ 77 #define IPC_FF_NONE 0 81 enum { 82 IPC_FF_NONE = 0, 78 83 79 /** 80 * The call will be routed as though it was initially sent via the phone used to 81 * forward it. This feature is intended to support the situation in which the 82 * forwarded call needs to be handled by the same connection fibril as any other 83 * calls that were initially sent by the forwarder to the same destination. This 84 * flag has no imapct on routing replies. 85 */ 86 #define IPC_FF_ROUTE_FROM_ME (1 << 0) 84 /** 85 * The call will be routed as though it was initially sent via the phone 86 * used to forward it. This feature is intended to support the situation 87 * in which the forwarded call needs to be handled by the same 88 * connection fibril as any other calls that were initially sent by 89 * the forwarder to the same destination. 90 * This flag has no imapct on routing replies. 91 */ 92 IPC_FF_ROUTE_FROM_ME = 1 << 0, 93 }; 87 94 88 95 /* Data transfer flags. */ 89 #define IPC_XF_NONE 0 96 enum { 97 IPC_XF_NONE = 0, 90 98 91 /** Restrict the transfer size if necessary. */ 92 #define IPC_XF_RESTRICT (1 << 0) 99 /** Restrict the transfer size if necessary. */ 100 IPC_XF_RESTRICT = 1 << 0, 101 }; 93 102 94 103 /** User-defined IPC methods */ 95 #define IPC_FIRST_USER_METHOD 1024 104 enum { 105 IPC_FIRST_USER_METHOD = 1024, 106 }; 96 107 97 108 typedef struct { -
abi/include/abi/ipc/methods.h
rab87db5 r8c193d83 39 39 40 40 /* Well known phone descriptors */ 41 #define PHONE_NS ((cap_phone_handle_t) (CAP_NIL + 1)) 41 static cap_phone_handle_t const PHONE_NS = (cap_phone_handle_t) (CAP_NIL + 1); 42 42 43 43 /** Kernel IPC interfaces 44 44 * 45 45 */ 46 #define IPC_IF_KERNEL 0 46 enum { 47 IPC_IF_KERNEL = 0, 48 }; 47 49 48 50 /** System-specific IPC methods … … 52 54 * 53 55 */ 54 55 56 enum { 56 57 /** This message is sent to answerbox when the phone is hung up … … 217 218 218 219 /** Last system IPC method */ 219 #define IPC_M_LAST_SYSTEM 511 220 enum { 221 IPC_M_LAST_SYSTEM = 511, 222 }; 220 223 221 224 #endif -
abi/include/abi/kio.h
rab87db5 r8c193d83 37 37 38 38 enum { 39 KIO_UNKNOW ,39 KIO_UNKNOWN, 40 40 KIO_WRITE, 41 41 KIO_UPDATE, -
abi/include/abi/mm/as.h
rab87db5 r8c193d83 39 39 40 40 /** Address space area flags. */ 41 #define AS_AREA_READ 0x01 42 #define AS_AREA_WRITE 0x02 43 #define AS_AREA_EXEC 0x04 44 #define AS_AREA_CACHEABLE 0x08 45 #define AS_AREA_GUARD 0x10 46 #define AS_AREA_LATE_RESERVE 0x20 41 enum { 42 AS_AREA_READ = 0x01, 43 AS_AREA_WRITE = 0x02, 44 AS_AREA_EXEC = 0x04, 45 AS_AREA_CACHEABLE = 0x08, 46 AS_AREA_GUARD = 0x10, 47 AS_AREA_LATE_RESERVE = 0x20, 48 }; 47 49 48 #define AS_AREA_ANY ((void *) -1) 49 #define AS_MAP_FAILED ((void *) -1) 50 51 #define AS_AREA_UNPAGED NULL 50 static void *const AS_AREA_ANY = (void *) -1; 51 static void *const AS_MAP_FAILED = (void *) -1; 52 static void *const AS_AREA_UNPAGED = NULL; 52 53 53 54 /** Address space area info exported to uspace. */ -
abi/include/abi/synch.h
rab87db5 r8c193d83 36 36 #define _ABI_SYNCH_H_ 37 37 38 /** Request with no timeout. */ 39 #define SYNCH_NO_TIMEOUT 0 38 enum { 39 /** Request with no timeout. */ 40 SYNCH_NO_TIMEOUT = 0, 41 }; 40 42 41 /** No flags specified. */ 42 #define SYNCH_FLAGS_NONE 0 43 /** Non-blocking operation request. */ 44 #define SYNCH_FLAGS_NON_BLOCKING (1 << 0) 45 /** Interruptible operation. */ 46 #define SYNCH_FLAGS_INTERRUPTIBLE (1 << 1) 47 /** Futex operation (makes sleep with timeout composable). */ 48 #define SYNCH_FLAGS_FUTEX (1 << 2) 43 enum { 44 /** No flags specified. */ 45 SYNCH_FLAGS_NONE = 0, 46 /** Non-blocking operation request. */ 47 SYNCH_FLAGS_NON_BLOCKING = 1 << 0, 48 /** Interruptible operation. */ 49 SYNCH_FLAGS_INTERRUPTIBLE = 1 << 1, 50 /** Futex operation (makes sleep with timeout composable). */ 51 SYNCH_FLAGS_FUTEX = 1 << 2, 52 }; 49 53 50 54 #endif -
abi/include/abi/sysinfo.h
rab87db5 r8c193d83 42 42 #include <stdint.h> 43 43 44 /** Number of load components */ 45 #define LOAD_STEPS 3 44 enum { 45 /** Number of load components */ 46 LOAD_STEPS = 3, 46 47 47 /** Maximum name sizes */ 48 #define TASK_NAME_BUFLEN 64 49 #define EXC_NAME_BUFLEN 20 48 /** Maximum name sizes */ 49 TASK_NAME_BUFLEN = 64, 50 EXC_NAME_BUFLEN = 20, 51 }; 50 52 51 53 /** Item value type -
uspace/app/taskdump/symtab.c
rab87db5 r8c193d83 215 215 continue; 216 216 217 stype = ELF_ST_TYPE(st->sym[i].st_info);217 stype = elf_st_type(st->sym[i].st_info); 218 218 if (stype != STT_OBJECT && stype != STT_FUNC) 219 219 continue; … … 257 257 continue; 258 258 259 stype = ELF_ST_TYPE(st->sym[i].st_info);259 stype = elf_st_type(st->sym[i].st_info); 260 260 if (stype != STT_OBJECT && stype != STT_FUNC && 261 261 stype != STT_NOTYPE) { -
uspace/lib/c/generic/rtld/symbol.c
rab87db5 r8c193d83 262 262 void *symbol_get_addr(elf_symbol_t *sym, module_t *m, tcb_t *tcb) 263 263 { 264 if ( ELF_ST_TYPE(sym->st_info) == STT_TLS) {264 if (elf_st_type(sym->st_info) == STT_TLS) { 265 265 if (tcb == NULL) 266 266 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.