From: Hau Hsu <hau.hsu@sifive.com>
To: Newlib <newlib@sourceware.org>
Cc: Kito Cheng <kito.cheng@gmail.com>
Subject: Re: [PATCH] RISC-V: Initialize the jvt CSR
Date: Wed, 27 Sep 2023 09:17:53 +0800 [thread overview]
Message-ID: <716D0EAD-E213-47E3-BD46-72987C27450B@sifive.com> (raw)
In-Reply-To: <CA+yXCZD1vmPSr-GTixoAuCmODLtg0i2=obt7EU7zjmqYJFGQbg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]
We found a potential ISA conflict when compiling the crt0.S with zcd extension.
We already have a new patch under testing.
I'll send it after it is verified.
Best,
Hau Hsu
Software Engineer
hau.hsu@sifive.com
> Kito Cheng <kito.cheng@gmail.com> 於 2023年9月25日 下午2:17 寫道:
>
> LGTM
>
> Hau Hsu via Newlib <newlib@sourceware.org <mailto:newlib@sourceware.org>> 於 2023年9月25日 週一 06:37 寫道:
>> We set symbol '__jvt_base$' as weak. So if the symbol is not set in the
>> linker script, the address would be 0. We initialize jvt CSR only if
>> the address is not 0.
>>
>> psabi reference:
>> https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/2d770815dc9a8b11e61ea1abd487cb25ee56ad5e/riscv-elf.adoc#table-jump-relaxation
>> ---
>> libgloss/riscv/crt0.S | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/libgloss/riscv/crt0.S b/libgloss/riscv/crt0.S
>> index 7a4e4e32c..4744ba039 100644
>> --- a/libgloss/riscv/crt0.S
>> +++ b/libgloss/riscv/crt0.S
>> @@ -26,6 +26,16 @@ _start:
>> addi gp, gp, %pcrel_lo(1b)
>> .option pop
>>
>> + /* Initialize jvt CSR */
>> + .weak __jvt_base$
>> +.option push
>> +.option arch, +zcmt, +zicsr
>> + lla a0, __jvt_base$
>> + beqz a0, .Ljvt_init_end
>> + csrw jvt, a0
>> +.Ljvt_init_end:
>> +.option pop
>> +
>> # Clear the bss segment
>> la a0, __bss_start
>> la a2, _end
>> --
>> 2.42.0
>>
next prev parent reply other threads:[~2023-09-27 1:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 5:36 Hau Hsu
2023-09-25 6:17 ` Kito Cheng
2023-09-27 1:17 ` Hau Hsu [this message]
2023-09-29 2:26 ` Kito Cheng
2024-01-05 3:07 Hau Hsu
2024-01-05 6:49 ` Kito Cheng
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=716D0EAD-E213-47E3-BD46-72987C27450B@sifive.com \
--to=hau.hsu@sifive.com \
--cc=kito.cheng@gmail.com \
--cc=newlib@sourceware.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).