Kernel stack....
Hi,
1) I want to know what exactly is the structure
of kernel stack. Is it some thing like bss,data,text?
2) I want to access kernel stack(in kernel
mode). So I am using kernel stack pointer provided in thread_struct. So how to access different areas(.i.e data,text) in kernel stack.
Any pointers will be helpful.
Please mail me as I did't subscribe.
[email protected]
Thank you.
Raj.
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com
Quoted 7 lines · Raghava Raju
1) I want to know what exactly is the structure
of kernel stack. Is it some thing like bss,data,text?2) I want to access kernel stack(in kernel
mode). So I am using kernel stack pointer provided inthread_struct. So how to access differentareas(.i.e data,text)in kernel stack.
I think you got a wrong understanding of the stack. The stack has no separate bss, data, and text sections, it's just a stack of function arguments, local variables, and return addresses.
Accessing the stack works automatically: call a function, and the function paramaters and the return address are pushed on the stack. Unless you have a *very* good reason, there is no need to manipulate the stack directly in kernel mode.
Erik
PS: Please don't cross post between the kernelniewbes and linux-kernel
lists, use only one of them next time (kernelnewbies is good for this kind of questions).
Signature · 5 lines
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department of Electrical Engineering, Faculty of Information Technology and Systems, Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands Phone: +31-15-2783635 Fax: +31-15-2781843 Email: [email protected] WWW: http://www-ict.its.tudelft.nl/~erik/
Quoted 7 lines · Erik Mouw
I think you got a wrong understanding of the stack. The stack has no separate bss, data, and text sections, it's just a stack of function arguments, local variables, and return addresses.
Accessing the stack works automatically: call a function, and the function paramaters and the return address are pushed on the stack.
Yes but there is one stack per processor ? And what about its maximum size ? Is it dynamical ?
-Manu
Quoted 13 lines · Raghava Raju
Hi,
1) I want to know what exactly is the structure
of kernel stack. Is it some thing like bss,data,text?2) I want to access kernel stack(in kernel
mode). So I am using kernel stack pointer provided inthread_struct. So how to access differentareas(.i.e data,text)in kernel stack.
Quoted 7 lines
Any pointers will be helpful.
Please mail me as I did't subscribe.
[email protected]Thank you.
Raj.
I am assuming that you want to know how parameters loaded on the stack are passed to called procedures, i.e., the offset. I assume that you know that the kernel stack is just like a user stack and you don't actually manipulate it directly.
Given:
procedure(one, two, three);
where one, two, and three are values of any size up to the length of a register..
The called procedure gets the values as:
0x04(%esp) = one 0x08(%esp) = two 0x0c(%esp) = three
If, and only if, no registers are saved on the called procedure's stack. If some register(s) have been saved, the parameters are offset by the length of the register(s)...
proc: pushl %ebx
pushl %ecx pushl %edx pushl %edi # 4 * 4 = 0ffset 16 movl 0x14(%esp), %ebx # One movl 0x18(%esp), %ecx # Two movl 0x1c(%esp), %edx # Three
Cheers,
Dick Johnson
Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).
I was going to compile a list of innovations that could be attributed to Microsoft. Once I realized that Ctrl-Alt-Del was handled in the BIOS, I found that there aren't any.