remove get_atomic_(d)word because its not used yet and the idea for how atomics will be done will have to be reworked
This commit is contained in:
48
src/mem.rs
48
src/mem.rs
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2025 taitep
|
||||
// Copyright (c) 2025-2026 taitep
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
//
|
||||
// This file is part of TRVE (https://gitea.taitep.se/taitep/trve)
|
||||
@@ -169,52 +169,6 @@ impl MemConfig {
|
||||
.map_err(|e| e.with_addr(addr))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_atomic_dword(&self, addr: u64) -> Result<&AtomicU64, MemoryException> {
|
||||
if !addr.is_multiple_of(8) {
|
||||
return Err(MemoryException {
|
||||
type_: MemoryExceptionType::AddressMisaligned,
|
||||
addr,
|
||||
});
|
||||
}
|
||||
|
||||
let index = ((addr - RAM_START) / 8) as usize;
|
||||
unsafe {
|
||||
self.ram
|
||||
.buf_transmuted::<AtomicU64>()
|
||||
.get(index)
|
||||
.ok_or(MemoryException {
|
||||
type_: MemoryExceptionType::AccessFault,
|
||||
addr,
|
||||
})
|
||||
}
|
||||
}
|
||||
pub fn get_atomic_word(&self, addr: u64) -> Result<&AtomicU32, MemoryException> {
|
||||
if !addr.is_multiple_of(4) {
|
||||
return Err(MemoryException {
|
||||
type_: MemoryExceptionType::AddressMisaligned,
|
||||
addr,
|
||||
});
|
||||
}
|
||||
|
||||
if addr < RAM_START {
|
||||
return Err(MemoryException {
|
||||
type_: MemoryExceptionType::AccessFault,
|
||||
addr,
|
||||
});
|
||||
}
|
||||
|
||||
let index = ((addr - RAM_START) / 4) as usize;
|
||||
unsafe {
|
||||
self.ram
|
||||
.buf_transmuted::<AtomicU32>()
|
||||
.get(index)
|
||||
.ok_or(MemoryException {
|
||||
type_: MemoryExceptionType::AccessFault,
|
||||
addr,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
||||
Reference in New Issue
Block a user