All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Daniel Kiper <dkiper@net-space.pl>
Cc: The development of GNU GRUB <grub-devel@gnu.org>,
	"rickchen36 \@ gmail . com" <rickchen36@gmail.com>,
	David Abdurachmanov <david.abdurachmanov@gmail.com>,
	"greentime \@ andestech . com" <greentime@andestech.com>,
	leif.lindholm@linaro.org, atish.patra@wdc.com,
	Michael Chang <mchang@suse.com>,
	Alistair Francis <Alistair.Francis@wdc.com>,
	Lukas Auer <lukas.auer@aisec.fraunhofer.de>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Bin Meng <bmeng.cn@gmail.com>
Subject: Re: [PATCH v3 07/10] RISC-V: Add awareness for RISC-V reloations
Date: Wed, 21 Nov 2018 17:08:09 +0100	[thread overview]
Message-ID: <mvmefbejtw6.fsf@suse.de> (raw)
In-Reply-To: <20181121155157.xe2kahpmvia45rbu@tomti.i.net-space.pl> (Daniel Kiper's message of "Wed, 21 Nov 2018 16:51:57 +0100")

On Nov 21 2018, Daniel Kiper <dkiper@net-space.pl> wrote:

>> +	case R_RISCV_BRANCH:
>> +	  {
>> +	    grub_uint32_t *abs_place = place;
>> +	    grub_ssize_t off = sym_addr - (grub_addr_t) place;
>> +	    grub_uint32_t imm12 = (off & 0x1000) << (31 - 12);
>> +	    grub_uint32_t imm11 = (off & 0x800) >> (11 - 7);
>> +	    grub_uint32_t imm10_5 = (off & 0x7e0) << (30 - 10);
>> +	    grub_uint32_t imm4_1 = (off & 0x1e) << (11 - 4);
>> +	    *abs_place = (*abs_place & 0x1fff07f)
>> +			 | imm12 | imm11 | imm10_5 | imm4_1;
>
> Could not we use some constants instead of numbers here?

These are just where the insn encoding puts the bits.

> If this does not make sense than please name the source of this numbers.

https://github.com/riscv/riscv-isa-manual/blob/master/release/riscv-spec-v2.2.pdf

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


  reply	other threads:[~2018-11-21 16:15 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14 17:27 [PATCH v3 00/10] Add RISC-V support Alexander Graf
2018-11-14 17:27 ` [PATCH v3 01/10] efi: Rename armxx to arch Alexander Graf
2018-11-18 11:41   ` Bin Meng
2018-11-14 17:27 ` [PATCH v3 02/10] PE: Add RISC-V definitions Alexander Graf
2018-11-18 11:41   ` Bin Meng
2018-11-14 17:27 ` [PATCH v3 03/10] elf.h: " Alexander Graf
2018-11-18 11:41   ` Bin Meng
2018-11-14 17:27 ` [PATCH v3 04/10] RISC-V: Add setjmp implementation Alexander Graf
2018-11-18 11:41   ` Bin Meng
2018-11-21 15:31   ` Daniel Kiper
2018-11-14 17:27 ` [PATCH v3 05/10] RISC-V: Add early startup code Alexander Graf
2018-11-18 11:41   ` Bin Meng
2018-11-14 17:27 ` [PATCH v3 06/10] RISC-V: Add Linux load logic Alexander Graf
2018-11-16 22:18   ` Alistair Francis
2018-11-21 15:43   ` Daniel Kiper
2018-11-14 17:27 ` [PATCH v3 07/10] RISC-V: Add awareness for RISC-V reloations Alexander Graf
2018-11-21 15:51   ` Daniel Kiper
2018-11-21 16:08     ` Andreas Schwab [this message]
2018-11-21 16:31       ` Daniel Kiper
2018-11-25 22:12     ` Alexander Graf
2018-11-14 17:27 ` [PATCH v3 08/10] RISC-V: Add auxiliary files Alexander Graf
2018-11-17 22:51   ` Auer, Lukas
2018-11-25 23:01     ` Alexander Graf
2018-11-26 22:39       ` Auer, Lukas
2018-11-21 16:02   ` Daniel Kiper
2018-11-25 22:21     ` Alexander Graf
2018-11-14 17:27 ` [PATCH v3 09/10] RISC-V: Add to build system Alexander Graf
2018-11-18 11:41   ` Bin Meng
2018-11-25 23:06     ` Alexander Graf
2018-11-26  1:08       ` Bin Meng
2018-11-21 16:09   ` Daniel Kiper
2018-11-21 16:26     ` Andreas Schwab
2018-11-21 16:34       ` Daniel Kiper
2018-11-21 16:54         ` Andreas Schwab
2018-11-21 16:56           ` Daniel Kiper
2018-11-14 17:27 ` [PATCH v3 10/10] fdt: Add device tree file type Alexander Graf
2018-11-16 22:07   ` Alistair Francis
2018-11-19 10:11   ` Andreas Schwab
2018-11-19 17:56     ` Leif Lindholm
2018-11-21 16:36       ` Daniel Kiper
2018-11-21 16:27   ` Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mvmefbejtw6.fsf@suse.de \
    --to=schwab@suse.de \
    --cc=Alistair.Francis@wdc.com \
    --cc=atish.patra@wdc.com \
    --cc=bmeng.cn@gmail.com \
    --cc=david.abdurachmanov@gmail.com \
    --cc=dkiper@net-space.pl \
    --cc=greentime@andestech.com \
    --cc=grub-devel@gnu.org \
    --cc=leif.lindholm@linaro.org \
    --cc=lukas.auer@aisec.fraunhofer.de \
    --cc=mchang@suse.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rickchen36@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.