修复进程终止的BUG
This commit is contained in:
parent
f4519da582
commit
a118bbec58
@ -32,4 +32,7 @@ int vsprintf(char *buf, const char *fmt, va_list args);
|
||||
int sprintf(char *buf, const char *fmt, ...);
|
||||
long int strtol(const char *str,char **endptr,int base);
|
||||
|
||||
void reset_kernel();
|
||||
void shutdown_kernel();
|
||||
|
||||
#endif //CRASHPOWEROS_COMMON_H
|
||||
|
@ -15,6 +15,16 @@ extern uint32_t end;
|
||||
extern int status;
|
||||
uint32_t placement_address = (uint32_t) & end;
|
||||
|
||||
void reset_kernel(){
|
||||
printf("Restart %s for x86...",OS_NAME);
|
||||
clock_sleep(10);
|
||||
outb(0x64,0xfe);
|
||||
}
|
||||
|
||||
void shutdown_kernel(){
|
||||
//TODO ACPI Driver
|
||||
}
|
||||
|
||||
void kernel_main(multiboot_t *multiboot) {
|
||||
io_cli();
|
||||
vga_install();
|
||||
|
@ -62,7 +62,7 @@ void print_proc(){
|
||||
printf("Name Pid Status [All Proc: %d]\n\n",index);
|
||||
}
|
||||
|
||||
static void found_task(int pid,struct task_struct *base,struct task_struct *argv){
|
||||
static void found_task(int pid,struct task_struct *head,struct task_struct *base,struct task_struct *argv,int first){
|
||||
struct task_struct *t = base;
|
||||
if(t == NULL){
|
||||
argv = NULL;
|
||||
@ -72,13 +72,18 @@ static void found_task(int pid,struct task_struct *base,struct task_struct *argv
|
||||
*argv = *t;
|
||||
return;
|
||||
} else{
|
||||
found_task(pid,t->next,argv);
|
||||
if(!first)
|
||||
if(head->pid == t->pid){
|
||||
argv = NULL;
|
||||
return;
|
||||
}
|
||||
found_task(pid,head,t->next,argv,0);
|
||||
}
|
||||
}
|
||||
|
||||
void task_kill(int pid){
|
||||
struct task_struct *argv;
|
||||
found_task(pid,running_proc_head,argv);
|
||||
found_task(pid,running_proc_head,running_proc_head,argv,1);
|
||||
if(argv == NULL){
|
||||
printf("Cannot found task Pid:[%d].\n",pid);
|
||||
return;
|
||||
|
@ -181,9 +181,7 @@ void cmd_del(int argc, char **argv) {
|
||||
}
|
||||
|
||||
void cmd_reset(){
|
||||
printf("Restart %s for x86...",OS_NAME);
|
||||
clock_sleep(10);
|
||||
outb(0x64,0xfe);
|
||||
reset_kernel();
|
||||
}
|
||||
|
||||
void setup_shell(){
|
||||
|
Loading…
Reference in New Issue
Block a user