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

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to