<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-06-11 23:39 GMT+03:00 Hesham Almatary <span dir="ltr"><<a href="mailto:heshamelmatary@gmail.com" target="_blank">heshamelmatary@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Mon, Jun 12, 2017 at 6:01 AM, Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com" target="_blank">denisobrezkov@gmail.com</a>> wrote:<br>
> 2017-06-11 22:43 GMT+03:00 Hesham Almatary <<a href="mailto:heshamelmatary@gmail.com" target="_blank">heshamelmatary@gmail.com</a>>:<br>
>><br>
>> Hi Denis,<br>
>><br>
>><br>
>><br>
>> On Sun, Jun 11, 2017 at 11:52 PM, Denis Obrezkov<br>
>> <<a href="mailto:denisobrezkov@gmail.com" target="_blank">denisobrezkov@gmail.com</a>> wrote:<br>
>> > Hello Hesham,<br>
>> ><br>
>> > I found out that your code in interrupt handling routine is outdated -<br>
>> Which interrupt handling routine? The port doesn't handle interrupts.<br>
>> The only relevant code is enable/disable interrupts, but it doesn't<br>
>> matter at this stage that it's outdated (as we don't have interrupts).<br>
>><br>
>> > the format of mstatus and sstatus registers was changed.<br>
>> > I can produce some patches in a few days, though, I still don't<br>
>> > understand<br>
>> > how to deal with local and global interrupts.<br>
>> ><br>
>> Could you illustrate what do you mean by "global" and "local"<br>
>> interrupts? I still argue for a simple port that runs hello world, you<br>
>> don't need interrupts, so this shouldn't be a blocker for you.<br>
>><br>
>> > --<br>
>> > Regards, Denis Obrezkov<br>
>><br>
>><br>
>><br>
>> --<br>
>> Hesham<br>
><br>
> RISC-V has local and global interrupt sources: Privileged ISA 1.10, chapter<br>
> 7.2.<br>
><br>
</span>Thanks for the reference. After reading this part, global interrupts<br>
are mapped to external interrupts that are not part of RISC-V ISA.<br>
While local interrupts are per-hart and defined/controlled by RISC-V<br>
ISA using mstatus/mip/sip registers. For example, if you're going to<br>
implement interrupts-based UART driver (platform/BSP specific), you'll<br>
need global/external interrupts hence PLIC. On the other hand, when<br>
you implement timer driver, you'll use local interrupts (RISC-V/ISA<br>
specific).<br>
<div class="m_5682938775451277532HOEnZb"><div class="m_5682938775451277532h5"><br>
><br>
><br>
> --<br>
> Regards, Denis Obrezkov<br>
<br>
<br>
<br>
--<br>
Hesham<br></div></div></blockquote><div> </div></div></div><div class="gmail_extra"><div>Yes, thanks, I found the answer for my question - </div><div>when a PLIC interrupt occurs, it raises a global interrupt, which has the exception</div><div>code of eleven (E31-Coreplex Manual, 6.2). Thus, we should place our global</div><div>interrupts' handler with the offset of 0x2c.</div><div><br></div>-- <br><div class="m_5682938775451277532gmail_signature" data-smartmail="gmail_signature">Regards, Denis Obrezkov</div>
</div></div>