Skip to content

Commit 8e084a4

Browse files
committed
hace: Use shared context in .ram_nc for ctx_mut
Switch HaceController::ctx_mut to return a mutable reference to the shared static context located in non-cacheable RAM (.ram_nc). Replaces local instance field `aspeed_hash_ctx` with access to `SHARED_HASH_CTX`. Signed-off-by: Steven Lee <steven_lee@aspeedtech.com>
1 parent e4caf9f commit 8e084a4

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

memory.x

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ _stext = ORIGIN(RAM) + 0x420;
3232
*/
3333
SECTIONS
3434
{
35-
.ram_nc (NOLOAD) : ALIGN(4)
35+
.ram_nc (NOLOAD) : ALIGN(16)
3636
{
37-
*(.ram_nc);
38-
. = ALIGN(4);
39-
} >RAM_NC
37+
__ram_nc_start = .;
38+
KEEP(*(.ram_nc));
39+
__ram_nc_end = .;
40+
} > RAM_NC
4041
}

src/hace_controller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl MacErrorType for HaceController<'_> {
337337

338338
impl HaceController<'_> {
339339
pub fn ctx_mut(&mut self) -> &mut AspeedHashContext {
340-
&mut self.aspeed_hash_ctx // Direct reference to owned context
340+
unsafe { &mut *Self::shared_ctx() }
341341
}
342342

343343
pub fn start_hash_operation(&mut self, len: u32) {

0 commit comments

Comments
 (0)