[NDS32] Refine functions that deal with lwm and smw operations.
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_freebsd.h
blob47bb1313e6f454f242239bc8034b7478dd2cab56
1 //===-- sanitizer_freebsd.h -------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of Sanitizer runtime. It contains FreeBSD-specific
9 // definitions.
11 //===----------------------------------------------------------------------===//
13 #ifndef SANITIZER_FREEBSD_H
14 #define SANITIZER_FREEBSD_H
16 #include "sanitizer_internal_defs.h"
18 // x86-64 FreeBSD 9.2 and older define 'ucontext_t' incorrectly in
19 // 32-bit mode.
20 #if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32)
21 # include <osreldate.h>
22 # if __FreeBSD_version <= 902001 // v9.2
23 # include <link.h>
24 # include <sys/param.h>
25 # include <ucontext.h>
27 namespace __sanitizer {
29 typedef unsigned long long __xuint64_t;
31 typedef __int32_t __xregister_t;
33 typedef struct __xmcontext {
34 __xregister_t mc_onstack;
35 __xregister_t mc_gs;
36 __xregister_t mc_fs;
37 __xregister_t mc_es;
38 __xregister_t mc_ds;
39 __xregister_t mc_edi;
40 __xregister_t mc_esi;
41 __xregister_t mc_ebp;
42 __xregister_t mc_isp;
43 __xregister_t mc_ebx;
44 __xregister_t mc_edx;
45 __xregister_t mc_ecx;
46 __xregister_t mc_eax;
47 __xregister_t mc_trapno;
48 __xregister_t mc_err;
49 __xregister_t mc_eip;
50 __xregister_t mc_cs;
51 __xregister_t mc_eflags;
52 __xregister_t mc_esp;
53 __xregister_t mc_ss;
55 int mc_len;
56 int mc_fpformat;
57 int mc_ownedfp;
58 __xregister_t mc_flags;
60 int mc_fpstate[128] __aligned(16);
61 __xregister_t mc_fsbase;
62 __xregister_t mc_gsbase;
63 __xregister_t mc_xfpustate;
64 __xregister_t mc_xfpustate_len;
66 int mc_spare2[4];
67 } xmcontext_t;
69 typedef struct __xucontext {
70 sigset_t uc_sigmask;
71 xmcontext_t uc_mcontext;
73 struct __ucontext *uc_link;
74 stack_t uc_stack;
75 int uc_flags;
76 int __spare__[4];
77 } xucontext_t;
79 struct xkinfo_vmentry {
80 int kve_structsize;
81 int kve_type;
82 __xuint64_t kve_start;
83 __xuint64_t kve_end;
84 __xuint64_t kve_offset;
85 __xuint64_t kve_vn_fileid;
86 __uint32_t kve_vn_fsid;
87 int kve_flags;
88 int kve_resident;
89 int kve_private_resident;
90 int kve_protection;
91 int kve_ref_count;
92 int kve_shadow_count;
93 int kve_vn_type;
94 __xuint64_t kve_vn_size;
95 __uint32_t kve_vn_rdev;
96 __uint16_t kve_vn_mode;
97 __uint16_t kve_status;
98 int _kve_ispare[12];
99 char kve_path[PATH_MAX];
102 typedef struct {
103 __uint32_t p_type;
104 __uint32_t p_offset;
105 __uint32_t p_vaddr;
106 __uint32_t p_paddr;
107 __uint32_t p_filesz;
108 __uint32_t p_memsz;
109 __uint32_t p_flags;
110 __uint32_t p_align;
111 } XElf32_Phdr;
113 struct xdl_phdr_info {
114 Elf_Addr dlpi_addr;
115 const char *dlpi_name;
116 const XElf32_Phdr *dlpi_phdr;
117 Elf_Half dlpi_phnum;
118 unsigned long long int dlpi_adds;
119 unsigned long long int dlpi_subs;
120 size_t dlpi_tls_modid;
121 void *dlpi_tls_data;
124 typedef int (*__xdl_iterate_hdr_callback)(struct xdl_phdr_info*, size_t, void*);
125 typedef int xdl_iterate_phdr_t(__xdl_iterate_hdr_callback, void*);
127 #define xdl_iterate_phdr(callback, param) \
128 (((xdl_iterate_phdr_t*) dl_iterate_phdr)((callback), (param)))
130 } // namespace __sanitizer
132 # endif // __FreeBSD_version <= 902001
133 #endif // SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32)
135 #endif // SANITIZER_FREEBSD_H