grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 07/10] RISC-V: Add awareness for RISC-V reloations


From: Andreas Schwab
Subject: Re: [PATCH v3 07/10] RISC-V: Add awareness for RISC-V reloations
Date: Wed, 21 Nov 2018 17:08:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.90 (gnu/linux)

On Nov 21 2018, Daniel Kiper <address@hidden> 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, address@hidden
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]