Age | Commit message (Collapse) | Author |
|
|
|
This made it possible to map the E1000 MMIO range into userspace and
mess with the registers.
Thanks to @grigoritchy for finding this!
Fixes #2015.
|
|
|
|
If we OOM during a CoW fault and fail to allocate a new page for the
writing process, just leave the original VMObject alone so everyone
else can keep using it.
|
|
Since a Region is basically a view into a potentially larger VMObject,
it was always necessary to include the Region starting offset when
accessing its underlying physical pages.
Until now, you had to do that manually, but this patch adds a simple
Region::physical_page() for read-only access and a physical_page_slot()
when you want a mutable reference to the RefPtr<PhysicalPage> itself.
A lot of code is simplified by making use of this.
|
|
Previously we blindly just called update_next_timer_due() when
ever we modified the timer list. Since we know the list is sorted
this is a bit wasteful, and we can do better.
This change refactors the code so we only update the next due time
when necessary. In places where it was possible the code was modified
to directly modify the next due time, instead of having to go to the
front of the list to fetch it.
|
|
The public consumers of the timer API shouldn't need to know
the how timer id's are tracked internally. Expose a typedef
instead to allow the internal implementation to be protected
from potential churn in the future.
It's also just good API design.
|
|
Utilize the new Thread::wait_on timeout parameter to implement
timeout support for FUTEX_WAIT.
As we compute the relative time from the user specified absolute
time, we try to delay that computation as long as possible before
we call into Thread::wait_on(..). To enable this a small bit of
refactoring was done pull futex_queue fetching out and timeout fetch
and calculation separation.
|
|
This change plumbs a new optional timeout option to wait_on.
The timeout is enabled by enqueing a timer on the timer queue
while we are waiting. We can then see if we were woken up or
timed out by checking if we are still on the wait queue or not.
|
|
The current API of add_timer makes it hard to use as
you are forced to do a bunch of time arithmetic at the
caller. Ideally we would have overloads for common time
types like timespec or timeval to keep the API as straight
forward as possible. This change moves us in that direction.
While I'm here, we should really also use the machines actual
ticks per second, instead of the OPTIMAL_TICKS_PER_SECOND_RATE.
|
|
Also take the hostname string lock exclusively.
|
|
Userland/hostname: Now takes parameter to set the hostname
LibC/unistd: Added sethostname function
|
|
This is a special case that was previously not implemented.
The idea is that you can dispatch a signal to all other processes
the calling process has access to.
There was some minor refactoring to make the self signal logic
into a function so it could easily be easily re-used from do_killall.
|
|
Previously we just woke all waiters no matter how many were
requested. Fix this by implementing WaitQueue::wake_n(..).
|
|
Previously, when returning from a pthread's start_routine, we would
segfault. Now we instead implicitly call pthread_exit as specified in
the standard.
pthread_create now creates a thread running the new
pthread_create_helper, which properly manages the calling and exiting
of the start_routine supplied to pthread_create. To accomplish this,
the thread's stack initialization has been moved out of
sys$create_thread and into the userspace function create_thread.
|
|
The HTTP JSON API this relied on is no longer available via HTTP and
I would rather make the website work in Browser anyway. :^)
|
|
|
|
|
|
|
|
We can't assume there's always a parent custody -- when we open "/"
there isn't gonna be one!
Fixes #1858.
|
|
|
|
|
|
lookup() returns an Optional<String> which allows us to implement easy
default values using lookup(key).value_or(default_value);
|
|
The notable piece of code that remains to be converted is Ext2FS.
|
|
A Lock can now be held either in shared or exclusive mode. Multiple threads can
hold the same lock in shared mode at one time, but if any thread holds the lock
in exclusive mode, no other thread can hold it at the same time in either mode.
|
|
The next commit is going to make it bigger again by increasing the size of Lock,
so make use of bitfields to make sure FileDescription still fits into 64 bytes,
and so can still be allocated with the SlabAllocator.
|
|
This renders a spinning 3D cube and demonstrates the 3D math classes
from LibGfx.
|
|
|
|
Also make it non-virtual since nothing needs to override it.
|
|
If a hardware timer doesn't have a callback registered, it's now simply
represented by a null m_callback.
|
|
|
|
We don't need a wrapper Function object that just forwards the timer
callback to the scheduler tick function. It already has the same
signature, so we can just plug it in directly. :^)
Same with the clock updating function.
|
|
Instead of passing around indices into the m_hardware_timers vector,
just pass around a HardwareTimer* instead.
|
|
|
|
The IOAPIC manual states that "Interrupt Mask-R/W. When this bit is 1,
the interrupt signal is masked. Edge-sensitive interrupts signaled on
a masked interrupt pin are ignored." - Therefore we have to ensure that
we disable interrupts globally with cli(), but also to ensure that we
invoke enable_irq() before sending the hardware command that generates
an IRQ almost immediately.
|
|
First, before this change, specifying 'force_pio' in the kernel
commandline was meaningless because we nevertheless set the DMA flag to
be enabled.
Also, we had a problem in which we used IO::repeated_out16() in PIO
write method. This might work on buggy emulators, but I suspect that on
real hardware this code will fail.
The most difficult problem was to restore the PIO read operation.
Apparently, it seems that we can't use IO::repeated_in16() here because
it will read zeroed data. Currently we rely on a simple loop that
invokes IO::in16() to a buffer. Also, the interrupt handling stage in
the PIO read method is moved to be handled inside the loop of reading
the requested sectors.
|
|
POSIX says, "Conforming applications should not assume that the returned
contents of the symbolic link are null-terminated."
If we do include the null terminator into the returning string, Python
believes it to actually be a part of the returned name, and gets unhappy
about that later. This suggests other systems Python runs in don't include
it, so let's do that too.
Also, make our userspace support non-null-terminated realpath().
|
|
If we're dropping all groups, just clear the extra_gids and return.
|
|
|
|
Instead, use copy_from_user() or copy_to_user() which does additional
verification and will panic the kernel on attempted kernel access.
|
|
Output address validation should be done for the tracer's address space
and not the tracee's.
Also use copy_to_user() instead of copy_from_user(). The two are really
identical at the moment, but maybe we can add some assertions to make
sure we're doing what we think we're doing.
Thanks to Sergey for spotting these!
|
|
We currently only care about debug exceptions that are triggered
by the single-step execution mode.
The debug exception is translated to a SIGTRAP, which can be caught
and handled by the tracing thread.
|
|
Also mark all of the address validation functions [[nodiscard]] to turn
this kind of bug into a compile error in the future.
|
|
|
|
This memory range was set up using 2MB pages by the code in boot.S.
Because of that, the kernel image protection code didn't work, since it
assumed 4KB pages.
We now switch to 4KB pages during MemoryManager initialization. This
makes the kernel image protection code work correctly again. :^)
|
|
The DebugSession class wraps the usage of Ptrace.
It is intended to be used by cli & gui debugger programs.
Also, call objdump for disassemly
|
|
The syscall wrapper for ptrace needs to return the peeked value when
using PT_PEEK.
Because of this, the user has to check errno to detect an error in
PT_PEEK.
This commit changes the actual syscall's interface (only for PT_PEEK) to
allow the syscall wrapper to detect an error and change errno.
|
|
si_code, si_status where swapped
|
|
PT_SETTREGS sets the regsiters of the traced thread. It can only be
used when the tracee is stopped.
Also, refactor ptrace.
The implementation was getting long and cluttered the alraedy large
Process.cpp file.
This commit moves the bulk of the implementation to Kernel/Ptrace.cpp,
and factors out peek & poke to separate methods of the Process class.
|
|
This was a missing feature in the PT_TRACEME command.
This feature allows the tracer to interact with the tracee before the
tracee has started executing its program.
It will be useful for automatically inserting a breakpoint at a
debugged program's entry point.
|