Changeset 3e828ea in mainline for abi/include


Ignore:
Timestamp:
2019-09-23T12:49:29Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
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)
Message:

Merge changes from master, especially Meson build

Location:
abi/include
Files:
2 added
9 edited
1 moved

Legend:

Unmodified
Added
Removed
  • abi/include/_bits/NULL.h

    r9259d20 r3e828ea  
    3737/** @file
    3838 * Definition of constant NULL.
    39  *
    40  * This definition is designed to work in both C and C++, and use
    41  * the special constant `nullptr` in C++11 and above.
    42  * Including this file is preferrable to defining the constant separately.
    4339 */
    4440
     
    4642#define _BITS_NULL_H_
    4743
    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>
    5946
    6047#endif
  • abi/include/_bits/__opaque_handle.h

    r9259d20 r3e828ea  
    3939#define _BITS_OPAQUE_HANDLE_H_
    4040
    41 #define opaque_handle(__name) typedef struct __opaque_##__name *__name
     41#define __opaque_handle(__name) typedef struct __opaque_##__name *__name
    4242
    4343#endif
  • abi/include/_bits/errno.h

    r9259d20 r3e828ea  
    4141#define _BITS_ERRNO_H_
    4242
     43#include <_bits/native.h>
     44#include <_bits/decls.h>
     45
    4346#ifdef __OPAQUE_ERRNO__
    44 #include <_bits/opaque_handle.h>
     47#include <_bits/__opaque_handle.h>
    4548
    46 opaque_handle(errno_t);
     49__HELENOS_DECLS_BEGIN;
     50__opaque_handle(errno_t);
    4751typedef errno_t sys_errno_t;
     52__HELENOS_DECLS_END;
     53
    4854#define __errno_t(val) ((errno_t) val)
    4955
    5056#else
    5157
    52 #include <_bits/native.h>
     58__HELENOS_DECLS_BEGIN;
    5359
    5460/**
     
    6571typedef sysarg_t sys_errno_t;
    6672
     73__HELENOS_DECLS_END;
     74
    6775/**
    6876 * A C++-style "cast" to `errno_t`.
  • abi/include/_bits/native.h

    r9259d20 r3e828ea  
    4747
    4848#include <inttypes.h>
     49#include <_bits/decls.h>
     50
     51__HELENOS_DECLS_BEGIN;
    4952
    5053typedef uintptr_t pfn_t;
     
    5356typedef intptr_t  native_t;
    5457
    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
     60typedef 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
     67typedef 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;
    5893
    5994#endif
  • abi/include/_bits/ssize_t.h

    r9259d20 r3e828ea  
    4242
    4343#include <stdint.h>
     44#include <_bits/decls.h>
    4445
     46__C_DECLS_BEGIN;
    4547typedef intptr_t ssize_t;
    46 
    47 #define SSIZE_MIN  INTPTR_MIN
    48 #define SSIZE_MAX  INTPTR_MAX
     48__C_DECLS_END;
    4949
    5050#endif
  • abi/include/abi/cap.h

    r9259d20 r3e828ea  
    3939#include <stdint.h>
    4040
    41 enum {
    42         CAP_NIL = 0,
    43 };
    44 
    4541typedef void *cap_handle_t;
    4642
     
    5652typedef struct {
    5753} *cap_waitq_handle_t;
     54
     55static cap_handle_t const CAP_NIL = 0;
    5856
    5957static inline bool cap_handle_valid(cap_handle_t handle)
  • abi/include/abi/elf.h

    r9259d20 r3e828ea  
    7777        EM_IA_64       = 50,   /* IA-64 */
    7878        EM_X86_64      = 62,   /* AMD64/EMT64 */
     79        EM_AARCH64     = 183,  /* ARM 64-bit architecture */
    7980        EM_RISCV       = 243,  /* RISC-V */
    8081};
     
    242243        PF_W = 2,
    243244        PF_R = 4,
     245};
     246
     247/**
     248 * Dynamic array tags
     249 */
     250enum 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 */
     283enum {
     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 */
     296enum {
     297        STN_UNDEF = 0,
    244298};
    245299
     
    406460};
    407461
     462/**
     463 * Dynamic structure
     464 */
     465struct elf32_dyn {
     466        elf_sword d_tag;
     467        union {
     468                elf_word d_val;
     469                elf32_addr d_ptr;
     470        } d_un;
     471};
     472
     473struct elf64_dyn {
     474        elf_sxword d_tag;
     475        union {
     476                elf_xword d_val;
     477                elf64_addr d_ptr;
     478        } d_un;
     479};
     480
     481struct elf32_rel {
     482        elf32_addr r_offset;
     483        elf_word r_info;
     484};
     485
     486struct elf32_rela {
     487        elf32_addr r_offset;
     488        elf_word r_info;
     489        elf_sword r_addend;
     490};
     491
     492struct elf64_rel {
     493        elf64_addr r_offset;
     494        elf_xword r_info;
     495};
     496
     497struct 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
    408509#ifdef __32_BITS__
    409510typedef struct elf32_header elf_header_t;
     
    412513typedef struct elf32_symbol elf_symbol_t;
    413514typedef struct elf32_note elf_note_t;
     515typedef struct elf32_dyn elf_dyn_t;
     516typedef struct elf32_rel elf_rel_t;
     517typedef struct elf32_rela elf_rela_t;
     518#define ELF_R_TYPE(i)  ELF32_R_TYPE(i)
    414519#endif
    415520
     
    420525typedef struct elf64_symbol elf_symbol_t;
    421526typedef struct elf64_note elf_note_t;
     527typedef struct elf64_dyn elf_dyn_t;
     528typedef struct elf64_rel elf_rel_t;
     529typedef struct elf64_rela elf_rela_t;
     530#define ELF_R_TYPE(i)  ELF64_R_TYPE(i)
    422531#endif
    423532
  • abi/include/abi/proc/uarg.h

    r9259d20 r3e828ea  
    3737
    3838#include <stddef.h>
     39#include <_bits/native.h>
     40
     41typedef void (uspace_thread_function_t)(void *);
    3942
    4043/** Structure passed to uinit kernel thread as argument. */
    4144typedef struct uspace_arg {
    42         void *uspace_entry;
    43         void *uspace_stack;
     45        uspace_addr_t uspace_entry;
     46        uspace_addr_t uspace_stack;
    4447        size_t uspace_stack_size;
    4548
    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;
    4851
    49         struct uspace_arg *uspace_uarg;
     52        uspace_ptr_struct_uspace_arg uspace_uarg;
    5053} uspace_arg_t;
    5154
  • abi/include/inttypes.h

    r9259d20 r3e828ea  
    4343#include <stdint.h>
    4444#include <_bits/wchar_t.h>
     45#include <_bits/decls.h>
    4546
    4647/*
     
    311312#endif
    312313
    313 #ifdef _HELENOS_SOURCE
    314 #define UINT8_MIN   0
    315 #define UINT16_MIN  0
    316 #define UINT32_MIN  0
    317 #define UINT64_MIN  0
    318 #endif
    319 
    320314#define PRIdMAX  "lld"
    321315#define PRIiMAX  "lli"
     
    330324#define SCNxMAX  "llx"
    331325
    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. */
    334330#endif
     331
     332__C_DECLS_BEGIN;
    335333
    336334typedef struct {
     
    343341intmax_t strtoimax(const char *__restrict__, char **__restrict__, int);
    344342uintmax_t strtoumax(const char *__restrict__, char **__restrict__, int);
    345 
    346 #ifdef __cplusplus
    347 }
     343intmax_t wcstoimax(const wchar_t *__restrict__, wchar_t **__restrict__, int);
     344uintmax_t wcstoumax(const wchar_t *__restrict__, wchar_t **__restrict__, int);
     345
     346__C_DECLS_END;
     347
    348348#endif
    349349
    350 #endif
    351 
    352350/** @}
    353351 */
  • abi/include/limits.h

    r9259d20 r3e828ea  
    8484#define MB_LEN_MAX 4
    8585
     86#ifdef _HELENOS_SOURCE
    8687#define UCHAR_MIN   0
    8788#define USHRT_MIN   0
     
    8990#define ULONG_MIN   (0ul)
    9091#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
    91107
    92108/* 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.