This commit is contained in:
Baptiste Wicht 2014-03-08 17:30:58 +01:00
parent d2ee3b1c6d
commit cb75dc20e1
3 changed files with 8 additions and 24 deletions

View File

@ -24,6 +24,7 @@ void block_process(pid_t pid);
void unblock_process(pid_t pid); void unblock_process(pid_t pid);
void init(); void init();
void start() __attribute__((noreturn));
int64_t exec(const std::string& path, const std::vector<std::string>& params); int64_t exec(const std::string& path, const std::vector<std::string>& params);

View File

@ -94,11 +94,7 @@ void kernel_main(){
sysfs::set_constant_value("/sys/", "author", "Baptiste Wicht"); sysfs::set_constant_value("/sys/", "author", "Baptiste Wicht");
scheduler::init(); scheduler::init();
scheduler::start();
//Launch the shell
init_shell();
return;
} }
} }

View File

@ -549,19 +549,6 @@ void init_context(scheduler::process_t& process, const char* buffer, const std::
process.context = reinterpret_cast<interrupt::syscall_regs*>(scheduler::user_rsp - sizeof(interrupt::syscall_regs) - args_size); process.context = reinterpret_cast<interrupt::syscall_regs*>(scheduler::user_rsp - sizeof(interrupt::syscall_regs) - args_size);
} }
void start() __attribute__((noreturn));
void start(){
started = true;
for(auto& process : pcb){
if(process.state != scheduler::process_state::EMPTY){
k_printf("pid: %u ppid: %u\n", process.process.pid, process.process.ppid);
}
}
init_task_switch(current_pid);
}
} //end of anonymous namespace } //end of anonymous namespace
void scheduler::init(){ //Create the idle task void scheduler::init(){ //Create the idle task
@ -583,13 +570,13 @@ void scheduler::init(){ //Create the idle task
pcb[current_pid].state = scheduler::process_state::RUNNING; pcb[current_pid].state = scheduler::process_state::RUNNING;
} }
int64_t scheduler::exec(const std::string& file, const std::vector<std::string>& params){ void scheduler::start(){
//TODO Once shell removed, start will be called in init() started = true;
if(!started){
start(); init_task_switch(current_pid);
//Unreachable
} }
int64_t scheduler::exec(const std::string& file, const std::vector<std::string>& params){
std::string content; std::string content;
auto result = vfs::direct_read(file, content); auto result = vfs::direct_read(file, content);
if(result < 0){ if(result < 0){