zephyr/samples/userspace/syscall_perf/src/main.h
Nicolas Royer 86c5cf18db samples: userspace: syscall_perf
The goal of this sample application is to measure the performance loss
when a user thread has to go through a system call compared to a
supervisor thread that calls the function directly.

Signed-off-by: Nicolas Royer <nroyer@baylibre.com>
2020-11-09 15:37:11 -05:00

21 lines
315 B
C

/*
* Copyright (c) 2020 BayLibre, SAS
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef MAIN_H
#define MAIN_H
#include <kernel.h>
#define csr_read(csr) \
({ \
register unsigned long __v; \
__asm__ volatile ("csrr %0, " #csr \
: "=r" (__v)); \
__v; \
})
#endif /* MAIN_H */