Skip to content

Commit b06d034

Browse files
fork: fs_base should be inherited
Signed-off-by: Andy-Python-Programmer <[email protected]>
1 parent 983efdc commit b06d034

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/aero_kernel/src/arch/x86_64/task.asm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ sysret_fork_init:
8080

8181
o64 sysret
8282

83-
; This function is responsible for switching from the current context to the new one and
84-
; also save the current state in the previous context so there is a restore point.
83+
; extern "C" fn task_spinup(prev: &mut Context, next: &mut Context)
84+
;
85+
; Saves the current context into `prev` and restore the context from `next`.
8586
task_spinup:
8687
pushfq
8788

@@ -112,4 +113,5 @@ task_spinup:
112113

113114
popfq
114115

116+
; Resume the next thread.
115117
ret

src/aero_kernel/src/arch/x86_64/task.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ use core::ptr::Unique;
2828
use crate::fs::cache::DirCacheItem;
2929
use crate::mem::paging::*;
3030
use crate::syscall::{ExecArgs, RegistersFrame, SyscallFrame};
31-
use crate::userland::vm::{LoadedBinary, Vm};
32-
use crate::utils::StackHelper;
31+
use crate::userland::vm::Vm;
32+
use crate::utils::{io, StackHelper};
3333

3434
use super::controlregs;
3535
use super::gdt::Ring;
@@ -278,7 +278,9 @@ impl ArchTask {
278278
context_switch_rsp: VirtAddr::new(switch_stack as u64),
279279
address_space: new_address_space,
280280
rpl: Ring::Ring3,
281-
fs_base: VirtAddr::zero(),
281+
282+
// The FS base is inherited from the parent process.
283+
fs_base: self.fs_base.clone(),
282284
})
283285
}
284286

0 commit comments

Comments
 (0)