-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
685d747
commit d8b6105
Showing
5 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "syscall.h" | ||
|
||
void sys_read(registers_t* r) { | ||
printf("Syscall read : eax == %d\n", r->eax); | ||
} | ||
|
||
void sys_write(registers_t* r) { | ||
printf("Syscall write: eax == %d\n", r->eax); | ||
} | ||
|
||
void sys_open(registers_t* r) { | ||
printf("Syscall open : eax == %d\n", r->eax); | ||
} | ||
|
||
void sys_close(registers_t* r) { | ||
printf("Syscall close: eax == %d\n", r->eax); | ||
} | ||
|
||
void sys_stat(registers_t* r) { | ||
printf("Syscall stat : eax == %d\n", r->eax); | ||
} | ||
|
||
isr_t syscall_tab[] = { | ||
sys_read, | ||
sys_write, | ||
sys_open, | ||
sys_close, | ||
sys_stat | ||
// Write all handlers here based on Linux system call table | ||
}; | ||
|
||
void syscall_callback(registers_t* r) { | ||
syscall_tab[r->eax](r); | ||
} | ||
|
||
void init_syscall() { | ||
register_interrupt_handler(SYSCALL_INTERRUPT_NUMBER, &syscall_callback); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef SYSCALL_H | ||
# define SYSCALL_H | ||
|
||
#include "../descriptor/descriptor.h" | ||
|
||
# define SYSCALL_INTERRUPT_NUMBER 0x80 | ||
void init_syscall(); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters