Hello all, While building sculpt for virt riscv, I was getting undefined reference errors in app/gpt_write, Based on Norman's suggestions earlier, I updated the recipe for the jitterentopy API [1] that is used to assemble the content in depot/genodelabs/api/jitterentropy/<version>/ [1] genode/repos/libports/recipes/api/jitterentropy/content.mk
This helped me overcome the undefined reference errors, But now I am getting:
Library jitterentropy COMPILE jitterentropy-base-genode.o COMPILE jitterentropy-base.o genode/depot/genodelabs/api/jitterentropy/2023-02-24/src/lib/jitterentropy/spec/riscv/jitterentropy-base-genode-nstime.h: Assembler messages: genode/depot/genodelabs/api/jitterentropy/2023-02-24/src/lib/jitterentropy/spec/riscv/jitterentropy-base-genode-nstime.h:20: Error: unrecognized opcode `mrc p15,0,a5,c9,c13,0' make[7]: *** [genode/repos/base/mk/generic.mk:58: jitterentropy-base.o] Error 1 make[6]: *** [var/libdeps:112: jitterentropy.lib] Error 2 make[5]: *** [Makefile:336: gen_deps_and_build_targets] Error 2
This error seems be due the contents of the header file (That I had created):
repos/libports/src/lib/jitterentropy/spec/riscv/jitterentropy-base-genode-nstime.h
because jitterentropy was not enabled yet on riscv, I had to create this file myself. Contents of [2] that I had written:
#ifndef _JITTERENTROPY_RISCV_BASE_GENODE_NSTIME_H_ #define _JITTERENTROPY_RISCV_BASE_GENODE_NSTIME_H_ static inline void jent_get_nstime(__u64 *out) { uint32_t t; asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(t)); *out = t; } #endif
[2] *repos/libports/src/lib/**jitterentropy/spec/riscv/* jitterentropy-base-genode*-**nstime.h *
I tried to build it by looking at the header files corresponding to other architectures. I am not aware of opcode for riscv. Please guide me to write the correct code. what should be written in this header file for riscv.
Thanks and regards, Pranab Kumar Rout
As far as I can tell, this is because you're using the ARMv7 version of jitterentropy-base-genode-nstime.h, which uses inline assembly, which is unknown to the riscv compiler. Either you find a riscv implementation of that file or you have to write it on your own.
Cheers, Martin
On 27.02.23 13:55, Pranab Kumar Rout cs21m045 wrote:
Hello all, While building sculpt for virt riscv, I was getting undefined reference errors in app/gpt_write, Based on Norman's suggestions earlier, I updated the recipe for the jitterentopy API [1] that is used to assemble the content in depot/genodelabs/api/jitterentropy/<version>/ [1] genode/repos/libports/recipes/api/jitterentropy/content.mk http://content.mk
This helped me overcome the undefined reference errors, But now I am getting:
Library jitterentropy COMPILE jitterentropy-base-genode.o COMPILE jitterentropy-base.o genode/depot/genodelabs/api/jitterentropy/2023-02-24/src/lib/jitterentropy/spec/riscv/jitterentropy-base-genode-nstime.h: Assembler messages: genode/depot/genodelabs/api/jitterentropy/2023-02-24/src/lib/jitterentropy/spec/riscv/jitterentropy-base-genode-nstime.h:20: Error: unrecognized opcode `mrc p15,0,a5,c9,c13,0' make[7]: *** [genode/repos/base/mk/generic.mk:58 <http://generic.mk:58>: jitterentropy-base.o] Error 1 make[6]: *** [var/libdeps:112: jitterentropy.lib] Error 2 make[5]: *** [Makefile:336: gen_deps_and_build_targets] Error 2
This error seems be due the contents of the header file (That I had created):
repos/libports/src/lib/jitterentropy/spec/riscv/jitterentropy-base-genode-nstime.h
because jitterentropy was not enabled yet on riscv, I had to create this file myself. Contents of [2] that I had written:
#ifndef _JITTERENTROPY_RISCV_BASE_GENODE_NSTIME_H_ #define _JITTERENTROPY_RISCV_BASE_GENODE_NSTIME_H_ static inline void jent_get_nstime(__u64 *out) { uint32_t t; asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(t)); *out = t; } #endif
[2]* * *repos/libports/src/lib/**jitterentropy/spec/riscv/*jitterentropy-base-genode*-**nstime.h *
I tried to build it by looking at the header files corresponding to other architectures. I am not aware of opcode for riscv. Please guide me to write the correct code. what should be written in this header file for riscv.
Thanks and regards, Pranab Kumar Rout
Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users
I'm sorry, I didn't get the second part of your mail.
On 27.02.23 13:55, Pranab Kumar Rout cs21m045 wrote:
I tried to build it by looking at the header files corresponding to other architectures. I am not aware of opcode for riscv. Please guide me to write the correct code. what should be written in this header file for riscv.
The mechanics of the ARMv7 MRC can be found in the RM [1] by looking up "mrc p15, 0, <Rt>, c9, c13, 0". If I'd be in your situation I'd look for a similar semantic in the RISC-V manuals. The current RISC-V ISA used in Genode is referenced in [2].
[1] https://developer.arm.com/documentation/ddi0406/latest/ [2] https://genodians.org/ssumpf/2021-02-24-riscv
Hi, Thank you. I have understood. Previously I was getting a file not found error, so I had created a directory for riscv and copied ARMv7 version of jitterentropy-base-genode-nstime.h into it. and modified the required files so that the run script considers the riscv targets. 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.
Regards, Pranab
On Mon, Feb 27, 2023 at 7:10 PM Martin Stein martin.stein@genode-labs.com wrote:
I'm sorry, I didn't get the second part of your mail.
On 27.02.23 13:55, Pranab Kumar Rout cs21m045 wrote:
I tried to build it by looking at the header files corresponding to other architectures. I am not aware of opcode for riscv. Please guide me to write the correct code. what should be written in this header file for riscv.
The mechanics of the ARMv7 MRC can be found in the RM [1] by looking up "mrc p15, 0, <Rt>, c9, c13, 0". If I'd be in your situation I'd look for a similar semantic in the RISC-V manuals. The current RISC-V ISA used in Genode is referenced in [2].
[1] https://developer.arm.com/documentation/ddi0406/latest/ [2] https://genodians.org/ssumpf/2021-02-24-riscv
Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users
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
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@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@lists.genode.org https://lists.genode.org/listinfo/users