mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-16 16:11:42 -04:00
Prepare exit support
This commit is contained in:
parent
4d153ef2be
commit
b6ea21b77c
@ -40,6 +40,10 @@ void system_call_entry(const interrupt::syscall_regs& regs){
|
|||||||
sc_print_digit(regs);
|
sc_print_digit(regs);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0x666:
|
||||||
|
//TODO Indicate to the scheduler that the process is over
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
k_print_line("Invalid system call");
|
k_print_line("Invalid system call");
|
||||||
break;
|
break;
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
#include <print.hpp>
|
#include <print.hpp>
|
||||||
|
#include <system.hpp>
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
print('Z');
|
print('Z');
|
||||||
print_line();
|
print_line();
|
||||||
|
|
||||||
|
|
||||||
|
exit(0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
20
userlib/include/system.hpp
Normal file
20
userlib/include/system.hpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
//=======================================================================
|
||||||
|
// Copyright Baptiste Wicht 2013-2014.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
#ifndef USER_SYSTEM_HPP
|
||||||
|
#define USER_SYSTEM_HPP
|
||||||
|
|
||||||
|
#include <types.hpp>
|
||||||
|
|
||||||
|
void exit(size_t return_code){
|
||||||
|
asm volatile("mov rax, 0x666; mov rbx, %0; int 50"
|
||||||
|
: //No outputs
|
||||||
|
: "r" (return_code)
|
||||||
|
: "rax", "rbx");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user