Debian Codegraph @

payloads/libpayload/sample/arch_mock/hello_mocks.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <libpayload-config.h>
4 #include <arch/types.h>
5 #include <stddef.h>
6 #include <unistd.h>
7 #include <stdio.h>
8
9 /* Use libc version. calling exit() or abort() would cause infinite recursion */
10 __attribute__((noreturn))
11 void _exit(int);
12
13 __attribute__((noreturn))
14 void halt(void)
15 {
16 _exit(0);
17 }
18
19 #define TEST_SYMBOL(symbol, value) asm(".set " #symbol ", " #value "\n\t.globl " #symbol)
20
21 #define TEST_REGION(region, size) uint8_t _##region[size]; \
22 TEST_SYMBOL(_e##region, _##region + size); \
23 TEST_SYMBOL(_##region##_size, size)
24
25 TEST_REGION(heap, CONFIG_LP_HEAP_SIZE);
26
27 uint64_t timer_raw_value(void)
28 {
29 return 0;
30 }
31
32 uint64_t timer_hz(void)
33 {
34 return 0;
35 }
36
37 /* Not present in libpayload. Can be used to write to real stdout. */
38 ssize_t write(int fildes, const void *buf, size_t nbyte);
39
40 void console_write(const void *buffer, size_t count)
41 {
42 write(1, buffer, count);
43 }