mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Merge pull request #818 from phil-opp/post-06-prevent-tail-recursion
Do a volatile read in stack_overflow test to avoid tail recursion
This commit is contained in:
@@ -23,6 +23,7 @@ pub extern "C" fn _start() -> ! {
|
||||
#[allow(unconditional_recursion)]
|
||||
fn stack_overflow() {
|
||||
stack_overflow(); // for each recursion, the return address is pushed
|
||||
volatile::Volatile::new(0).read(); // prevent tail recursion optimizations
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
|
||||
Reference in New Issue
Block a user