* booting a new kernel from an already running kernel
@ 2002-09-03 14:37 Frederic Marmond
2002-09-03 18:00 ` Jani Monoses
0 siblings, 1 reply; 2+ messages in thread
From: Frederic Marmond @ 2002-09-03 14:37 UTC (permalink / raw)
To: linux-assembly
hi dear all...
I try to boot a kernel from an already running kernel.
I use 'monte'
(http://www.scyld.com/products/beowulf/software/monte.html), which was
designed for 2.2 kernels.
After adapting it to 2.4 (...), it do something...
of course, it is not what i wanted.
Some questions for ATT syntax guru:
a bit of C source code
__asm__ __volatile__
(/* Grab the args for our memcpy off the stack now while we still
* have page tables. */
" movl %0, %%ebx \n" /* Arg storage: memlist -> EBX */
" movl %1, %%edx \n" /* Arg storage: entry -> EDX */
" movl %2, %%ebp \n" /* Arg storage: flags -> EBP */
/* Turn off paging, leave protected mode turned on. */
" movl %%cr0, %%eax \n" /* Turn off paging (bit 31 in
CR0) */
" andl $0x7FFFFFFF, %%eax \n"
" movl %%eax, %%cr0 \n"
" xorl %%eax, %%eax \n" /* Flush the TLB (write 0 to
CR3) */
" movl %%eax, %%cr3 \n"
what I have in dessasemble (ldasm) for this function:
:00000763 8b5d08 mov ebx, ptr [ebp+8]
:00000766 8b550c mov edx, ptr [ebp]
:00000769 8b6d10 mov ebp, ptr [ebp+10]
:0000076c 0f20c0 mov eax, cr0
:0000076f 25ffffff7f and eax, 7fffffff
:00000774 0f22c0 mov cr0, eax
:00000777 31c0 xor eax, eax
:00000779 0f22d8 mov cr3, eax
My main question is:
what "movl %0,%%ebx" is supposed to do?
reading at ebp+8 ('local variables' + 8)?
Why %0, %1 and %2 are not compiled in the good order (like ebp+0x8,
ebp+0xc, and ebp+0x10 ?)
if any idea/known about the general problem (booting a kernel from a
running system, like $re-run bzImage-foo.bar).
thanks for futur answers.
Fred
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: booting a new kernel from an already running kernel
2002-09-03 14:37 booting a new kernel from an already running kernel Frederic Marmond
@ 2002-09-03 18:00 ` Jani Monoses
0 siblings, 0 replies; 2+ messages in thread
From: Jani Monoses @ 2002-09-03 18:00 UTC (permalink / raw)
To: fmarmond; +Cc: linux-assembly
look at the end of that __asm__ statement.
Some of the values after the semicolons are substituted for %0,%1,etc
So it is not pure assembly and some parts are filled in by gcc.
the order of the instructions you write is not guarranteed to be preserved
either.
info as or a look at www.linuxassembly.org should clarify this to you :)
> hi dear all...
>
> I try to boot a kernel from an already running kernel.
> I use 'monte'
> (http://www.scyld.com/products/beowulf/software/monte.html), which was
> designed for 2.2 kernels.
> After adapting it to 2.4 (...), it do something...
> of course, it is not what i wanted.
> Some questions for ATT syntax guru:
>
> a bit of C source code
> __asm__ __volatile__
> (/* Grab the args for our memcpy off the stack now while we still
> * have page tables. */
> " movl %0, %%ebx \n" /* Arg storage: memlist -> EBX */
> " movl %1, %%edx \n" /* Arg storage: entry -> EDX */
> " movl %2, %%ebp \n" /* Arg storage: flags -> EBP */
>
> /* Turn off paging, leave protected mode turned on. */
> " movl %%cr0, %%eax \n" /* Turn off paging (bit 31 in
> CR0) */
> " andl $0x7FFFFFFF, %%eax \n"
> " movl %%eax, %%cr0 \n"
> " xorl %%eax, %%eax \n" /* Flush the TLB (write 0 to
> CR3) */
> " movl %%eax, %%cr3 \n"
>
> what I have in dessasemble (ldasm) for this function:
>
> :00000763 8b5d08 mov ebx, ptr [ebp+8]
> :00000766 8b550c mov edx, ptr [ebp]
> :00000769 8b6d10 mov ebp, ptr [ebp+10]
> :0000076c 0f20c0 mov eax, cr0
> :0000076f 25ffffff7f and eax, 7fffffff
> :00000774 0f22c0 mov cr0, eax
> :00000777 31c0 xor eax, eax
> :00000779 0f22d8 mov cr3, eax
>
> My main question is:
> what "movl %0,%%ebx" is supposed to do?
> reading at ebp+8 ('local variables' + 8)?
> Why %0, %1 and %2 are not compiled in the good order (like ebp+0x8,
> ebp+0xc, and ebp+0x10 ?)
>
>
> if any idea/known about the general problem (booting a kernel from a
> running system, like $re-run bzImage-foo.bar).
>
> thanks for futur answers.
>
> Fred
>
>
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-09-03 18:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-03 14:37 booting a new kernel from an already running kernel Frederic Marmond
2002-09-03 18:00 ` Jani Monoses
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox