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

Re: [Xen-devel] [PATCH v2 33/35] xen/arm32: head: Rework and document launch()


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Julien Grall <Julien.Grall@xxxxxxx>
  • Date: Tue, 30 Jul 2019 21:34:42 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=arm.com;dmarc=pass action=none header.from=arm.com;dkim=pass header.d=arm.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SMJtQ+7CyHTxu2yhfGwZPwweSWHNclus0zKX7AYJnQ0=; b=b5xv3ix0CF8YNbkXlELDovaXWZRUI0Hfzv0uz0VSkUAnzIcRNfSfkbuUNMVeOSVuLHaN411n7rPHNxTKlD1gqilV7BIUXnAjfgBAeD/4941B9HhJSKwSULKzfc8JvMgDvVoNMV71ZpQhV665GBpIrF7wudpP0Ez7uR7Iik7QOResNncdRme66rKekIQ0EtqJSv+VMAJOXtNrCMrdHl0BQN0UDp9zk/O7ooSh4glzKMBZMPkVgXzeWVePyXxb5N9kAU3ZHkcg/cEwlM6aTg2/zGLvVrt8o0Nzsjskxmb4ey5N+3OGOx949H1M6WuUlKW/otvVeWzjg0gC/BYBo5KSpQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OqxlSZ8QbM6j0v+S/8KN+c2gEYPfLOiBmBTmLrVyShxHVfdV1vtofdUzPAr4h7lnVvHH5F+Bix7XBmKXfinuev9fytGEuCIGAUK2h2mgsnVYIxsbbpFRlKHXW44vP19NSuKvHFBQtWAFmRIyIkFQ7NbZs7l9UEt1wTG4E+R3jSASO0syhvTJBLviNvR4H1ysaT2ck5UCLE760UTE6teYtJFvQBwS1Vs9XQXI4GL6uaDraucVwscXZt4Euur/2tggdNjk8H1+4iyilcAG4g55fXiYfPK1gmuyB5N3y3Mv2c8osdFukHZaCt76vMIJC+2O2QimNMW66utvOjO2Zeg1Ew==
  • Authentication-results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; lists.xenproject.org; dmarc=temperror action=none header.from=arm.com;
  • Authentication-results-original: spf=none (sender IP is ) smtp.mailfrom=Julien.Grall@xxxxxxx;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, nd <nd@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 30 Jul 2019 21:35:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: True
  • Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Julien.Grall@xxxxxxx;
  • Thread-index: AQHVQNYgp8jJQ2XDfEWBljFzWr3G5abjt9gAgAADqwA=
  • Thread-topic: [PATCH v2 33/35] xen/arm32: head: Rework and document launch()


On 30/07/2019 22:21, Stefano Stabellini wrote:
> On Mon, 22 Jul 2019, Julien Grall wrote:
>> Boot CPU and secondary CPUs will use different entry point to C code. At
>> the moment, the decision on which entry to use is taken within launch().
>>
>> In order to avoid using conditional instruction and make the call
>> clearer, launch() is reworked to take in parameters the entry point and its
>> arguments.
>>
>> Lastly, document the behavior and the main registers usage within the
>> function.
>>
>> Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
>>
>> ---
>>      Changes in v2:
>>          - Patch added
>> ---
>>   xen/arch/arm/arm32/head.S | 34 ++++++++++++++++++++++++----------
>>   1 file changed, 24 insertions(+), 10 deletions(-)
>>
>> diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
>> index e0f8c2e0cb..6d55a2119a 100644
>> --- a/xen/arch/arm/arm32/head.S
>> +++ b/xen/arch/arm/arm32/head.S
>> @@ -170,6 +170,11 @@ primary_switched:
>>           /* Use a virtual address to access the UART. */
>>           mov_w r11, EARLY_UART_VIRTUAL_ADDRESS
>>   #endif
>> +        PRINT("- Ready -\r\n")
>> +        /* Setup the arguments for start_xen and jump to C world */
>> +        mov   r0, r10                /* r0 := Physical offset */
>> +        mov   r1, r8                 /* r1 := paddr(FDT) */
>> +        ldr   r2, =start_xen
>>           b     launch
>>   ENDPROC(start)
>>   
>> @@ -234,6 +239,9 @@ secondary_switched:
>>           /* Use a virtual address to access the UART. */
>>           mov_w r11, EARLY_UART_VIRTUAL_ADDRESS
>>   #endif
>> +        PRINT("- Ready -\r\n")
>> +        /* Jump to C world */
>> +        ldr   r2, =start_secondary
>>           b     launch
>>   ENDPROC(init_secondary)
>>   
>> @@ -578,19 +586,25 @@ setup_fixmap:
>>           mov   pc, lr
>>   ENDPROC(setup_fixmap)
>>   
>> +/*
>> + * Setup the initial stack and jump to the C world
>> + *
>> + * Inputs:
>> + *   r0 : Argument 0 of the C function to call
>> + *   r1 : Argument 1 of the C function to call
>> + *   r2 : C entry point
>> + *
>> + * Clobbers r3
>> + */
>>   launch:
>> -        PRINT("- Ready -\r\n")
>> -
>> -        ldr   r0, =init_data
>> -        add   r0, #INITINFO_stack    /* Find the boot-time stack */
>> -        ldr   sp, [r0]
>> +        ldr   r3, =init_data
>> +        add   r3, #INITINFO_stack    /* Find the boot-time stack */
>> +        ldr   sp, [r3]
>>           add   sp, #STACK_SIZE        /* (which grows down from the top). */
>>           sub   sp, #CPUINFO_sizeof    /* Make room for CPU save record */
>> -        teq   r12, #0
>> -        moveq r0, r10                /* Marshal args: - phys_offset */
>> -        moveq r1, r8                 /*               - DTB address */
>> -        beq   start_xen              /* and disappear into the land of C */
>> -        b     start_secondary        /* (to the appropriate entry point) */
>> +
>> +        /* Jump to C world */
>> +       bx    r2
> 
> Why bx?
The only two other possible instructions would be:
    1) blx r2: we don't need to save the return address
    2) mov pc, r2: The Arm Arm recommends to use bx/blx instead of this.

So bx seems the best fit. Any other suggestion?

Also, I would probably replace all the "mov pc, lr" I added with "bx lr".

Cheers,

-- 
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.