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

Re: [PATCH v1] xen/riscv: make calculation of stack address PC-relative


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 14 Mar 2023 17:14:39 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OkGa8rGejTBaq41zh7od/rRL5wk5hKeyevZMVuf3I70=; b=ElS122t1UhzOJ3/YNtSQhdym9LLLp+3IJox9NoWGXyrVgTxuu0INOPoDCzGC0pS7pACtw3rqYE4MFY9JKb2+92k9u2z4Nxcm+VVQdt9mksriHw6T7oD9PxnGB5x/j9c58KLu0yMJ749DtLnutSmciVb0t1RZLiRffN4EgEnlJkCnY/b6BqBTD8ljJkzz+5j6nQCSCHgXvNBvkxK1UafnYZMoRhy7Xe/9bzJOydnhvijFtpYePWrf9mD4bXaADhU+pWWYceA7TrmK0hC3feTUkg4qgpO1iwUMUvjU/A51J7Vs0ZW0ElhcfwfedwVftFZ9c4vJ/C5IxPdYq68paWhdug==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iqkUTKKW6gTNo73FeWZhV0X2IT64gmPzh8TIlKMh+okFJzTM0b0ZSmZ8d65al3cdA+nNRFU0jiSFSX/hNA+1kv9cUuLlKDoWR7PJh4K/OELI95S8ZryBWaA3f1hJVA/hURfJ4u72SfN6oRtF6D8Z5bTt2pt+hXDDCRbxpFVSEMVEkxp68sAQiq3RVOiqfVrKIhP12cGpy7dOgre7sCHs6ACG5tUt9a+2k4lpOeQJOQ12k4dOuwoQeehoWvckYDOxqFXVmXVLc0zH1I8SdVtnX+8a5mMt1i+t+CkvlurIw5570W57xcKkOhDbvhR8QFvmPbYL5Dmp/SWmvCBxfBcbPQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Gianluca Guida <gianluca@xxxxxxxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 14 Mar 2023 16:15:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.03.2023 17:00, Oleksii Kurochko wrote:
> The patch is needed to keep all addresses PC-relative.
> 
> Pseudoinstruction 'la' can be transformed to 'auipc/addi' or
> 'auipc/l{w|d}'. It depends on the .option directive: nopic and pic.
> 
> Right now, 'la' transforms to 'auipc/l{w|d}',

I'm afraid I cannot confirm this. Is it possible that your and my gas
are configured differently (i.e. can the default of nopic vs pic vary)?

> which in case of
> cpu0_boot_stack[] will lead to the usage of _GLOBAL_OFFSET_TABLE_
> where all addresses will be without counting that it might happen
> that linker address != load address.
> 
> To be sure that SP is loaded always PC-relative address
> 'la' should be changed to 'lla', which always transforms to
> 'auipc/addi'.

While I agree with the adjustment in principle, I'd like to raise the
question of the suitablity of such macro insns for purposes like the
one here. In principle I would assume it would be better if sp was
written only once, with the final value. That would then also remove
the dependency on a possibly differing default gas may be using.

Jan



 


Rackspace

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