summaryrefslogtreecommitdiff
path: root/kernel/cpu/isr.s
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-02-22 17:28:08 +0100
committerAnton Kling <anton@kling.gg>2024-02-22 17:28:55 +0100
commita18da25e7355979d0f26cfd39dc0032172e8b135 (patch)
tree2af66bedd0dff4bbccffc8d82cd06836d7f68e0d /kernel/cpu/isr.s
parent9b475d3db3275d4c34f02161ae70ced5595a0fdb (diff)
Kernel: Fix undefined behavior and cleanup functions.
The int_syscall caused crashes for higher level of optimizations. To fix this I rewrote the function in assembly as I deemed it to be simpler.
Diffstat (limited to 'kernel/cpu/isr.s')
-rw-r--r--kernel/cpu/isr.s16
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/cpu/isr.s b/kernel/cpu/isr.s
index 1bb2fff..8032485 100644
--- a/kernel/cpu/isr.s
+++ b/kernel/cpu/isr.s
@@ -270,12 +270,12 @@ ISR_NOERRCODE 254
ISR_NOERRCODE 255
isr_common_stub:
- pusha # Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
+ pusha # Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
- mov ax, ds # Lower 16-bits of eax = ds.
- push eax # save the data segment descriptor
+ mov ax, ds # Lower 16-bits of eax = ds.
+ push eax # save the data segment descriptor
- mov ax, 0x10 # load the kernel data segment descriptor
+ mov ax, 0x10 # load the kernel data segment descriptor
mov ds, ax
mov es, ax
mov fs, ax
@@ -285,13 +285,13 @@ isr_common_stub:
call int_handler
add esp, 4
- pop ebx # reload the original data segment descriptor
+ pop ebx # reload the original data segment descriptor
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
- popa # Pops edi,esi,ebp...
- add esp, 8 # Cleans up the pushed error code and pushed ISR number
+ popa # Pops edi,esi,ebp...
+ add esp, 8 # Cleans up the pushed error code and pushed ISR number
sti
- iret # pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP
+ iret # pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP