updated green threads example with new
aked_function requirements
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user