Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

Commit

Permalink
Merge 0142e99 into e487d7b
Browse files Browse the repository at this point in the history
  • Loading branch information
fjricci committed Apr 22, 2016
2 parents e487d7b + 0142e99 commit acfd829
Show file tree
Hide file tree
Showing 11 changed files with 326 additions and 227 deletions.
10 changes: 5 additions & 5 deletions Definitions/X86.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@
"x87-regs" : {
"*" : {
"bit-size" : 80,
"encoding" : "ieee-extended",
"format" : "float",
"encoding" : "int",
"format" : "vector",
"gdb-encoding" : "x87-extension",

"base-dwarf-reg-number" : 33,
Expand Down Expand Up @@ -539,14 +539,14 @@
"x87-flags",
"sse-flags",
"sse-mask",
"x87-regs"
"x87-regs",
"sse-regs"
]
},
{
"description" : "Advanced Vector Extensions",
"sets" : [
"avx-regs",
"sse-regs"
"avx-regs"
]
}
]
Expand Down
22 changes: 11 additions & 11 deletions Definitions/X86_64.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@
"x87-regs" : {
"*" : {
"bit-size" : 80,
"encoding" : "ieee-extended",
"format" : "float",
"encoding" : "int",
"format" : "vector",
"gdb-encoding" : "x87-extension",

"base-dwarf-reg-number" : 33,
Expand Down Expand Up @@ -536,14 +536,14 @@
"no-gdb-reg-number" : true
},

"fctrl" : { },
"fstat" : { },
"ftag" : { },
"fctrl" : { "bit-size" : 16 },
"fstat" : { "bit-size" : 16 },
"ftag" : { "bit-size" : 8 },
"fiseg" : { },
"fioff" : { "bit-size" : 64 },
"fioff" : { },
"foseg" : { },
"fooff" : { "bit-size" : 64 },
"fop" : { }
"fooff" : { },
"fop" : { "bit-size" : 16 }
},

"sse-flags" : {
Expand Down Expand Up @@ -788,14 +788,14 @@
"x87-flags",
"sse-flags",
"sse-mask",
"x87-regs"
"x87-regs",
"sse-regs"
]
},
{
"description" : "Advanced Vector Extensions",
"sets" : [
"avx-regs",
"sse-regs"
"avx-regs"
]
}
]
Expand Down
32 changes: 16 additions & 16 deletions Headers/DebugServer2/Architecture/X86/RegistersDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,22 +179,22 @@ enum /* lldb_reg */ {
reg_lldb_fop = 39,
reg_lldb_mxcsr = 40,
reg_lldb_mxcsrmask = 41,
reg_lldb_ymm0 = 50,
reg_lldb_ymm1 = 51,
reg_lldb_ymm2 = 52,
reg_lldb_ymm3 = 53,
reg_lldb_ymm4 = 54,
reg_lldb_ymm5 = 55,
reg_lldb_ymm6 = 56,
reg_lldb_ymm7 = 57,
reg_lldb_xmm0 = 58,
reg_lldb_xmm1 = 59,
reg_lldb_xmm2 = 60,
reg_lldb_xmm3 = 61,
reg_lldb_xmm4 = 62,
reg_lldb_xmm5 = 63,
reg_lldb_xmm6 = 64,
reg_lldb_xmm7 = 65,
reg_lldb_ymm0 = 58,
reg_lldb_ymm1 = 59,
reg_lldb_ymm2 = 60,
reg_lldb_ymm3 = 61,
reg_lldb_ymm4 = 62,
reg_lldb_ymm5 = 63,
reg_lldb_ymm6 = 64,
reg_lldb_ymm7 = 65,
reg_lldb_xmm0 = 50,
reg_lldb_xmm1 = 51,
reg_lldb_xmm2 = 52,
reg_lldb_xmm3 = 53,
reg_lldb_xmm4 = 54,
reg_lldb_xmm5 = 55,
reg_lldb_xmm6 = 56,
reg_lldb_xmm7 = 57,
};

extern LLDBDescriptor const LLDB;
Expand Down
18 changes: 10 additions & 8 deletions Headers/DebugServer2/Architecture/X86_64/CPUState.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ struct CPUState64 {

struct {
X87Register regs[8];
uint32_t fstw;
uint32_t fctw;
uint32_t ftag;
uint64_t firip;
uint64_t forip;
uint32_t fop;
uint16_t fstw;
uint16_t fctw;
uint8_t ftag;
uint32_t firip;
uint32_t forip;
uint16_t fop;
} x87;

union {
Expand All @@ -103,9 +103,9 @@ struct CPUState64 {
SSEVector _sse[128];
};
SSEVector const &operator[](size_t index) const {
return _sse[index << 1];
return _sse[index << 2];
}
SSEVector &operator[](size_t index) { return _sse[index << 1]; }
SSEVector &operator[](size_t index) { return _sse[index << 2]; }
} regs;
} sse;

Expand All @@ -132,6 +132,8 @@ struct CPUState64 {
} eavx;
};

// TODO - add information about xstate_hdr here

