Skip to content

Commit 2b57b4f

Browse files
authored
Merge pull request #36 from google/entry
Make set_exception_vector and enable_mmu public
2 parents 9866e64 + 376a124 commit 2b57b4f

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

CHANGELOG.md

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

3+
## Unreleased
4+
5+
### Improvements
6+
7+
- Made `set_exception_vector` public.
8+
- Made `enable_mmu` public.
9+
310
## 0.4.0
411

512
### Breaking changes

src/lib.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,30 @@ pub use pagetable::{
4747
InitialPagetable,
4848
};
4949

50+
/// No-op when the `initial-pagetable` feature isn't enabled.
5051
#[cfg(not(feature = "initial-pagetable"))]
5152
#[unsafe(naked)]
5253
#[unsafe(link_section = ".init")]
5354
#[unsafe(export_name = "enable_mmu")]
54-
extern "C" fn enable_mmu() {
55+
pub extern "C" fn enable_mmu() {
5556
naked_asm!("ret")
5657
}
5758

59+
#[cfg(feature = "initial-pagetable")]
60+
unsafe extern "C" {
61+
/// Enables the MMU and caches with the initial pagetable.
62+
///
63+
/// This is called automatically from entry point code both for primary and secondary CPUs so
64+
/// you usually won't need to call this yourself, but is available in case you need to implement
65+
/// your own assembly entry point.
66+
pub safe fn enable_mmu();
67+
}
68+
5869
/// Sets the appropriate vbar to point to our `vector_table`, if the `exceptions` feature is
5970
/// enabled.
60-
extern "C" fn set_exception_vector() {
71+
///
72+
/// If `exceptions` is not enabled then this is a no-op.
73+
pub extern "C" fn set_exception_vector() {
6174
// SAFETY: We provide a valid vector table.
6275
#[cfg(all(feature = "el1", feature = "exceptions"))]
6376
unsafe {

0 commit comments

Comments
 (0)