kernel stack SMP questions

Andrea Arcangeli (arcangeli@mbox.queen.it)
Wed, 12 Aug 1998 16:13:08 +0200 (CEST)


This from arch/i386/kernel/smp.c

stack_start.esp = (void *) (1024 + PAGE_SIZE + (char *)idle);
^^^^ 0x400 instead of 0x1000

Is .esp the stack for the new CPU? Why not to start at (2*PAGE_SIZE +
(char *) idle) instead? Probably I am missing something of important ;-).

I also noticed that initialize_secondary change the esp field in the tss
structure of the current task structure.

Since I am changing the stack address in my per-IRQ patch, should I change
also the esp field in the thread_struct every time I switch the stack, to
do the theorical right thing?

__initfunc(void initialize_secondary(void))
{
struct thread_struct * p = &current->tss;
^^^^^^^^^^^^^

/*
* We don't actually need to load the full TSS,
* basically just the stack pointer and the eip.
*/
asm volatile("lldt %%ax": :"a" (p->ldt));
asm volatile("ltr %%ax": :"a" (p->tr));
asm volatile(
"movl %0,%%esp\n\t"
^^^^^^^^^^^^^^^^^^^
"jmp *%1"
:
:"r" (p->esp),"r" (p->eip));
^^^^^^
}

Andrea[s] Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html