Skip to content

Commit

Permalink
kernel/task: Run user-mode tasks with interrupts enabled
Browse files Browse the repository at this point in the history
Execution in user mode should not block the prompt handling of
interrupts that may be presented while user mode is executing.

Signed-off-by: Jon Lange <jlange@microsoft.com>
  • Loading branch information
msft-jlange committed May 14, 2024
1 parent 760ca4c commit 6075f23
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/src/task/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,12 @@ impl Task {

// 'Push' the task frame onto the stack
unsafe {
// Setup IRQ return frame
// Setup IRQ return frame. User-mode tasks always run with
// interrupts enabled.
let mut iret_frame = X86ExceptionContext::default();
iret_frame.frame.rip = user_entry;
iret_frame.frame.cs = (SVSM_USER_CS | 3).into();
iret_frame.frame.flags = 0;
iret_frame.frame.flags = 0x202;
iret_frame.frame.rsp = (USER_MEM_END - 8).into();
iret_frame.frame.ss = (SVSM_USER_DS | 3).into();

Expand Down

0 comments on commit 6075f23

Please sign in to comment.