struct {
uint32_t dr[8];
} dr;
Expand Down
39 changes: 39 additions & 0 deletions Headers/DebugServer2/Architecture/X86_64/RegSets.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// Copyright (c) 2014-present, Facebook, Inc.
// All rights reserved.
//
// This source code is licensed under the University of Illinois/NCSA Open
// Source License found in the LICENSE file in the root directory of this
// source tree. An additional grant of patent rights can be found in the
// PATENTS file in the same directory.
//

#ifndef __DebugServer2_Architecture_X86_RegSets_h
#define __DebugServer2_Architecture_X86_RegSets_h

#include <sys/user.h>

namespace ds2 {
namespace Architecture {
namespace X86_64 {

struct YMMHighVector {
uint8_t value[16];
};

struct xstate_hdr {
uint64_t mask;
uint64_t reserved1[2];
uint64_t reserved2[5];
} DS2_ATTRIBUTE_PACKED;

struct xfpregs_struct {
user_fpregs_struct fpregs;
xstate_hdr header;
YMMHighVector ymmh[16];
} DS2_ATTRIBUTE_PACKED DS2_ATTRIBUTE_ALIGNED(64);
}
}
}

#endif // !__DebugServer2_Architecture_X86_RegSets_h
64 changes: 32 additions & 32 deletions Headers/DebugServer2/Architecture/X86_64/RegistersDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,38 +288,38 @@ enum /* lldb_reg */ {
reg_lldb_fop = 83,
reg_lldb_mxcsr = 84,
reg_lldb_mxcsrmask = 85,
reg_lldb_ymm0 = 94,
reg_lldb_ymm1 = 95,
reg_lldb_ymm2 = 96,
reg_lldb_ymm3 = 97,
reg_lldb_ymm4 = 98,
reg_lldb_ymm5 = 99,
reg_lldb_ymm6 = 100,
reg_lldb_ymm7 = 101,
reg_lldb_ymm8 = 102,
reg_lldb_ymm9 = 103,
reg_lldb_ymm10 = 104,
reg_lldb_ymm11 = 105,
reg_lldb_ymm12 = 106,
reg_lldb_ymm13 = 107,
reg_lldb_ymm14 = 108,
reg_lldb_ymm15 = 109,
reg_lldb_xmm0 = 110,
reg_lldb_xmm1 = 111,
reg_lldb_xmm2 = 112,
reg_lldb_xmm3 = 113,
reg_lldb_xmm4 = 114,
reg_lldb_xmm5 = 115,
reg_lldb_xmm6 = 116,
reg_lldb_xmm7 = 117,
reg_lldb_xmm8 = 118,
reg_lldb_xmm9 = 119,
reg_lldb_xmm10 = 120,
reg_lldb_xmm11 = 121,
reg_lldb_xmm12 = 122,
reg_lldb_xmm13 = 123,
reg_lldb_xmm14 = 124,
reg_lldb_xmm15 = 125,
reg_lldb_ymm0 = 110,
reg_lldb_ymm1 = 111,
reg_lldb_ymm2 = 112,
reg_lldb_ymm3 = 113,
reg_lldb_ymm4 = 114,
reg_lldb_ymm5 = 115,
reg_lldb_ymm6 = 116,
reg_lldb_ymm7 = 117,
reg_lldb_ymm8 = 118,
reg_lldb_ymm9 = 119,
reg_lldb_ymm10 = 120,
reg_lldb_ymm11 = 121,
reg_lldb_ymm12 = 122,
reg_lldb_ymm13 = 123,
reg_lldb_ymm14 = 124,
reg_lldb_ymm15 = 125,
reg_lldb_xmm0 = 94,
reg_lldb_xmm1 = 95,
reg_lldb_xmm2 = 96,
reg_lldb_xmm3 = 97,
reg_lldb_xmm4 = 98,
reg_lldb_xmm5 = 99,
reg_lldb_xmm6 = 100,
reg_lldb_xmm7 = 101,
reg_lldb_xmm8 = 102,
reg_lldb_xmm9 = 103,
reg_lldb_xmm10 = 104,
reg_lldb_xmm11 = 105,
reg_lldb_xmm12 = 106,
reg_lldb_xmm13 = 107,
reg_lldb_xmm14 = 108,
reg_lldb_xmm15 = 109,
};

extern LLDBDescriptor const LLDB;
Expand Down
12 changes: 12 additions & 0 deletions Headers/DebugServer2/Utils/CompilerSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@
#define DS2_ATTRIBUTE_NORETURN
#endif

#if __has_attribute(packed)
#define DS2_ATTRIBUTE_PACKED __attribute__((packed))
#else
#define DS2_ATTRIBUTE_PACKED
#endif

#if __has_attribute(aligned)
#define DS2_ATTRIBUTE_ALIGNED(size) __attribute__((aligned(size)))
#else
#define DS2_ATTRIBUTE_ALIGNED(size)
#endif

#if defined(COMPILER_MSVC)
#define DS2_UNREACHABLE() __assume(0)
#elif __has_builtin(__builtin_unreachable)
Expand Down
Loading

0 comments on commit acfd829

Please sign in to comment.