1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-11-20 11:16:10 -05:00

Fix errors

This commit is contained in:
Braiden Vasco 2017-11-05 13:54:23 +00:00
parent 73ea1e22d5
commit adcb66761b
4 changed files with 10 additions and 9 deletions

View file

@ -20,10 +20,10 @@ interrupt_%2:
%macro INTERRUPT_COMMON 1
[EXTERN %1_handler]
%1_wrapper:
pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
pushad
mov ax, ds ; Lower 16-bits of eax = ds.
push eax ; save the data segment descriptor
push dword eax ; save the data segment descriptor
mov ax, GDT_KERNEL_DS_SELECTOR
mov ds, ax
@ -33,13 +33,14 @@ interrupt_%2:
call %1_handler
pop eax ; reload the original data segment descriptor
pop dword eax ; reload the original data segment descriptor
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
popa ; Pops edi,esi,ebp...
popad
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

View file

@ -4,8 +4,8 @@
struct IsrRegisters {
unsigned int ds; // Data segment selector
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax; // Pushed by pusha.
unsigned int int_no, err_code; // Interrupt number and error code (if applicable)
unsigned int eip, cs, eflags, useresp, ss; // Pushed by the processor automatically.
unsigned char int_no, err_code; // Interrupt number and error code (if applicable)
unsigned int ip, cs, flags, sp, ss; // Pushed by the processor automatically.
};
// Protected mode exteptions

View file

@ -3,7 +3,7 @@
void syscall_handler(struct IsrRegisters regs)
{
const unsigned int id = regs.eax;
const unsigned int id = regs.eax & 0xFFFF;
kprintf("syscall %u\n", id);
}

View file

@ -2,10 +2,10 @@ main:
mov eax, 0
int 0x80
mov eax, 3
mov eax, 512
int 0x80
mov eax, 134
mov eax, 35000
int 0x80
ret