Changeset 3e828ea in mainline for abi/include
- Timestamp:
- 2019-09-23T12:49:29Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9be2358
- Parents:
- 9259d20 (diff), 1a4ec93f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Jiri Svoboda <jiri@…> (2019-09-22 12:49:07)
- git-committer:
- Jiri Svoboda <jiri@…> (2019-09-23 12:49:29)
- Location:
- abi/include
- Files:
-
- 2 added
- 9 edited
- 1 moved
-
_bits/NULL.h (modified) (2 diffs)
-
_bits/__opaque_handle.h (moved) (moved from abi/include/_bits/opaque_handle.h ) (1 diff)
-
_bits/decls.h (added)
-
_bits/errno.h (modified) (2 diffs)
-
_bits/native.h (modified) (2 diffs)
-
_bits/off64_t.h (added)
-
_bits/ssize_t.h (modified) (1 diff)
-
abi/cap.h (modified) (2 diffs)
-
abi/elf.h (modified) (5 diffs)
-
abi/proc/uarg.h (modified) (1 diff)
-
inttypes.h (modified) (4 diffs)
-
limits.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
abi/include/_bits/NULL.h
r9259d20 r3e828ea 37 37 /** @file 38 38 * Definition of constant NULL. 39 *40 * This definition is designed to work in both C and C++, and use41 * the special constant `nullptr` in C++11 and above.42 * Including this file is preferrable to defining the constant separately.43 39 */ 44 40 … … 46 42 #define _BITS_NULL_H_ 47 43 48 #ifndef NULL 49 50 #if __cplusplus >= 201103L 51 #define NULL nullptr 52 #elif defined(__cplusplus) 53 #define NULL 0L 54 #else 55 #define NULL ((void *) 0) 56 #endif 57 58 #endif 44 #define __need_NULL 45 #include <stddef.h> 59 46 60 47 #endif -
abi/include/_bits/__opaque_handle.h
r9259d20 r3e828ea 39 39 #define _BITS_OPAQUE_HANDLE_H_ 40 40 41 #define opaque_handle(__name) typedef struct __opaque_##__name *__name41 #define __opaque_handle(__name) typedef struct __opaque_##__name *__name 42 42 43 43 #endif -
abi/include/_bits/errno.h
r9259d20 r3e828ea 41 41 #define _BITS_ERRNO_H_ 42 42 43 #include <_bits/native.h> 44 #include <_bits/decls.h> 45 43 46 #ifdef __OPAQUE_ERRNO__ 44 #include <_bits/ opaque_handle.h>47 #include <_bits/__opaque_handle.h> 45 48 46 opaque_handle(errno_t); 49 __HELENOS_DECLS_BEGIN; 50 __opaque_handle(errno_t); 47 51 typedef errno_t sys_errno_t; 52 __HELENOS_DECLS_END; 53 48 54 #define __errno_t(val) ((errno_t) val) 49 55 50 56 #else 51 57 52 #include <_bits/native.h> 58 __HELENOS_DECLS_BEGIN; 53 59 54 60 /** … … 65 71 typedef sysarg_t sys_errno_t; 66 72 73 __HELENOS_DECLS_END; 74 67 75 /** 68 76 * A C++-style "cast" to `errno_t`. -
abi/include/_bits/native.h
r9259d20 r3e828ea 47 47 48 48 #include <inttypes.h> 49 #include <_bits/decls.h> 50 51 __HELENOS_DECLS_BEGIN; 49 52 50 53 typedef uintptr_t pfn_t; … … 53 56 typedef intptr_t native_t; 54 57 55 #define PRIdn PRIdPTR /**< Format for native_t. */ 56 #define PRIun PRIuPTR /**< Format for sysarg_t. */ 57 #define PRIxn PRIxPTR /**< Format for hexadecimal sysarg_t. */ 58 #ifdef KERNEL 59 60 typedef sysarg_t uspace_addr_t; 61 /* We might implement a way to check validity of the type some day. */ 62 #define uspace_ptr(type) uspace_addr_t 63 #define USPACE_NULL 0 64 65 #else /* !KERNEL */ 66 67 typedef void *uspace_addr_t; 68 #define uspace_ptr(type) type * 69 70 #endif 71 72 // TODO: Put this in a better location. 73 #define uspace_ptr_as_area_info_t uspace_ptr(as_area_info_t) 74 #define uspace_ptr_as_area_pager_info_t uspace_ptr(as_area_pager_info_t) 75 #define uspace_ptr_cap_irq_handle_t uspace_ptr(cap_irq_handle_t) 76 #define uspace_ptr_cap_phone_handle_t uspace_ptr(cap_phone_handle_t) 77 #define uspace_ptr_cap_waitq_handle_t uspace_ptr(cap_waitq_handle_t) 78 #define uspace_ptr_char uspace_ptr(char) 79 #define uspace_ptr_const_char uspace_ptr(const char) 80 #define uspace_ptr_ddi_ioarg_t uspace_ptr(ddi_ioarg_t) 81 #define uspace_ptr_ipc_data_t uspace_ptr(ipc_data_t) 82 #define uspace_ptr_irq_code_t uspace_ptr(irq_code_t) 83 #define uspace_ptr_size_t uspace_ptr(size_t) 84 #define uspace_ptr_struct_uspace_arg uspace_ptr(struct uspace_arg) 85 #define uspace_ptr_sysarg64_t uspace_ptr(sysarg64_t) 86 #define uspace_ptr_task_id_t uspace_ptr(task_id_t) 87 #define uspace_ptr_thread_id_t uspace_ptr(thread_id_t) 88 #define uspace_ptr_uintptr_t uspace_ptr(uintptr_t) 89 #define uspace_ptr_uspace_arg_t uspace_ptr(uspace_arg_t) 90 #define uspace_ptr_uspace_thread_function_t uspace_ptr(uspace_thread_function_t) 91 92 __HELENOS_DECLS_END; 58 93 59 94 #endif -
abi/include/_bits/ssize_t.h
r9259d20 r3e828ea 42 42 43 43 #include <stdint.h> 44 #include <_bits/decls.h> 44 45 46 __C_DECLS_BEGIN; 45 47 typedef intptr_t ssize_t; 46 47 #define SSIZE_MIN INTPTR_MIN 48 #define SSIZE_MAX INTPTR_MAX 48 __C_DECLS_END; 49 49 50 50 #endif -
abi/include/abi/cap.h
r9259d20 r3e828ea 39 39 #include <stdint.h> 40 40 41 enum {42 CAP_NIL = 0,43 };44 45 41 typedef void *cap_handle_t; 46 42 … … 56 52 typedef struct { 57 53 } *cap_waitq_handle_t; 54 55 static cap_handle_t const CAP_NIL = 0; 58 56 59 57 static inline bool cap_handle_valid(cap_handle_t handle) -
abi/include/abi/elf.h
r9259d20 r3e828ea 77 77 EM_IA_64 = 50, /* IA-64 */ 78 78 EM_X86_64 = 62, /* AMD64/EMT64 */ 79 EM_AARCH64 = 183, /* ARM 64-bit architecture */ 79 80 EM_RISCV = 243, /* RISC-V */ 80 81 }; … … 242 243 PF_W = 2, 243 244 PF_R = 4, 245 }; 246 247 /** 248 * Dynamic array tags 249 */ 250 enum elf_dynamic_tag { 251 DT_NULL = 0, 252 DT_NEEDED = 1, 253 DT_PLTRELSZ = 2, 254 DT_PLTGOT = 3, 255 DT_HASH = 4, 256 DT_STRTAB = 5, 257 DT_SYMTAB = 6, 258 DT_RELA = 7, 259 DT_RELASZ = 8, 260 DT_RELAENT = 9, 261 DT_STRSZ = 10, 262 DT_SYMENT = 11, 263 DT_INIT = 12, 264 DT_FINI = 13, 265 DT_SONAME = 14, 266 DT_RPATH = 15, 267 DT_SYMBOLIC = 16, 268 DT_REL = 17, 269 DT_RELSZ = 18, 270 DT_RELENT = 19, 271 DT_PLTREL = 20, 272 DT_DEBUG = 21, 273 DT_TEXTREL = 22, 274 DT_JMPREL = 23, 275 DT_BIND_NOW = 24, 276 DT_LOPROC = 0x70000000, 277 DT_HIPROC = 0x7fffffff, 278 }; 279 280 /** 281 * Special section indexes 282 */ 283 enum { 284 SHN_UNDEF = 0, 285 SHN_LORESERVE = 0xff00, 286 SHN_LOPROC = 0xff00, 287 SHN_HIPROC = 0xff1f, 288 SHN_ABS = 0xfff1, 289 SHN_COMMON = 0xfff2, 290 SHN_HIRESERVE = 0xffff, 291 }; 292 293 /** 294 * Special symbol table index 295 */ 296 enum { 297 STN_UNDEF = 0, 244 298 }; 245 299 … … 406 460 }; 407 461 462 /** 463 * Dynamic structure 464 */ 465 struct elf32_dyn { 466 elf_sword d_tag; 467 union { 468 elf_word d_val; 469 elf32_addr d_ptr; 470 } d_un; 471 }; 472 473 struct elf64_dyn { 474 elf_sxword d_tag; 475 union { 476 elf_xword d_val; 477 elf64_addr d_ptr; 478 } d_un; 479 }; 480 481 struct elf32_rel { 482 elf32_addr r_offset; 483 elf_word r_info; 484 }; 485 486 struct elf32_rela { 487 elf32_addr r_offset; 488 elf_word r_info; 489 elf_sword r_addend; 490 }; 491 492 struct elf64_rel { 493 elf64_addr r_offset; 494 elf_xword r_info; 495 }; 496 497 struct elf64_rela { 498 elf64_addr r_offset; 499 elf_xword r_info; 500 elf_sxword r_addend; 501 }; 502 503 #define ELF32_R_SYM(i) ((i) >> 8) 504 #define ELF32_R_TYPE(i) ((unsigned char)(i)) 505 506 #define ELF64_R_SYM(i) ((i) >> 32) 507 #define ELF64_R_TYPE(i) ((i) & 0xffffffffL) 508 408 509 #ifdef __32_BITS__ 409 510 typedef struct elf32_header elf_header_t; … … 412 513 typedef struct elf32_symbol elf_symbol_t; 413 514 typedef struct elf32_note elf_note_t; 515 typedef struct elf32_dyn elf_dyn_t; 516 typedef struct elf32_rel elf_rel_t; 517 typedef struct elf32_rela elf_rela_t; 518 #define ELF_R_TYPE(i) ELF32_R_TYPE(i) 414 519 #endif 415 520 … … 420 525 typedef struct elf64_symbol elf_symbol_t; 421 526 typedef struct elf64_note elf_note_t; 527 typedef struct elf64_dyn elf_dyn_t; 528 typedef struct elf64_rel elf_rel_t; 529 typedef struct elf64_rela elf_rela_t; 530 #define ELF_R_TYPE(i) ELF64_R_TYPE(i) 422 531 #endif 423 532 -
abi/include/abi/proc/uarg.h
r9259d20 r3e828ea 37 37 38 38 #include <stddef.h> 39 #include <_bits/native.h> 40 41 typedef void (uspace_thread_function_t)(void *); 39 42 40 43 /** Structure passed to uinit kernel thread as argument. */ 41 44 typedef struct uspace_arg { 42 void *uspace_entry;43 void *uspace_stack;45 uspace_addr_t uspace_entry; 46 uspace_addr_t uspace_stack; 44 47 size_t uspace_stack_size; 45 48 46 void (*uspace_thread_function)(void *);47 void *uspace_thread_arg;49 uspace_ptr_uspace_thread_function_t uspace_thread_function; 50 uspace_addr_t uspace_thread_arg; 48 51 49 struct uspace_arg *uspace_uarg;52 uspace_ptr_struct_uspace_arg uspace_uarg; 50 53 } uspace_arg_t; 51 54 -
abi/include/inttypes.h
r9259d20 r3e828ea 43 43 #include <stdint.h> 44 44 #include <_bits/wchar_t.h> 45 #include <_bits/decls.h> 45 46 46 47 /* … … 311 312 #endif 312 313 313 #ifdef _HELENOS_SOURCE314 #define UINT8_MIN 0315 #define UINT16_MIN 0316 #define UINT32_MIN 0317 #define UINT64_MIN 0318 #endif319 320 314 #define PRIdMAX "lld" 321 315 #define PRIiMAX "lli" … … 330 324 #define SCNxMAX "llx" 331 325 332 #ifdef __cplusplus 333 extern "C" { 326 #if defined(_HELENOS_SOURCE) && !defined(__cplusplus) 327 #define PRIdn PRIdPTR /**< Format for native_t. */ 328 #define PRIun PRIuPTR /**< Format for sysarg_t. */ 329 #define PRIxn PRIxPTR /**< Format for hexadecimal sysarg_t. */ 334 330 #endif 331 332 __C_DECLS_BEGIN; 335 333 336 334 typedef struct { … … 343 341 intmax_t strtoimax(const char *__restrict__, char **__restrict__, int); 344 342 uintmax_t strtoumax(const char *__restrict__, char **__restrict__, int); 345 346 #ifdef __cplusplus 347 } 343 intmax_t wcstoimax(const wchar_t *__restrict__, wchar_t **__restrict__, int); 344 uintmax_t wcstoumax(const wchar_t *__restrict__, wchar_t **__restrict__, int); 345 346 __C_DECLS_END; 347 348 348 #endif 349 349 350 #endif351 352 350 /** @} 353 351 */ -
abi/include/limits.h
r9259d20 r3e828ea 84 84 #define MB_LEN_MAX 4 85 85 86 #ifdef _HELENOS_SOURCE 86 87 #define UCHAR_MIN 0 87 88 #define USHRT_MIN 0 … … 89 90 #define ULONG_MIN (0ul) 90 91 #define ULLONG_MIN (0ull) 92 #define SSIZE_MIN INTPTR_MIN 93 #define UINT8_MIN 0 94 #define UINT16_MIN 0 95 #define UINT32_MIN 0 96 #define UINT64_MIN 0 97 #endif 98 99 #if defined(_HELENOS_SOURCE) || defined(_POSIX_SOURCE) || \ 100 defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 101 defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 102 103 #define SSIZE_MAX INTPTR_MAX 104 #define NAME_MAX 255 105 106 #endif 91 107 92 108 /* GCC's <limits.h> doesn't define these for C++11, even though it should. */
Note:
See TracChangeset
for help on using the changeset viewer.
