1 //===-- sanitizer_freebsd.h -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file is a part of Sanitizer runtime. It contains FreeBSD-specific
13 //===----------------------------------------------------------------------===//
15 #ifndef SANITIZER_FREEBSD_H
16 #define SANITIZER_FREEBSD_H
18 #include "sanitizer_internal_defs.h"
20 // x86-64 FreeBSD 9.2 and older define 'ucontext_t' incorrectly in
22 #if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32)
23 # include <osreldate.h>
24 # if __FreeBSD_version <= 902001 // v9.2
26 # include <sys/param.h>
27 # include <ucontext.h>
29 namespace __sanitizer
{
31 typedef unsigned long long __xuint64_t
;
33 typedef __int32_t __xregister_t
;
35 typedef struct __xmcontext
{
36 __xregister_t mc_onstack
;
49 __xregister_t mc_trapno
;
53 __xregister_t mc_eflags
;
60 __xregister_t mc_flags
;
62 int mc_fpstate
[128] __aligned(16);
63 __xregister_t mc_fsbase
;
64 __xregister_t mc_gsbase
;
65 __xregister_t mc_xfpustate
;
66 __xregister_t mc_xfpustate_len
;
71 typedef struct __xucontext
{
73 xmcontext_t uc_mcontext
;
75 struct __ucontext
*uc_link
;
81 struct xkinfo_vmentry
{
84 __xuint64_t kve_start
;
86 __xuint64_t kve_offset
;
87 __xuint64_t kve_vn_fileid
;
88 __uint32_t kve_vn_fsid
;
91 int kve_private_resident
;
96 __xuint64_t kve_vn_size
;
97 __uint32_t kve_vn_rdev
;
98 __uint16_t kve_vn_mode
;
99 __uint16_t kve_status
;
101 char kve_path
[PATH_MAX
];
115 struct xdl_phdr_info
{
117 const char *dlpi_name
;
118 const XElf32_Phdr
*dlpi_phdr
;
120 unsigned long long int dlpi_adds
;
121 unsigned long long int dlpi_subs
;
122 size_t dlpi_tls_modid
;
126 typedef int (*__xdl_iterate_hdr_callback
)(struct xdl_phdr_info
*, size_t, void*);
127 typedef int xdl_iterate_phdr_t(__xdl_iterate_hdr_callback
, void*);
129 #define xdl_iterate_phdr(callback, param) \
130 (((xdl_iterate_phdr_t*) dl_iterate_phdr)((callback), (param)))
132 } // namespace __sanitizer
134 # endif // __FreeBSD_version <= 902001
135 #endif // SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32)
137 #endif // SANITIZER_FREEBSD_H