Home | History | Annotate | Download | only in sanitizer_common
      1 //===-- sanitizer_freebsd.h -------------------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file is a part of Sanitizer runtime. It contains FreeBSD-specific
     11 // definitions.
     12 //
     13 //===----------------------------------------------------------------------===//
     14 
     15 #ifndef SANITIZER_FREEBSD_H
     16 #define SANITIZER_FREEBSD_H
     17 
     18 #include "sanitizer_internal_defs.h"
     19 
     20 // x86-64 FreeBSD 9.2 and older define 'ucontext_t' incorrectly in
     21 // 32-bit mode.
     22 #if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32)
     23 # include <osreldate.h>
     24 # if __FreeBSD_version <= 902001  // v9.2
     25 #  include <ucontext.h>
     26 
     27 namespace __sanitizer {
     28 
     29 typedef __int32_t __xregister_t;
     30 
     31 typedef struct __xmcontext {
     32   __xregister_t mc_onstack;
     33   __xregister_t mc_gs;
     34   __xregister_t mc_fs;
     35   __xregister_t mc_es;
     36   __xregister_t mc_ds;
     37   __xregister_t mc_edi;
     38   __xregister_t mc_esi;
     39   __xregister_t mc_ebp;
     40   __xregister_t mc_isp;
     41   __xregister_t mc_ebx;
     42   __xregister_t mc_edx;
     43   __xregister_t mc_ecx;
     44   __xregister_t mc_eax;
     45   __xregister_t mc_trapno;
     46   __xregister_t mc_err;
     47   __xregister_t mc_eip;
     48   __xregister_t mc_cs;
     49   __xregister_t mc_eflags;
     50   __xregister_t mc_esp;
     51   __xregister_t mc_ss;
     52 
     53   int mc_len;
     54   int mc_fpformat;
     55   int mc_ownedfp;
     56   __xregister_t mc_flags;
     57 
     58   int mc_fpstate[128] __aligned(16);
     59   __xregister_t mc_fsbase;
     60   __xregister_t mc_gsbase;
     61   __xregister_t mc_xfpustate;
     62   __xregister_t mc_xfpustate_len;
     63 
     64   int mc_spare2[4];
     65 } xmcontext_t;
     66 
     67 typedef struct __xucontext {
     68   sigset_t  uc_sigmask;
     69   xmcontext_t  uc_mcontext;
     70 
     71   struct __ucontext *uc_link;
     72   stack_t uc_stack;
     73   int uc_flags;
     74   int __spare__[4];
     75 } xucontext_t;
     76 
     77 }  // namespace __sanitizer
     78 
     79 # endif  // __FreeBSD_version <= 902001
     80 #endif  // SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32)
     81 
     82 #endif  // SANITIZER_FREEBSD_H
     83