Bananymous
fe17958b9f
Kernel: Rename rsp->sp and rip->ip
...
This makes more sense if we support i386
2024-03-22 15:41:15 +02:00
Bananymous
42469b83fe
Kernel: kernel panic is now sent to all processors
2024-03-15 13:45:01 +02:00
Bananymous
e65bc040af
Kernel: Now all active processors are used in scheduling
...
When a timer reschedule happens, ipi is broadcasted too all
processors for them to perform a reschedule!
2024-03-09 23:53:50 +02:00
Bananymous
89ca4c8a8b
Kernel: Implement IPI broadcasting
2024-03-09 23:53:38 +02:00
Bananymous
55d2a64f54
Kernel: Map interrupt handlers for all processors
...
This doesn't mean that processors will actually handle the irqs
2024-03-09 23:50:57 +02:00
Bananymous
29fd682672
Kernel: Store current processor pointer in IA32_GS_BASE
...
This allows easier access to processors fields
2024-03-07 16:05:29 +02:00
Bananymous
76b0f80169
Kernel: Move IDT to Processor
2024-03-06 00:45:54 +02:00
Bananymous
9c36d7c338
BAN/Kernel: Rework assertion/panic system
...
BAN/Assert.h does not need any includes meaning it can be included
anywhere without problems.
2024-03-04 11:41:54 +02:00
Bananymous
dfe5a2d665
All: Cleanup all files
...
Add newline to end of files and remove whitespace from end of lines
2024-01-24 15:53:38 +02:00
Bananymous
b0ff2392a1
Kernel: Add some helpful debug prints
...
Log RIP when stack pointer is out of bounds.
Log all syscalls that return ENOTSUP
2024-01-03 02:08:01 +02:00
Bananymous
001e95f973
Kernel: Optimize sse saving/loading
...
Only save and load sse when new thread is trying to execute sse
instruction. There is no need to do that every time we enter kernel.
2024-01-03 02:06:49 +02:00
Bananymous
4307968182
All: Start work again on sse support
2023-12-28 19:14:42 +02:00
Bananymous
130a69bac6
Kernel: Fix stack OOB detection
...
I now check both interrupt and normal stack to detect OOB. Processes
are killed if they encouner stack over/under flow.
2023-10-30 12:17:08 +02:00
Bananymous
518fd3fad0
Kernel: Add 16 more irq handlers
...
IDT will now panic if trying to assing handler for non supported
irq.
2023-10-13 16:17:27 +03:00
Bananymous
27eb5af6f0
Kernel: Rework interrupt mechanism
...
All interruptrable classes now inherit from Interruptable which
has methdo handle_irq which is called on a interrupt.
2023-10-05 18:53:45 +03:00
Bananymous
245f58cc3a
Kernel: mmap regions are now demand paged
...
mmap will not actually take any memory unless you use the given
memory.
2023-09-28 21:07:14 +03:00
Bananymous
d7ecf94347
Kernel: Reboot will now always succeed
...
If acpi reset fails, we forcefully trigger a triple fault to restart
the system.
2023-09-28 13:53:03 +03:00
Bananymous
976114fde1
Kernel: Print more detailed output on ISR
2023-09-25 20:33:07 +03:00
Bananymous
7a7c5e433e
Kernel/LibC: add flag to enable/disable sse support
...
SSE support is very experimental and causes GP. I decided to make
SSE not default until I get to fixing it :)
2023-09-23 02:28:25 +03:00
Bananymous
7ec860a3d4
Kernel: Print stack trace on isr
2023-09-11 01:20:55 +03:00
Bananymous
0b8396b1a6
Kernel: IDT now sends EOI for every interrupt
...
EOI is sent before calling the interrupt handler. This should be fine
since all interrupts are processed with interrupts disabled
2023-08-09 09:57:02 +03:00
Bananymous
659adb89a6
Kernel: Start work on abstracting Timers
2023-08-04 10:29:42 +03:00
Bananymous
643e87a076
Kernel: Threads are deleted sooner and cleaner
...
We now delete threads when
1. it is marked as Terminated and is the current thread
2. it tries to start execution in Terminated state
This allows us to never have thread executing in Terminated state
2023-08-04 10:29:42 +03:00
Bananymous
a78a7ed156
Kernel: Cleanup returns from any kind on interrupts
2023-08-01 14:23:50 +03:00
Bananymous
b245a55ea0
Kernel: store/load sse/mmx/fpu state on isr/irq/syscall
...
I haven't tested this yet but should be fine. This will be optimized
to only save state from threads that are using it
2023-07-31 22:28:57 +03:00
Bananymous
c4f6c859c1
Kernel: Generally improve signals
2023-07-31 22:28:18 +03:00
Bananymous
de927b6b05
Kernel: Remove is_in_syscall from Thread
2023-07-30 14:49:51 +03:00
Bananymous
1d7795e22c
Kernel: Hardware exceptions now sends signals to userspace
2023-07-30 14:34:15 +03:00
Bananymous
9729e5a05b
Kernel: Change signal kernel API
...
return rsp and rip are now stored per thread
2023-07-23 18:33:10 +03:00
Bananymous
4086d7c3be
Kernel: rework the whole PageTable structure
...
We now have page table structure for kernel memory which is shared
between all processes.
2023-07-05 23:41:35 +03:00
Bananymous
9a7b2587af
Kernel: kmalloc has now somewhat dynamic storage
...
Allocations bigger than PAGE_SIZE and those not forced to be identity
mapped are now done on a GeneralAllocator. This allows us to use kmalloc
for big allocations; bigger than the fixed 1 MiB storage.
This is still a hack and the whole kmalloc will have to be rewritten at
some point, but for now this does the job :D
2023-06-18 23:27:00 +03:00
Bananymous
57e59d998f
Kernel: Add enum for ISR name to number
2023-06-18 23:24:27 +03:00
Bananymous
23543b15ca
Kernel: Rework syscall calling
...
I removed the intermediate function when calling syscalls. Now syscall
handler calls the current process automatically. Only exception is
sys_fork, since it needs a assembly trampoline for the new thread.
2023-06-12 14:16:48 +03:00
Bananymous
caca6dc701
Kernel: Exceptions will now enable interrupts before calling exit()
...
this allows scheduler verification on reschedule() not panic
2023-06-11 03:29:22 +03:00
Bananymous
4cdeb98897
Kernel: We now store the processes exit code
2023-06-10 17:31:56 +03:00
Bananymous
0907965dc5
Kernel: start work on higher half kernel
2023-05-30 08:00:17 +03:00
Bananymous
833642d405
Kernel: ISR will now crash userspace process instead of panicing kernel
2023-05-28 20:53:10 +03:00
Bananymous
92daa831d1
Kernel: ISRs now print pid and tid
2023-05-06 00:10:15 +03:00
Bananymous
fdb4eb6042
Kernel: Move kmalloc and MMU to Memory directory
2023-04-18 10:18:15 +03:00
Bananymous
c936aac777
Kernel: Optimize scheduler idling
...
Now after each interrupt we will ask the scheduler to reschedule
if the current thread is the idle thread. This allows semaphore
unblocking to be practically instant when there is only one thread
executing.
Now disk reading is back to ~3 MB/s for single threaded process
2023-04-03 01:51:05 +03:00
Bananymous
8b8e3cbbf0
Kernel/Userspace: Start initial work on userspace and syscalls
2023-03-13 15:32:46 +02:00
Bananymous
c9ea22f5e2
Kernel: IDT now confirms that it allocated succesfully
2023-02-22 21:48:40 +02:00
Bananymous
d9c05b7378
Kernel: rewrite the whole kmalloc (again)
...
Performance of the old kmalloc implementation was terrible.
We now use fixed-width linked list allocations for sizes <= 60 bytes.
This is much faster than variable size allocation.
We don't use bitmap scanning anymore since it was probably the slow
part. Instead we use headers that tell allocations size and aligment.
I removed the kmalloc_eternal, even though it was very fast, there is
not really any need for it, since the only place it was used in was IDT.
These changes allowed my psf (font) parsing to go from ~500 ms to ~20 ms.
(coming soon :D)
2023-02-22 16:32:50 +02:00
Bananymous
1bd8b0fe5c
Kernel: Sleep now actually sleeps and allows idling
2023-02-19 18:52:25 +02:00
Bananymous
9b8de5025a
All: rename every function from UpperCamelCase to snake_case
...
This was a mess since I didn't know which to use but now I decided
to go with snake_case :)
2023-02-01 21:05:44 +02:00
Bananymous
6dc22b7251
Kernel: Add actual register values to x86_64 kernel panic
...
Very hackish implementation, but we now get actual registers at the
time of the interrupt happening
2023-01-30 18:52:38 +02:00
Bananymous
589f338357
Kernel: Cleanup IDT register dump inline assembly
2023-01-26 02:57:14 +02:00
Bananymous
e87026f01d
Kernel: I have no idea what this commit does
...
I had committed a change in IDT but reverted it now.
This propably only adds a spurious interrupt detection to common cpp
interrupt handler?
2023-01-26 02:55:37 +02:00
Bananymous
b315fdc27f
Kernel: Finally managed to get 64-bit working
...
I had weird problems with interrupts but everything should work now
2023-01-25 19:19:28 +02:00