Li-Ta Lo ollie@lanl.gov writes:
On Tue, 2004-08-24 at 19:07, Eric W. Biederman wrote:
No quite I put the cpu_info structure at the bottom of the stack, and this function looks it up.
The same idea has been used in the kernel for quite a while.
Basically this allows me to preallocate some per cpu information and to pass that into cpu_initialize from another cpu.
The linux kernel has been doing something similar for quite a while.
Does cpu_info() return different value depends on which CPU it is running ?
Yes. The stack is per cpu and it returns a fixed address from the stack structure.
Are the data structures per CPU or shared between CPUs ?
per-cpu. Which is the point.
Eric
On Tue, 2004-11-02 at 18:06, Eric W. Biederman wrote:
Li-Ta Lo ollie@lanl.gov writes:
On Tue, 2004-08-24 at 19:07, Eric W. Biederman wrote:
No quite I put the cpu_info structure at the bottom of the stack, and this function looks it up.
The same idea has been used in the kernel for quite a while.
Basically this allows me to preallocate some per cpu information and to pass that into cpu_initialize from another cpu.
The linux kernel has been doing something similar for quite a while.
Does cpu_info() return different value depends on which CPU it is running ?
Yes. The stack is per cpu and it returns a fixed address from the stack structure.
Why you push the cpu index and struct cpu in c_start.S ? Is it parameter to the hardwaremain() ?
And why you save the %esp before init IDT and restore it ? I don't see it is modified when init IDT.
BTW, I think c_start.S is only executed on BSP, right ?
Ollie
/* Push the cpu index and struct cpu */ pushl $0 pushl $0
/* push the boot_complete flag */ pushl %ebp
/* Save the stack location */ movl %esp, %ebp
/* Initialize the Interrupt Descriptor table */ xxx xxx
/* Load the Interrupt descriptor table */ lidt idtarg
intel_chip_post_macro(0xfe) /* post fe */
/* Restore the stack location */ movl %ebp, %esp /* The boot_complete flag has already been pushed */ call hardwaremain /*NOTREACHED*/