1 //===-- sanitizer_freebsd.h -------------------------------------*- C++ -*-===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of Sanitizer runtime. It contains FreeBSD-specific
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
20 #if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32)
21 # include <osreldate.h>
22 # if __FreeBSD_version <= 902001 // v9.2
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
;
47 __xregister_t mc_trapno
;
51 __xregister_t mc_eflags
;
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
;
69 typedef struct __xucontext
{
71 xmcontext_t uc_mcontext
;
73 struct __ucontext
*uc_link
;
79 struct xkinfo_vmentry
{
82 __xuint64_t kve_start
;
84 __xuint64_t kve_offset
;
85 __xuint64_t kve_vn_fileid
;
86 __uint32_t kve_vn_fsid
;
89 int kve_private_resident
;
94 __xuint64_t kve_vn_size
;
95 __uint32_t kve_vn_rdev
;
96 __uint16_t kve_vn_mode
;
97 __uint16_t kve_status
;
99 char kve_path
[PATH_MAX
];
113 struct xdl_phdr_info
{
115 const char *dlpi_name
;
116 const XElf32_Phdr
*dlpi_phdr
;
118 unsigned long long int dlpi_adds
;
119 unsigned long long int dlpi_subs
;
120 size_t dlpi_tls_modid
;
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