updated green threads example with new

aked_function requirements
This commit is contained in:
Carl Fredrik Samson
2022-12-12 22:31:37 +01:00
parent df5613c87e
commit 8174b675ae

View File

@@ -156,7 +156,7 @@ _**Press the expand icon in the top right corner to show the example code (you'l
```rust, edition2021 ```rust, edition2021
# #![feature(naked_functions)] # #![feature(naked_functions)]
# use std::{arch::asm, ptr}; # use std::arch::asm;
# #
# const DEFAULT_STACK_SIZE: usize = 1024 * 1024 * 2; # const DEFAULT_STACK_SIZE: usize = 1024 * 1024 * 2;
# const MAX_THREADS: usize = 4; # const MAX_THREADS: usize = 4;
@@ -308,7 +308,7 @@ _**Press the expand icon in the top right corner to show the example code (you'l
# } # }
# #
# #[naked] # #[naked]
# unsafe fn skip() { # unsafe extern "C" fn skip() {
# asm!("ret", options(noreturn)) # asm!("ret", options(noreturn))
# } # }
# #
@@ -329,7 +329,7 @@ _**Press the expand icon in the top right corner to show the example code (you'l
# } # }
# #[naked] # #[naked]
# #[no_mangle] # #[no_mangle]
# unsafe fn switch() { # unsafe extern "C" fn switch() {
# asm!( # asm!(
# "mov 0x00[rdi], rsp", # "mov 0x00[rdi], rsp",
# "mov 0x08[rdi], r15", # "mov 0x08[rdi], r15",