Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions docs/labs/0x03/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,18 @@
macro_rules! as_handler {
($fn: ident) => {
paste::item! {
#[naked]
#[unsafe(naked)]
pub extern "x86-interrupt" fn [<$fn _handler>](_sf: InterruptStackFrame) {
unsafe {
core::arch::naked_asm!("
push rbp
// ...
push r15
call {}
pop r15
// ...
pop rbp
iretq",
sym $fn);
}
core::arch::naked_asm!("
push rbp
// ...
push r15
call {}
pop r15
// ...
pop rbp
iretq",
sym $fn);
}
}
};
Expand Down
1 change: 0 additions & 1 deletion src/0x01/pkg/kernel/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![no_std]
#![feature(naked_functions)]
#![feature(abi_x86_interrupt)]
#![feature(type_alias_impl_trait)]

Expand Down
1 change: 0 additions & 1 deletion src/0x02/pkg/kernel/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![no_std]
#![allow(dead_code)]
#![feature(naked_functions)]
#![feature(abi_x86_interrupt)]
#![feature(alloc_error_handler)]
#![feature(type_alias_impl_trait)]
Expand Down
72 changes: 35 additions & 37 deletions src/0x03/pkg/kernel/src/utils/regs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,44 +46,42 @@ impl fmt::Debug for RegistersValue {
macro_rules! as_handler {
($fn: ident) => {
paste::item! {
#[naked]
#[unsafe(naked)]
pub extern "x86-interrupt" fn [<$fn _handler>](_sf: InterruptStackFrame) {
unsafe {
core::arch::naked_asm!("
push rbp
push rax
push rbx
push rcx
push rdx
push rsi
push rdi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
call {}
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rdi
pop rsi
pop rdx
pop rcx
pop rbx
pop rax
pop rbp
iretq",
sym $fn);
}
core::arch::naked_asm!("
push rbp
push rax
push rbx
push rcx
push rdx
push rsi
push rdi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
call {}
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rdi
pop rsi
pop rdx
pop rcx
pop rbx
pop rax
pop rbp
iretq",
sym $fn);
}
}
};
Expand Down