[PATCH] [libcxxabi] replace bzero with memset and add wmmx registers to Registers_arm

Jon Roelofs jonathan at codesourcery.com
Tue Apr 15 14:05:39 PDT 2014


Hi nlewycky,

First part is to support newlib as the c library.
The second part is for ARM EHABI support.

http://reviews.llvm.org/D3385

Files:
  src/Unwind/Registers.hpp

Index: src/Unwind/Registers.hpp
===================================================================
--- src/Unwind/Registers.hpp
+++ src/Unwind/Registers.hpp
@@ -15,6 +15,7 @@
 
 #include <stdint.h>
 #include <strings.h>
+#include <string.h>
 
 #include "libunwind.h"
 #include "config.h"
@@ -91,7 +92,7 @@
 }
 
 inline Registers_x86::Registers_x86() {
-  bzero(&_registers, sizeof(_registers));
+  memset(&_registers, 0, sizeof(_registers));
 }
 
 inline bool Registers_x86::validRegister(int regNum) const {
@@ -282,7 +283,7 @@
 }
 
 inline Registers_x86_64::Registers_x86_64() {
-  bzero(&_registers, sizeof(_registers));
+  memset(&_registers, 0, sizeof(_registers));
 }
 
 inline bool Registers_x86_64::validRegister(int regNum) const {
@@ -548,9 +549,9 @@
 }
 
 inline Registers_ppc::Registers_ppc() {
-  bzero(&_registers, sizeof(_registers));
-  bzero(&_floatRegisters, sizeof(_floatRegisters));
-  bzero(&_vectorRegisters, sizeof(_vectorRegisters));
+  memset(&_registers, 0, sizeof(_registers));
+  memset(&_floatRegisters, 0, sizeof(_floatRegisters));
+  memset(&_vectorRegisters, 0, sizeof(_vectorRegisters));
 }
 
 inline bool Registers_ppc::validRegister(int regNum) const {
@@ -1065,8 +1066,8 @@
 }
 
 inline Registers_arm64::Registers_arm64() {
-  bzero(&_registers, sizeof(_registers));
-  bzero(&_vectorHalfRegisters, sizeof(_vectorHalfRegisters));
+  memset(&_registers, 0, sizeof(_registers));
+  memset(&_vectorHalfRegisters, 0, sizeof(_vectorHalfRegisters));
 }
 
 inline bool Registers_arm64::validRegister(int regNum) const {
@@ -1320,16 +1321,23 @@
   };
 
   GPRs    _registers;
+  uint8_t _wmmxData[sizeof(uint64_t) * 16];
+  uint8_t _wmmxControl[sizeof(uint32_t) * 4];
 };
 
 inline Registers_arm::Registers_arm(const void *registers) {
   static_assert(sizeof(Registers_arm) < sizeof(unw_context_t),
                     "arm registers do not fit into unw_context_t");
+  // See unw_getcontext() note about data.
   memcpy(&_registers, registers, sizeof(_registers));
+  memset(_wmmxData, 0, sizeof(_wmmxData));
+  memset(_wmmxControl, 0, sizeof(_wmmxControl));
 }
 
 inline Registers_arm::Registers_arm() {
-  bzero(&_registers, sizeof(_registers));
+  memset(&_registers, 0, sizeof(_registers));
+  memset(_wmmxData, 0, sizeof(_wmmxData));
+  memset(_wmmxControl, 0, sizeof(_wmmxControl));
 }
 
 inline bool Registers_arm::validRegister(int regNum) const {
@@ -1538,16 +1546,16 @@
   }
 }
 
-inline bool Registers_arm::validFloatRegister(int) const {
+inline bool Registers_arm::validFloatRegister(int regNum) const {
   // FIXME: Implement float register support.
   return false;
 }
 
-inline unw_fpreg_t Registers_arm::getFloatRegister(int) const {
+inline unw_fpreg_t Registers_arm::getFloatRegister(int regNum) const {
   _LIBUNWIND_ABORT("ARM float register support not yet implemented");
 }
 
-inline void Registers_arm::setFloatRegister(int, unw_fpreg_t) {
+inline void Registers_arm::setFloatRegister(int regNum, unw_fpreg_t value) {
   _LIBUNWIND_ABORT("ARM float register support not yet implemented");
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3385.1.patch
Type: text/x-patch
Size: 3050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140415/fd811268/attachment.bin>


More information about the cfe-commits mailing list