Rename common to gdbsupport
[deliverable/binutils-gdb.git] / gdb / gdbserver / lynx-i386-low.c
index 7fb28cb18ad7d4f2d804374416d34dbd8dc492cf..ca707acf43bf700d939815bf82ae86b936080110 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "lynx-low.h"
 #include <limits.h>
 #include <sys/ptrace.h>
+#include "gdbsupport/x86-xstate.h"
+#include "arch/i386.h"
+#include "x86-tdesc.h"
 
 /* The following two typedefs are defined in a .h file which is not
    in the standard include path (/sys/include/family/x86/ucontext.h),
-   so we just duplicate them here.  */
+   so we just duplicate them here.
+
+   Unfortunately for us, the definition of this structure differs between
+   LynxOS 5.x and LynxOS 178.  Rather than duplicate the code, we use
+   different definitions depending on the target.  */
+
+#ifdef VMOS_DEV
+#define LYNXOS_178
+#endif
 
 /* General register context */
 typedef struct usr_econtext {
@@ -49,6 +60,28 @@ typedef struct usr_econtext {
     uint32_t    uec_gs;
 } usr_econtext_t;
 
+#if defined(LYNXOS_178)
+
+/* Floating point register context                                                                                      */
+typedef struct usr_fcontext {
+        uint32_t         ufc_control;
+        uint32_t         ufc_status;
+        uint32_t         ufc_tag;
+        uint8_t         *ufc_inst_off;
+        uint32_t         ufc_inst_sel;
+        uint8_t         *ufc_data_off;
+        uint32_t         ufc_data_sel;
+        struct ufp387_real {
+                uint16_t        umant4;
+        uint16_t        umant3;
+        uint16_t        umant2;
+        uint16_t        umant1;
+        uint16_t        us_and_e;
+        } ufc_reg[8];
+} usr_fcontext_t;
+
+#else /* This is LynxOS 5.x.  */
+
 /* Floating point and SIMD register context */
 typedef struct usr_fcontext {
         uint16_t         ufc_control;
@@ -84,6 +117,8 @@ typedef struct usr_fcontext {
         char ureserved[16][14];
 } usr_fcontext_t;
 
+#endif
+
 /* The index of various registers inside the regcache.  */
 
 enum lynx_i386_gdb_regnum
@@ -118,10 +153,6 @@ enum lynx_i386_gdb_regnum
   I386_SENTINEL_REGUM
 };
 
-/* Defined in auto-generated file i386.c.  */
-extern void init_registers_i386 (void);
-extern const struct target_desc *tdesc_i386;
-
 /* The fill_function for the general-purpose register set.  */
 
 static void
@@ -220,6 +251,7 @@ lynx_i386_fill_fpregset (struct regcache *regcache, char *buf)
                     buf + offsetof (usr_fcontext_t, ufc_data_sel));
   collect_register (regcache, I386_FOOFF_REGNUM,
                     buf + offsetof (usr_fcontext_t, ufc_data_off));
+#if !defined(LYNXOS_178)
   collect_16bit_register (regcache, I386_FOP_REGNUM,
                           buf + offsetof (usr_fcontext_t, ufc_opcode));
 
@@ -230,6 +262,7 @@ lynx_i386_fill_fpregset (struct regcache *regcache, char *buf)
                      + i * sizeof (struct uxmm_register));
   collect_register (regcache, I386_MXCSR_REGNUM,
                     buf + offsetof (usr_fcontext_t, usse_mxcsr));
+#endif
 }
 
 /* This is the supply counterpart for collect_16bit_register:
@@ -278,6 +311,7 @@ lynx_i386_store_fpregset (struct regcache *regcache, const char *buf)
                    buf + offsetof (usr_fcontext_t, ufc_data_sel));
   supply_register (regcache, I386_FOOFF_REGNUM,
                    buf + offsetof (usr_fcontext_t, ufc_data_off));
+#if !defined(LYNXOS_178)
   supply_16bit_register (regcache, I386_FOP_REGNUM,
                          buf + offsetof (usr_fcontext_t, ufc_opcode));
 
@@ -288,6 +322,7 @@ lynx_i386_store_fpregset (struct regcache *regcache, const char *buf)
                     + i * sizeof (struct uxmm_register));
   supply_register (regcache, I386_MXCSR_REGNUM,
                    buf + offsetof (usr_fcontext_t, usse_mxcsr));
+#endif
 }
 
 /* Implements the lynx_target_ops.arch_setup routine.  */
@@ -295,8 +330,12 @@ lynx_i386_store_fpregset (struct regcache *regcache, const char *buf)
 static void
 lynx_i386_arch_setup (void)
 {
-  init_registers_i386 ();
-  lynx_tdesc = tdesc_i386;
+  struct target_desc *tdesc
+    = i386_create_target_description (X86_XSTATE_SSE_MASK, false, false);
+
+  init_target_desc (tdesc, i386_expedite_regs);
+
+  lynx_tdesc = tdesc;
 }
 
 /* Description of all the x86-lynx register sets.  */
This page took 0.025688 seconds and 4 git commands to generate.