Skip to content

Commit b04472f

Browse files
committed
enable_mmu should be unsafe.
1 parent b76d4ca commit b04472f

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22

3-
## 0.4.1
3+
## 0.4.2
4+
5+
### Fixes
6+
7+
- Made `enable_mmu` unsafe.
8+
9+
## 0.4.1 (yanked)
410

511
### Improvements
612

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aarch64-rt"
3-
version = "0.4.1"
3+
version = "0.4.2"
44
edition = "2024"
55
license = "MIT OR Apache-2.0"
66
description = "Startup code and exception vector for aarch64 Cortex-A processors."

src/lib.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,16 @@ pub use pagetable::{
4848
};
4949

5050
/// No-op when the `initial-pagetable` feature isn't enabled.
51+
///
52+
/// # Safety
53+
///
54+
/// Not really unsafe in this case, but needs to be consistent with the signature when the
55+
/// `initial-pagetable` feature is enabled.
5156
#[cfg(not(feature = "initial-pagetable"))]
5257
#[unsafe(naked)]
5358
#[unsafe(link_section = ".init")]
5459
#[unsafe(export_name = "enable_mmu")]
55-
pub extern "C" fn enable_mmu() {
60+
pub unsafe extern "C" fn enable_mmu() {
5661
naked_asm!("ret")
5762
}
5863

@@ -63,7 +68,11 @@ unsafe extern "C" {
6368
/// This is called automatically from entry point code both for primary and secondary CPUs so
6469
/// you usually won't need to call this yourself, but is available in case you need to implement
6570
/// your own assembly entry point.
66-
pub safe fn enable_mmu();
71+
///
72+
/// # Safety
73+
///
74+
/// The initial pagetable must correctly map everything that the program uses.
75+
pub unsafe fn enable_mmu();
6776
}
6877

6978
/// Sets the appropriate vbar to point to our `vector_table`, if the `exceptions` feature is

0 commit comments

Comments
 (0)