riscv-software-src / riscv-pk

RISC-V Proxy Kernel
Other
595 stars 308 forks source link

Calls to __clear_cache() require pointer arguments #239

Closed cmuellner closed 3 years ago

cmuellner commented 3 years ago

When compiling with a recent version of GCC, we run into the following error:

      ../pk/pk.c: In function 'run_loaded_program.constprop':
      ../pk/pk.c:177:3: error: both arguments to '__builtin___clear_cache'
      must be pointers
        177 |   __clear_cache(0, 0);
            |   ^~~~~~~~~~~~~~~~~~~

The error comes from the fact, that we pass numeric values as arguments to the invocation of __clear_cache.

Using (void*)0 or NULL instead of 0 does not work either.

My understanding of the code is, that we know that we can only clear the complete instruction cache and therefore we don't care about the arguments. Is this assumption correct?

This error has been introduced by the GCC commit c05ece9 in Dec 2020. I have created a GCC bug report (PR100316) as well.

cmuellner commented 3 years ago

Ping for @aswaterman as he is the author of the affected piece of code.

aswaterman commented 3 years ago

I think we can replace this one with an asm volatile fence.i. If you make such a PR, I’ll merge it.

cmuellner commented 3 years ago

The required code was already there. Just needed to be called. Thanks!

aswaterman commented 3 years ago

Resolved by #240.