diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-10-17 01:00:27 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-10-17 01:00:27 +0200 |
| commit | 3983a157056f10651f120cf39c5d3637aa956903 (patch) | |
| tree | 5d956c9dfb4c625d975a2bc035fd32aa1950b84b /kernel/shell.c | |
| parent | 1580f8b4401b5f7e6ead12c94cafd42bb045ec6b (diff) | |
added simple syscall interface
Diffstat (limited to 'kernel/shell.c')
| -rw-r--r-- | kernel/shell.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/kernel/shell.c b/kernel/shell.c index b377ce0..2e00bd0 100644 --- a/kernel/shell.c +++ b/kernel/shell.c @@ -82,6 +82,42 @@ void shell_execute() { // uint8_t *read= flpydsk_read_sector (10); } + else if(1==strcmp(command,"SYSCALL",0)) + { + + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"system call 10"); + uint32_t ebx; // will hold return value; + // system call + asm("pusha"); + asm("mov $10,%eax"); // select syscall 10 (example_syscall) + asm("mov $666,%edx"); + asm("mov $333,%ecx"); + asm("int $0x80"); // actual syscall ! interrupt + asm("mov %%ebx, %0": "=b" (ebx)); + asm("popa"); + // + + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"system call returned %d",ebx); + + } + else if(1==strcmp(command,"TWO",0)) + { + + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"system call 20"); + uint32_t ebx; // will hold return value; + // system call + asm("pusha"); + asm("mov $20,%eax"); // select syscall2 20 (example_syscall) + asm("mov $566,%edx"); + asm("mov $233,%ecx"); + asm("int $0x80"); // actual syscall ! interrupt + asm("mov %%ebx, %0": "=b" (ebx)); + asm("popa"); + // + + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"system call returned %d",ebx); + + } else { log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"command unknown"); |
