]> git.corax.cc Git - corax/commitdiff
Save/restore the EBP register used in kernel-space during task switches, otherwise...
authorMatthias Kruk <m@m10k.eu>
Tue, 1 Oct 2019 17:20:15 +0000 (02:20 +0900)
committerMatthias Kruk <m@m10k.eu>
Tue, 1 Oct 2019 17:20:15 +0000 (02:20 +0900)
kernel/arch/defs.h
kernel/arch/task.S
kernel/include/arch.h

index 6ec11a2afda5e5baa76f12bfff68f531b4983f22..43e71504f3ee27b03cbdeecd2a3a6bf1467656ed 100644 (file)
@@ -76,6 +76,7 @@
 #define OFFSET_TASK_KSTACK 8
 #define OFFSET_TASK_PRIVL  12
 #define OFFSET_TASK_STATE  16
+#define OFFSET_TASK_EBP0   20
 
 #define CPU_SIZE           (TSS_OFFSET + TSS_SIZE + 4)
 #define OFFSET_CPU_CTASK   (TSS_OFFSET + TSS_SIZE)
index 32e376b0a9896a42081059dc6ffa85b09fec356c..e09095f33c11ebbf8457db1a88766d8c0376a824 100644 (file)
@@ -162,6 +162,7 @@ task_prepare:
 
        /* put EAX into the task structure - task pointer is still in EDI */
        movl    %eax, OFFSET_TASK_ESP0(%edi)
+       movl    %eax, OFFSET_TASK_EBP0(%edi)
 
        /* that should be it */
        ret
@@ -221,6 +222,7 @@ task_switch:
        test    %esi, %esi
        jz              2f
        movl    %esp, OFFSET_TASK_ESP0(%esi)
+       movl    %ebp, OFFSET_TASK_EBP0(%esi)
 
        /*
         * Clear interrupts, since we won't have a valid stack until the
@@ -233,6 +235,7 @@ task_switch:
         * linear address while we're in the context of the kernel
         */
        movl    OFFSET_TASK_ESP0(%edi), %esp
+       movl    OFFSET_TASK_EBP0(%edi), %ebp
 
        /*
         * If this is a new task, we have to use _int_restore to return,
index fec57bb59de89cfa1fb3670597a3621f59a9aa16..260707d747617572015ba732f745aa7b5170671d 100644 (file)
@@ -35,6 +35,7 @@ struct task {
        void *t_kstack;
        u32_t t_privl;
        u32_t t_state;
+       u32_t t_bp;
 
        u32_t t_tslice;
        u32_t t_rslice;