mirage / mirage-crypto

Cryptographic primitives for OCaml, in OCaml (also used in MirageOS)
ISC License
77 stars 43 forks source link

Add support for Loongarch #190

Closed fangyaling closed 9 months ago

hannesm commented 10 months ago

any chance there's a CI system that can check these conditional code paths, to avoid regressions in the future?

fangyaling commented 9 months ago

It would be good if we could add something to the CI, but now the ocaml patch not merged, only built in local. Now the code in the patch is refer kernel module. The ref code link in kernel is https://lore.kernel.org/lkml/20220226110338.77547-20-chenhuacai@loongson.cn/ ` static __always_inline u64 __arch_get_hw_counter(s32 clock_mode, const struct vdso_data *vd) { unsigned int count;

__asm__ __volatile__(
"   rdtime.d %0, $zero\n"
: "=r" (count));

return count;

} `

fangyaling commented 9 months ago

@hannesm Thanks for your review. And We use __loongarch_lp64 and loongarch64 (no trailing ) for this case. The loongarch_lp64 is recommended.

hannesm commented 9 months ago

Thanks.