Implement getters for fuse values, fill out smcGetConfig

This commit is contained in:
Michael Scire 2018-02-25 01:21:52 -08:00
parent b0079e404d
commit 82b4c6763d
8 changed files with 132 additions and 16 deletions

View file

@ -21,6 +21,10 @@ static inline uint32_t read32be(const unsigned char *dword, size_t offset) {
return __builtin_bswap32(read32le(dword, offset));
}
static inline uint64_t read64le(const void *qword, size_t offset) {
return *(uint32_t *)((uintptr_t)dword + offset);
}
static __attribute__((noinline)) bool check_32bit_additive_overflow(uint32_t a, uint32_t b) {
uint64_t x = (uint64_t)a + (uint64_t)b;
return x > (uint64_t)(UINT32_MAX);