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 {
238238 gp.r14 = regs[14 ];
239239 gp.r15 = regs[15 ];
240240 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 ]);
248249 }
249250
250251public:
@@ -594,7 +595,7 @@ struct CPUState {
594595 }
595596 inline void setPC (uint64_t pc) {
596597 if (is32)
597- state32.setPC (pc );
598+ state32.setPC (static_cast < uint32_t >(pc) );
598599 else
599600 state64.setPC (pc);
600601 }
@@ -604,7 +605,7 @@ struct CPUState {
604605 }
605606 inline void setSP (uint64_t sp) {
606607 if (is32)
607- state32.setSP (sp );
608+ state32.setSP (static_cast < uint32_t >(sp) );
608609 else
609610 state64.setSP (sp);
610611 }
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ class HardwareBreakpointManager : public BreakpointManager {
7575protected:
7676 virtual ErrorCode disableDebugCtrlReg (uint64_t &ctrlReg, int idx);
7777 virtual ErrorCode enableDebugCtrlReg (uint64_t &ctrlReg, int idx, Mode mode,
78- int size);
78+ size_t size);
7979#endif
8080
8181public:
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ ErrorCode HardwareBreakpointManager::disableLocation(int idx,
9090
9191ErrorCode HardwareBreakpointManager::enableDebugCtrlReg (uint64_t &ctrlReg,
9292 int idx, Mode mode,
93- int size) {
93+ size_t size) {
9494 int enableIdx = idx * 2 ;
9595#if !defined(OS_WIN32)
9696 enableIdx += 1 ;
@@ -193,7 +193,7 @@ int HardwareBreakpointManager::hit(Target::Thread *thread, Site &site) {
193193 if (debugRegs[kStatusRegIdx ] & (1ull << i)) {
194194 DS2ASSERT (_locations[i] != 0 );
195195 site = _sites.find (_locations[i])->second ;
196- regIdx = i ;
196+ regIdx = static_cast < int >(i) ;
197197 break ;
198198 }
199199 }
@@ -277,11 +277,13 @@ ErrorCode HardwareBreakpointManager::writeDebugRegisters(
277277 state.dr .dr [i] = (i == 4 || i == 5 ) ? 0 : regs[i];
278278 }
279279#elif defined(ARCH_X86_64)
280- for (int i = 0 ; i < kNumDebugRegisters ; ++i) {
280+ for (size_t i = 0 ; i < kNumDebugRegisters ; ++i) {
281281 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]);
283284 } 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]);
285287 }
286288 }
287289#else
You can’t perform that action at this time.
0 commit comments