File tree Expand file tree Collapse file tree 3 files changed +18
-15
lines changed Expand file tree Collapse file tree 3 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -238,13 +238,14 @@ struct CPUState64 {
238
238
gp.r14 = regs[14 ];
239
239
gp.r15 = regs[15 ];
240
240
gp.rip = regs[16 ];
241
- gp.eflags = regs[17 ];
242
- gp.cs = regs[18 ];
243
- gp.ss = regs[19 ];
244
- gp.ds = regs[20 ];
245
- gp.es = regs[21 ];
246
- gp.fs = regs[22 ];
247
- gp.gs = regs[23 ];
241
+ // Truncate the value to 32-bit as these are 32-bit registers.
242
+ gp.eflags = static_cast <uint32_t >(regs[17 ]);
243
+ gp.cs = static_cast <uint32_t >(regs[18 ]);
244
+ gp.ss = static_cast <uint32_t >(regs[19 ]);
245
+ gp.ds = static_cast <uint32_t >(regs[20 ]);
246
+ gp.es = static_cast <uint32_t >(regs[21 ]);
247
+ gp.fs = static_cast <uint32_t >(regs[22 ]);
248
+ gp.gs = static_cast <uint32_t >(regs[23 ]);
248
249
}
249
250
250
251
public:
@@ -594,7 +595,7 @@ struct CPUState {
594
595
}
595
596
inline void setPC (uint64_t pc) {
596
597
if (is32)
597
- state32.setPC (pc );
598
+ state32.setPC (static_cast < uint32_t >(pc) );
598
599
else
599
600
state64.setPC (pc);
600
601
}
@@ -604,7 +605,7 @@ struct CPUState {
604
605
}
605
606
inline void setSP (uint64_t sp) {
606
607
if (is32)
607
- state32.setSP (sp );
608
+ state32.setSP (static_cast < uint32_t >(sp) );
608
609
else
609
610
state64.setSP (sp);
610
611
}
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ class HardwareBreakpointManager : public BreakpointManager {
75
75
protected:
76
76
virtual ErrorCode disableDebugCtrlReg (uint64_t &ctrlReg, int idx);
77
77
virtual ErrorCode enableDebugCtrlReg (uint64_t &ctrlReg, int idx, Mode mode,
78
- int size);
78
+ size_t size);
79
79
#endif
80
80
81
81
public:
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ ErrorCode HardwareBreakpointManager::disableLocation(int idx,
90
90
91
91
ErrorCode HardwareBreakpointManager::enableDebugCtrlReg (uint64_t &ctrlReg,
92
92
int idx, Mode mode,
93
- int size) {
93
+ size_t size) {
94
94
int enableIdx = idx * 2 ;
95
95
#if !defined(OS_WIN32)
96
96
enableIdx += 1 ;
@@ -193,7 +193,7 @@ int HardwareBreakpointManager::hit(Target::Thread *thread, Site &site) {
193
193
if (debugRegs[kStatusRegIdx ] & (1ull << i)) {
194
194
DS2ASSERT (_locations[i] != 0 );
195
195
site = _sites.find (_locations[i])->second ;
196
- regIdx = i ;
196
+ regIdx = static_cast < int >(i) ;
197
197
break ;
198
198
}
199
199
}
@@ -277,11 +277,13 @@ ErrorCode HardwareBreakpointManager::writeDebugRegisters(
277
277
state.dr .dr [i] = (i == 4 || i == 5 ) ? 0 : regs[i];
278
278
}
279
279
#elif defined(ARCH_X86_64)
280
- for (int i = 0 ; i < kNumDebugRegisters ; ++i) {
280
+ for (size_t i = 0 ; i < kNumDebugRegisters ; ++i) {
281
281
if (state.is32 ) {
282
- state.state32 .dr .dr [i] = (i == 4 || i == 5 ) ? 0 : regs[i];
282
+ state.state32 .dr .dr [i] =
283
+ (i == 4 || i == 5 ) ? 0 : static_cast <uint32_t >(regs[i]);
283
284
} else {
284
- state.state64 .dr .dr [i] = (i == 4 || i == 5 ) ? 0 : regs[i];
285
+ state.state64 .dr .dr [i] =
286
+ (i == 4 || i == 5 ) ? 0 : static_cast <uint32_t >(regs[i]);
285
287
}
286
288
}
287
289
#else
You can’t perform that action at this time.
0 commit comments