Revert "Debug system calls exiting without interrupts enabled."

This reverts commit c0bc774c9aa8aa3834f40afc7ad5aa909afc61a1.
This commit is contained in:
Jonas 'Sortie' Termansen 2023-03-19 11:14:51 +01:00
parent b47add350e
commit a850e68652
2 changed files with 1 additions and 58 deletions

View File

@ -19,7 +19,6 @@
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <timespec.h>
@ -262,43 +261,25 @@ int sys_clock_nanosleep(clockid_t clockid,
const struct timespec* user_duration,
struct timespec* user_remainder)
{
assert(Interrupt::IsEnabled());
struct timespec time;
assert(Interrupt::IsEnabled());
Clock* clock = Time::GetClock(clockid);
assert(Interrupt::IsEnabled());
if ( !clock )
{
assert(Interrupt::IsEnabled());
return -1;
}
if ( !CopyFromUser(&time, user_duration, sizeof(time)) )
{
assert(Interrupt::IsEnabled());
return -1;
}
if ( !timespec_is_canonical(time) )
return errno = EINVAL, -1;
assert(Interrupt::IsEnabled());
time = flags & TIMER_ABSTIME ? clock->SleepUntil(time) :
clock->SleepDelay(time);
assert(Interrupt::IsEnabled());
if ( user_remainder && !CopyToUser(user_remainder, &time, sizeof(time)) )
{
assert(Interrupt::IsEnabled());
return -1;
}
assert(Interrupt::IsEnabled());
int result = timespec_eq(time, timespec_nul()) ? 0 : (errno = EINTR, -1);
assert(Interrupt::IsEnabled());
return result;
return timespec_eq(time, timespec_nul()) ? 0 : (errno = EINTR, -1);
}
int sys_timens(struct tmns* user_tmns)

View File

@ -30,17 +30,7 @@ syscall_handler:
pushq %rbp
movq %rsp, %rbp
pushq %rax
sub $8, %rsp
pushf
pop %r10
mov $0x200, %r11
test %r10, %r11
jz 5f
# Make sure the requested system call is valid, if not, then fix it.
mov %rax, %r10
cmp $SYSCALL_MAX_NUM, %rax
jae 3f
@ -54,13 +44,6 @@ syscall_handler:
# Call the system call.
callq *%rax
pushf
pop %rsi
mov $0x200, %r8
test %rsi, %r8
jz 6f
addq $16, %rsp
# Return to user-space, system call result in %rax:%rdx, errno in %ecx.
popq %rbp
movl errno, %ecx
@ -108,25 +91,4 @@ syscall_handler:
xor %r8, %r8
jmp 2b
5:
mov $syscall_interrupt_string_before, %rdi
jmp 7f
6:
mov $syscall_interrupt_string_after, %rdi
jmp 7f
7:
add $8, %rsp
pop %rsi
call PanicF
.size syscall_handler, .-syscall_handler
.section .rodata
.type syscall_interrupt_string_before, @object
.size syscall_interrupt_string_before, 56
syscall_interrupt_string_before:
.string "System call %u exited without interrupts enabled before"
.type syscall_interrupt_string_after, @object
.size syscall_interrupt_string_after, 55
syscall_interrupt_string_after:
.string "System call %u exited without interrupts enabled after"