Prepare exit support

This commit is contained in:
Baptiste Wicht 2014-01-20 22:06:33 +01:00
parent 4d153ef2be
commit b6ea21b77c
3 changed files with 27 additions and 0 deletions

View File

@ -40,6 +40,10 @@ void system_call_entry(const interrupt::syscall_regs& regs){
sc_print_digit(regs);
break;
case 0x666:
//TODO Indicate to the scheduler that the process is over
break;
default:
k_print_line("Invalid system call");
break;

View File

@ -6,10 +6,13 @@
//=======================================================================
#include <print.hpp>
#include <system.hpp>
int main(){
print('Z');
print_line();
exit(0);
return 1;
}

View 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