Age | Commit message (Collapse) | Author |
|
The trap_handler() function is a very sensitive code path and thus
calling things like splraise(), splx(), etc is quite unsafe and also
somewhat not needed. This commit removes those calls from the
trap_handler() function.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Previously, if RBP becomes NULL (indicating that the END of the
callstack has been reached), we still had a chance of dereferencing a
NULL pointer when attempting to grab the next value for 'rip'. This
commit checks if RBP is NULL before we get the next instruction pointer
value.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Previously the logic for cpu_halt_others() would fall back to halting
the current processor. However this is not correct and we should instead
bail if there are no other processors to halt.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
This commit introduces several fallback methods for system reboots in
case once fails.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
The global spinlock is highly contentious and can be a great performance
bottleneck in SMP systems. Use of such mechanisms are discouraged.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
To prevent priority inversion by disabling task preemption upon spinlock
acquisition and reenabling upon release
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Introduce sched_preempt_set() which can be useful to implement priority
inheritance for preventing priority inversion
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Add a new 'preempt' field to cpu_info' to indicate if that specific processor is preemptable.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
The spinlock_try_acquire() function should *not* block as it is meant to
simply attempt to acquire the lock and return its status.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Most keyboards nowadays support extended scancodes which are multi-byte
packets prefixed with a 0xE0 byte to represent non-standard special
keys. This commit introduces the initial groundwork for supporting such
scancodes.
- i8042_drain() now takes a (nullable) pointer to a i8042 data buffer
which will hold bytes drained
- Made some timing adjustments between i8042 register reads in the
i8042_drain() function
- Removed nonessential and contentious locks which choked up input
performance
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
This commit moves all of the capslock logic from i8042_kb_getc() into
its own capslock_toggle() function.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Gives the shutdown command its own binary in /usr/bin/shutdown
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Gives the reboot command its own binary in /usr/bin/reboot
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Introduce a libc disk_query() to invoke the query operation of specific
disks via __disk_io()
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
This commit introduces the DISK_IO_QUERY opcode to the disk engine so
that a user application may query specific devices.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Introduce disk_query() implementation which allows information about a
specific disk to be retrieved.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
- Rename 'disk_meta' -> 'disk_root'
- Add 'disk_info' structure
- Add boot 'canary' value to 'disk_root'
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
The disk parameters allow data to be passed into the disk engine via its
interface. The data may be raw byte streams from the drive, or bytes to
be written to the drive. However not all the time is the data to be an
arbitrary stream of bytes and may contain structured data instead.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Move the common disk I/O routines out side of the _KERNEL guard so that
they are visible from both within the kernel as well as from the user
side.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
The NAME_MAX constant is typically used for filenames, do not rely on
this value and create our own.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
This commit implements the concept of virtual blocks which may be bigger
than the hardware block size (e.g., 512 bytes). The virtual block size
must be a multiple of the hardware blocksize. The system will panic if
this condition is not met.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
This commit improves the ahci_dump_identity() function by returning an
information structure rather than dumping it on the spot.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
The number of disks registered within the system should not exceed the
DISK_MAX limit. Log an error and bail if that happens.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
This commit implements a libc interface to the Hyra disk engine and
adds functions such as disk_read() and disk_write(). There is also a
mostly internal __disk_io() routine which is made to have external
linkage as it could potentially be useful for cases where fine grained
control over the engine is needed, though it is recommended to rely on
the other functions whenever possible.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
This commit introduces the initial disk engine sources. The Hyra disk
engine refers to the software layer that intercepts SYS_disk syscalls
and routes standard opcodes to internal disk routines.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
This commit introduces the initial Hyra disk management framework. The
goal of this framework is to provide a simplistic API for the management
of storage devices in a way that is more suitable for complex operations.
Upon detection and initialization of a block-based storage medium, the
driver may create a named disk object using the 'disk_add()' function.
Disks that have been registered with the system may be acquired via the
'disk_get_id()' function.
As of the current revision, each disk is given a monotonically incremental
ID for identification and lookups. A disk ID of zero indicates a primary disk
on the system.
Disks may be written to or read from using the 'disk_read()' and 'disk_write()'
functions. Memory buffers used for these operations must be created with the
'disk_buf_alloc()' function and freed with the 'disk_buf_free()' function.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
This commit seperates device registration logic from ahci_init_port()
into a seperates ahci_register() function to improve modularity and
clarity.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
This commit introduces the 'CPU_FEAT_TSCINV' feature bit to indicate
whether or not the CPU supports an invariant TSC.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
This commit adds the CPU_UMIP kconf(9) option to allow the user to
configure whether or not the kernel should enable the CR4.UMIP bit.
It is recommended to keep this to "yes" as user applications should
not be able to execute the SGDT, SIDT, SLDT, SMSW or STR instructions
at all for security reasons.
Signed-off-by: Ian Moffett <ian@osmora.org>
|
|
To prevent user programs from performing any operations related to
system memory structures (such as the GDT, TSS, etc), we will always set
CR4.UMIP if possible to improve the security of Hyra.
Signed-off-by: Ian Moffett <ian@osmora.org>
|