<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 22, 2024 at 11:05 AM Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Jan 17, 2024 at 1:48 AM <<a href="mailto:tianye@sugon.com" target="_blank">tianye@sugon.com</a>> wrote:<br>
><br>
> From: Chengxiang Li <<a href="mailto:lichx2@sugon.com" target="_blank">lichx2@sugon.com</a>><br>
><br>
> avoid pclint err<br>
> ---<br>
> cpukit/score/cpu/aarch64/include/rtems/score/cpu.h | 2 +-<br>
> 1 file changed, 1 insertion(+), 1 deletion(-)<br>
><br>
> diff --git a/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h b/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h<br>
> index aa4f90f1a8..569b6bcee2 100644<br>
> --- a/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h<br>
> +++ b/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h<br>
> @@ -251,7 +251,7 @@ static inline void AArch64_interrupt_flash( uint64_t isr_cookie )<br>
><br>
> #define _CPU_ISR_Disable( _isr_cookie ) \<br>
> do { \<br>
> - _isr_cookie = AArch64_interrupt_disable(); \<br>
> + _isr_cookie = (ISR_Level)AArch64_interrupt_disable(); \<br>
<br>
This is down-casting a 64-bit value to a 32-bit value. I think my<br>
preference would be to check if the AArch64_interrupt_disable() should<br>
be returning a 32-bit value instead.<br>
<br>
CC: Kinsey<br></blockquote><div><br></div><div>Casting definitely isn't the right solution even though it would work as things are currently implemented. It's more likely that the ISR cookie should be 64-bit (for AArch64) instead since the cookie is generated from the DAIF register which is 64-bit with a large upper reserved space and currently-used bits only extending to bit 9.</div><div><br></div><div>ISR_Level is a globally defined type while _CPU_ISR_Disable/Enable use ISR cookies that are machine-dependent. It's likely that ISR_Level should instead be renamed ISR_Cookie and be defined by the CPU port. It looks like there's been some historical conflation of ISR cookies and ISR levels that needs to be resolved. At the very least, there needs to be clarification in cpukit.</div><div><br></div><div>The AArch64 CPU port was styled after ARM CPU port which also makes a distinction between the ISR enable/disable calls with their associated ISR cookie and the ISR_Get/Set_level calls that deal with a 0/1 level instead of the raw hardware values. This happens to not cause problems for the ARM CPU port because that hardware value is 32-bit.</div><div><br></div><div>Kinsey <br></div></div></div>