diff --git a/src/boucane.cc b/src/boucane.cc index 888dced..78884ac 100644 --- a/src/boucane.cc +++ b/src/boucane.cc @@ -58,12 +58,14 @@ void configure_tss(){ void task1(){ while(1){ + asm("mov $0xABC, %rax"); asm("mov $1, %rdi;int $0x30"); } } void task2(){ while(1){ + asm("mov $0xAEBC, %rax"); asm("mov $2, %rdi;int $0x30"); } } diff --git a/src/core/int.S b/src/core/int.S index 2897698..c8612dc 100644 --- a/src/core/int.S +++ b/src/core/int.S @@ -26,6 +26,9 @@ push %rbp push %rsi push %rdi + mov %ds, %rax + push %rax + mov 56(%rsp), %rax # Restore %rax push %rax mov $0x10, %ax mov %ax, %ds @@ -33,6 +36,8 @@ .endm .macro RESTORE_REGS + pop %rax + mov %rax,%ds pop %rdi pop %rsi pop %rbp diff --git a/src/core/scheduler.cc b/src/core/scheduler.cc index 29f1f62..89c52d1 100644 --- a/src/core/scheduler.cc +++ b/src/core/scheduler.cc @@ -23,32 +23,28 @@ void schedule(){ // Save current task PROC *t=&procs[active_process]; - t->registers.rdi=stack[0]; - t->registers.rsi=stack[1]; - t->registers.rbp=stack[2]; - t->registers.rdx=stack[3]; - t->registers.rcx=stack[4]; - t->registers.rbx=stack[5]; - t->registers.rax=stack[6]; - t->registers.r15=stack[7]; - t->registers.r14=stack[8]; - t->registers.r13=stack[9]; - t->registers.r12=stack[10]; - t->registers.r11=stack[11]; - t->registers.r10=stack[12]; - t->registers.r9=stack[13]; - t->registers.r8=stack[14]; - t->registers.rip=stack[15]; - t->registers.cs=stack[16]; - t->registers.eflags=stack[17]; - t->registers.rsp=stack[18]; - t->registers.ss=stack[19]; - if (t->registers.cs!=0x8) - t->registers.ds=0x23; - else - t->registers.ds=0x10; + t->registers.ds=stack[0]; + t->registers.rdi=stack[1]; + t->registers.rsi=stack[2]; + t->registers.rbp=stack[3]; + t->registers.rdx=stack[4]; + t->registers.rcx=stack[5]; + t->registers.rbx=stack[6]; + t->registers.rax=stack[7]; + t->registers.r15=stack[8]; + t->registers.r14=stack[9]; + t->registers.r13=stack[10]; + t->registers.r12=stack[11]; + t->registers.r11=stack[12]; + t->registers.r10=stack[13]; + t->registers.r9=stack[14]; + t->registers.r8=stack[15]; + t->registers.rip=stack[16]; + t->registers.cs=stack[17]; + t->registers.eflags=stack[18]; + t->registers.rsp=stack[19]; + t->registers.ss=stack[20]; - //printk("Old task %d cs:%x rsp:%x ds:%x\n ",active_process+1, t->registers.cs,t->registers.rsp,t->registers.ds); // Goto next task active_process++; if(active_process>=nproc)