jitterentropy base genode nstime.h for virt riscv
Pranab Kumar Rout cs21m045
cs21m045 at smail.iitm.ac.in
Wed Mar 1 07:21:52 CET 2023
Hi,
Thank you for the help. I have successfully written the function: *inline
void jent_get_nstime(__u64 *out)* for riscv also, and its working fine.
please have a look:
> #ifndef _JITTERENTROPY_RISCV_BASE_GENODE_NSTIME_H_
> #define _JITTERENTROPY_RISCV_BASE_GENODE_NSTIME_H_
> static inline void jent_get_nstime(__u64 *out)
> {
> uint64_t t;
> asm volatile ("rdtime %0" : "=r" (t));
> *out = t;
> }
> #endif
>
This code reads the current time in cycles from the real-time clock (RTC)
of the RISC-V processor and stores it in the t variable. The out pointer
argument is dereferenced and the value of t is stored at the location it
points to.
Thanks & regards,
Pranab
On Tue, Feb 28, 2023 at 4:29 PM Christian Helmuth <
christian.helmuth at genode-labs.com> wrote:
> Hello,
>
> On Tue, Feb 28, 2023 at 11:24:18 CET, Pranab Kumar Rout cs21m045 wrote:
> > Now, I need to write the hearder file
> (jitterentropy-base-genode-nstime.h)
> > for risc-v that would do the same work.
> > Can you please explain what this function ( *inline void
> > jent_get_nstime(__u64 *out)* ) actually do ? So that I can write it for
> > risc-v arch also.
>
> Please refer to the jitterentropy library documentation [1] for the
> specification of jent_get_nstime(). In general, the function shoud
> return a "high-resolution time stamp" with minimal overhead, for
> example a cycle counter like TSC on x86. Unfortunately, I don't know
> about any RISC-V feature that could be used for this specific purpose
> or if RISC-V in general provides sufficient CPU Execution Timing
> Jitter for the jitterentropy library.
>
> [1] http://www.chronox.de/jent.html
>
> Regards
> --
> Christian Helmuth
> Genode Labs
>
> https://www.genode-labs.com/ · https://genode.org/
> https://twitter.com/GenodeLabs · https://genodians.org/
>
> Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
> Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
>
> _______________________________________________
> Genode users mailing list
> users at lists.genode.org
> https://lists.genode.org/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genode.org/pipermail/users/attachments/20230301/373a20d9/attachment.htm>
More information about the users
mailing list