Re: initial stack pointer setup (in head.S)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 4/10/07, h h <harsh512@xxxxxxxxx> wrote:
Hi,

I am trying to understand how does the stack pointer (for kernel itself) get
setup in head.S.  I am specifically looking at MIPS CPU.  Here's the code
fragment from arch/mips/kernel/head.S :
        PTR_LA          $28, init_thread_union
        PTR_ADDIU       sp, $28, _THREAD_SIZE - 32

The init_thread_union and init_task are statically defined structures
that represent the init task (PID=0). They are defined in
arch/mips/kernel/init_task.c. The thread_union structure represents
the (thread_info + kernel stack).

So the above code is first loading the address of thread_info of init
task into $28. Then it is adding THREAD_SIZE-32 (generaly 8192-32) to
arrive at the kernel stack pointer of init task.

        set_saved_sp    sp, t0, t1
        PTR_SUBU        sp, 4 * SZREG           # init stack pointer

Ummm ... I'm not sure about this jugglery.

Thanks,

Rajat

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux