bolt_arm.go 832 B

12345678910111213141516171819202122232425262728
  1. package bbolt
  2. import "unsafe"
  3. // maxMapSize represents the largest mmap size supported by Bolt.
  4. const maxMapSize = 0x7FFFFFFF // 2GB
  5. // maxAllocSize is the size used when creating array pointers.
  6. const maxAllocSize = 0xFFFFFFF
  7. // Are unaligned load/stores broken on this arch?
  8. var brokenUnaligned bool
  9. func init() {
  10. // Simple check to see whether this arch handles unaligned load/stores
  11. // correctly.
  12. // ARM9 and older devices require load/stores to be from/to aligned
  13. // addresses. If not, the lower 2 bits are cleared and that address is
  14. // read in a jumbled up order.
  15. // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15414.html
  16. raw := [6]byte{0xfe, 0xef, 0x11, 0x22, 0x22, 0x11}
  17. val := *(*uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&raw)) + 2))
  18. brokenUnaligned = val != 0x11222211
  19. }