aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-07-26 10:33:28 -0400
committerGitHub <noreply@github.com>2023-07-26 10:33:28 -0400
commita28a0c47f85da1768c1fcab73b06c8e2bee96bcd (patch)
treeab5c72b17b15185ec40945c5ba29400569b50630 /src/common
parenta9b733893c6862124de9eac2d0226e1b3f36c637 (diff)
parent85d77f636c7ab28ea67c4c303f5d85b063ceed73 (diff)
Merge pull request #10990 from comex/ubsan
Fixes and workarounds to make UBSan happier on macOS
Diffstat (limited to 'src/common')
-rw-r--r--src/common/page_table.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/page_table.h b/src/common/page_table.h
index fec8378f31..e653d52adc 100644
--- a/src/common/page_table.h
+++ b/src/common/page_table.h
@@ -51,7 +51,7 @@ struct PageTable {
class PageInfo {
public:
/// Returns the page pointer
- [[nodiscard]] u8* Pointer() const noexcept {
+ [[nodiscard]] uintptr_t Pointer() const noexcept {
return ExtractPointer(raw.load(std::memory_order_relaxed));
}
@@ -61,7 +61,7 @@ struct PageTable {
}
/// Returns the page pointer and attribute pair, extracted from the same atomic read
- [[nodiscard]] std::pair<u8*, PageType> PointerType() const noexcept {
+ [[nodiscard]] std::pair<uintptr_t, PageType> PointerType() const noexcept {
const uintptr_t non_atomic_raw = raw.load(std::memory_order_relaxed);
return {ExtractPointer(non_atomic_raw), ExtractType(non_atomic_raw)};
}
@@ -73,13 +73,13 @@ struct PageTable {
}
/// Write a page pointer and type pair atomically
- void Store(u8* pointer, PageType type) noexcept {
- raw.store(reinterpret_cast<uintptr_t>(pointer) | static_cast<uintptr_t>(type));
+ void Store(uintptr_t pointer, PageType type) noexcept {
+ raw.store(pointer | static_cast<uintptr_t>(type));
}
/// Unpack a pointer from a page info raw representation
- [[nodiscard]] static u8* ExtractPointer(uintptr_t raw) noexcept {
- return reinterpret_cast<u8*>(raw & (~uintptr_t{0} << ATTRIBUTE_BITS));
+ [[nodiscard]] static uintptr_t ExtractPointer(uintptr_t raw) noexcept {
+ return raw & (~uintptr_t{0} << ATTRIBUTE_BITS);
}
/// Unpack a page type from a page info raw representation