]> git.corax.cc Git - corax/commitdiff
Keep a pointer to the kernel stack in struct task, instead of the entire stack
authorMatthias Kruk <m@m10k.eu>
Thu, 19 Sep 2019 10:34:19 +0000 (19:34 +0900)
committerMatthias Kruk <m@m10k.eu>
Thu, 19 Sep 2019 10:34:19 +0000 (19:34 +0900)
kernel/arch/task.S
kernel/include/arch.h

index 31d2f62486bd0bcdeeea8d8c5a748dcef5207aef..4cad1139b8de5f8953065112b09c12338f4cfe49 100644 (file)
@@ -49,12 +49,11 @@ task_prepare:
 
        /* store cr3 in task structure */
        movl    8(%esp), %eax
-       movl    %eax, 4(%edi)
+       movl    %eax, OFFSET_CR3(%edi)
 
        /* calculate stack start (since it grows down) */
-       movl    $CONFIG_KERNEL_STACK_SIZE, %ecx
-       movl    (%esp), %eax
-       leal    OFFSET_KSTACK(%eax, %ecx, 1), %eax
+       movl    OFFSET_KSTACK(%edi), %eax
+       addl    $CONFIG_KERNEL_STACK_SIZE, %eax
 
        /*
         * We will use _int_restore (the lower half of the interrupt handler)
@@ -130,9 +129,8 @@ task_prepare:
        movl    (%eax), %ecx
        movl    %ecx, 60(%eax)
 
-       /* put EAX into the task structure */
-       movl    4(%esp), %ecx
-       movl    %eax, OFFSET_ESP0(%ecx)
+       /* put EAX into the task structure - task pointer is still in EDI */
+       movl    %eax, OFFSET_ESP0(%edi)
 
        /* that should be it */
        ret
index 06f1932f9f93ccba61bae1eb6922c40b3f29a9d0..787cdf898f5aaa4d43eaf795c6c2c9aad0d27edb 100644 (file)
@@ -24,8 +24,7 @@
 struct task {
        u32_t t_sp;
        u32_t t_pgdir;
-
-       u8_t  t_kstack[CONFIG_KERNEL_STACK_SIZE];
+       void *t_kstack;
 } __attribute__((packed));
 
 int     cpu_get_id(void);