blob: 43955a0ddd5eb1a7162fc5214f12c45cf9a3d2fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
*@brief Provides implementations of syscalls needed by libc. The newlib
* documentation provides a list of the required syscalls:
* https://sourceware.org/newlib/libc.html#Syscalls and minimal implementations
* can be found in newlib's "nosys" library:
* https://sourceware.org/git/?p=newlib-cygwin.git;a=tree;f=libgloss/libnosys.
*/
#include "panic.h"
#include "software_panic.h"
#include "task.h"
#include "uart.h"
/**
* Reboot the system.
*
* This function is called from libc functions such as abort() or exit().
*
* @param rc exit code
*/
void _exit(int rc)
{
panic_printf("%s called with rc: %d\n", __func__, rc);
software_panic(PANIC_SW_EXIT, task_get_current());
}
/**
* Write to the UART.
*
* This function is called from libc functions such as printf().
*
* @param fd ignored
* @param buf buffer to write
* @param len number of bytes in @buf to write
* @return number of bytes successfully written
*/
int _write(int fd, char *buf, int len)
{
return uart_put(buf, len);
}
|