Re: setup code

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

 



Hi,

[ As nobody answered, let's have a try. ]

Le Wed, 3 May 2006 14:01:52 +0530,
"srinivas bakki" <srinivas.bakki@xxxxxxxxx> a écrit :

>       somebody please help me understanding the following code. since
> this code is referenced from setup.c how does the compiler put in
> the physical address of the machine descriptor in r5 ? also this
> address i dont understand why it is metioned as physical !!!

First of all, you should have asked a more precise question, for
example by telling us which file of the kernel you are copying below.
(I've finally found that it's in arch/arm/kernel/head-common.S).

I'm not an expert, but here's what happen:

arch/arm/kernel/setup.c::setup_machine() calls lookup_machine_type(),
defined in arch/arm/kernel/head-common.S.

This lookup_machine_type() is basically a wrapper around
__lookup_machine_type() that allows this function to be called from a C
function by respecting the ARM C calling conventions.

The lookup_machine_type() wrapper transfers the contents of r0 to r1,
because the argument "nr" passed by the code in setup.c is stored in
r0, but the __lookup_machine_type() function waits for the machine
architecture number in r1.

Then, the __lookup_machine_type() functions does its job (for which I
can't help, as I'm not an ARM expert). Its job is to find a pointer to
a certain structure, which is returned in r5. Once it has completed its
job, control returns in lookup_machine_type(), which transfers the
contents of r5 to r0. This is because r5 contains the actual result of
the function, but the ARM C calling convention says that the return
value must be stored in r0.

Here is how it works between C and assembly. Now, if your question is
how does __lookup_machine_type() work, then I suggest you to read some
ARM architecture manual.

Sincerly,

Thomas
-- 
PETAZZONI Thomas - thomas.petazzoni@xxxxxxxx 
http://{thomas,sos,kos}.enix.org - Jabber: thomas.petazzoni@xxxxxxxxx
http://{agenda,livret}dulibre.org - http://www.toulibre.org
Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E  1624 F653 CB30 98D3 F7A7

Attachment: signature.asc
Description: PGP signature


[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