| #
3ae18fdf
|
| 11-Mar-2024 |
Warner Losh <imp@FreeBSD.org> |
kboot: Create function for error checking.
Linux has the convention of returning -ERRNO to flag errors from its system calls. Sometimes other negative values are returned that are success... Howeve
kboot: Create function for error checking.
Linux has the convention of returning -ERRNO to flag errors from its system calls. Sometimes other negative values are returned that are success... However, only values -1 to -4096 (inclusive) are really errors. The rest are either truncated values that only look negative (so use long instead of int), or are things like addresses or legal unsigned file offsets or similar that are successful returns. Filter out the latter.
Sponsored by: Netflix
show more ...
|
| #
2b7918f1
|
| 28-Jan-2024 |
Warner Losh <imp@FreeBSD.org> |
kboot: Assert copyright here
According to git blame I've 95%+ rewritten this file. Update copyright to reflect that, but give nod to Nathan for the original I started with.
Sponsored by: Netflix
|
| #
2e3f4988
|
| 28-Jan-2024 |
Warner Losh <imp@FreeBSD.org> |
kboot: Move system calls to libkboot
Sponsored by: Netflix
|
| #
091c255b
|
| 28-Jan-2024 |
Warner Losh <imp@FreeBSD.org> |
kboot: Move to kboot/kboot
In anticipation of separating the library elements from the kboot prorgam elements, move kboot down a level into a subdirectory. There will be libkboot and include directo
kboot: Move to kboot/kboot
In anticipation of separating the library elements from the kboot prorgam elements, move kboot down a level into a subdirectory. There will be libkboot and include directories in subsequent commits, mirroring other subsystems like i386 and efi.
Sponsored by: Netflix
show more ...
|
| #
b3e76948
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
| #
83eabc64
|
| 01-May-2023 |
Warner Losh <imp@FreeBSD.org> |
kboot: Add HOST_MAP_FAILED define
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D39790
|
| #
63c7a483
|
| 02-Feb-2023 |
Warner Losh <imp@FreeBSD.org> |
kboot: Assert errno is negative
When converting from a Linux error to a FreeBSD errno, assert that the value passed in is negative, as is Linux's custom.
Suggested by: brooks Sponsored by: Netfli
kboot: Assert errno is negative
When converting from a Linux error to a FreeBSD errno, assert that the value passed in is negative, as is Linux's custom.
Suggested by: brooks Sponsored by: Netflix Reviewed by: tsoome, brooks Differential Revision: https://reviews.freebsd.org/D38357
show more ...
|
| #
2e1edd04
|
| 02-Feb-2023 |
Warner Losh <imp@FreeBSD.org> |
kboot: For hostfs, return better errors from read, where possible.
Translate the Linux error return from read to a FreeBSD errno. We use a simplified translation: 1-34 are the same between the syste
kboot: For hostfs, return better errors from read, where possible.
Translate the Linux error return from read to a FreeBSD errno. We use a simplified translation: 1-34 are the same between the systems, so any of those will be returned directly. All other errno map to EINVAL. This will suffice for some code that reads /dev/mem in producing the right diagnostic.
A fully generalized version is much harder. Linux has a number of errno that don't translate well and has architecture dependent encodings. Avoid this mess with a simple macro for now. Add comment explaining why we use the simple method we do.
Sponsored by: Netflix Reviewed by: kevans, andrew Differential Revision: https://reviews.freebsd.org/D38265
show more ...
|
| #
2f5f17b8
|
| 07-Jan-2023 |
Warner Losh <imp@FreeBSD.org> |
stand: Add macros for file types from stat
Add the familiar macros for file types for stat's st_mode member. Prepend HOST_ to the start of these. Make sure all the values match the linux nolibc and
stand: Add macros for file types from stat
Add the familiar macros for file types for stat's st_mode member. Prepend HOST_ to the start of these. Make sure all the values match the linux nolibc and uapi headers. These values are the same as native values since they appear to be required by POSIX. Define anyway to allow the reader of the code to know that they are in the 'host (eg Linux)' namespace rather than the 'loader' namespace.
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37967
show more ...
|
| #
929c6216
|
| 04-Dec-2022 |
Warner Losh <imp@FreeBSD.org> |
stand: aarch64 has different nlinks than amd64
Some typedefs are system dependent, so move them into stat_arch.h where they are used. On amd64, nlinks is a int64_t, while on aarch64 it's an int (or
stand: aarch64 has different nlinks than amd64
Some typedefs are system dependent, so move them into stat_arch.h where they are used. On amd64, nlinks is a int64_t, while on aarch64 it's an int (or int32_t).
Sponsored by: Netflix
show more ...
|
| #
54e6e0de
|
| 26-Jul-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Implement host_ioctl
Sponsored by: Netflix
|
| #
f56d7a73
|
| 28-Jul-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Add host_exit and use it to implement exit()
Clients of libsa are expected to implement exit(). The current exit just loops forever. It is better to really exit: when running as init that wil
kboot: Add host_exit and use it to implement exit()
Clients of libsa are expected to implement exit(). The current exit just loops forever. It is better to really exit: when running as init that will reboot the system. When not running as init, other programs can recover (not that we support running as init, but when we do in the future, this is still the rigtht thing).
Sponsored by: Netflix
show more ...
|
| #
3a1b966a
|
| 28-Jul-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Convert from getdents to getdents64
Linux 2.4 introduced getdents64. Switch to using it because aarch64 doesn't have getdents as that syscall was obsoleted before that port was created.
Spon
kboot: Convert from getdents to getdents64
Linux 2.4 introduced getdents64. Switch to using it because aarch64 doesn't have getdents as that syscall was obsoleted before that port was created.
Sponsored by: Netflix
show more ...
|
| #
01c58e7e
|
| 28-Jun-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Pull in constants from Linux's mmap.h api
Define the usual #defines for mmap(2) (with HOST_ prepended) and use them instead of hard coding constants.
Sponsored by: Netflix
|
| #
ffb0d016
|
| 28-Jun-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Refinements to host_kexec_load
Move kexec_segments to host_syscall.h and pre-pend host_ to it. Correct args to host_exec_load.
Sponsored by: Netflix
|
| #
8fa9263f
|
| 28-Jun-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Use #defines for magic reboot constants
Sponsored by: Netflix
|
| #
8138a766
|
| 30-Jun-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Implement mount(2)
Create a wrapper for the mount system call. To ensure a sane early boot environment and to gather data we need for kexec, we may need to mount some special filesystems.
Sp
kboot: Implement mount(2)
Create a wrapper for the mount system call. To ensure a sane early boot environment and to gather data we need for kexec, we may need to mount some special filesystems.
Sponsored by: Netflix
show more ...
|
| #
a99d47bc
|
| 30-Jun-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Implement mkdir(2)
mkdir() may be needed early in boot to create missing directories. Provide a syscall wrapper for it.
Sponsored by: Netflix
|
| #
bc84de74
|
| 30-Jun-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Implement dup(2)
Early in boot, we need to create the normal stdin/out/err env for the boot loader to run in. To do that, we need to open the console and duplicate the file descriptors which
kboot: Implement dup(2)
Early in boot, we need to create the normal stdin/out/err env for the boot loader to run in. To do that, we need to open the console and duplicate the file descriptors which requires dup(2). Implement a wrapper as host_dup.
Sponsored by: Netflix
show more ...
|
| #
a4ed0eb1
|
| 30-Jun-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Implement symlink(2)
Linux's /dev/fd is implemented inside of /proc/self/fd, so we may need to create a symlink to it early in boot. "/dev/fd" and "/dev/std*" might not be strictly required f
kboot: Implement symlink(2)
Linux's /dev/fd is implemented inside of /proc/self/fd, so we may need to create a symlink to it early in boot. "/dev/fd" and "/dev/std*" might not be strictly required for the boot loader, but should be present for maximum flexibility.
Sponsored by: Netflix
show more ...
|
| #
76478029
|
| 30-Jun-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Implement getpid(2)
Add host_getpid() so we can know if we're running as init(8) or not. If we are, we may chose to do early system setup / sanity operations.
Sponsored by: Netflix
|
| #
76949f50
|
| 27-Jun-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Implement munmap(2)
Define host_munmap so we can use it in the x86 code to find things for the BIOS/CMS boot path and unmap after we find it.
Sponsored by: Netflix
|
| #
a647d4a4
|
| 15-Jul-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Implement stat(2) and fstat(2) system calls
Implement stat(2) and fstat(2) in terms of newfstatat and newfstat system calls respectively (assume we have a compat #define when there's no newfs
kboot: Implement stat(2) and fstat(2) system calls
Implement stat(2) and fstat(2) in terms of newfstatat and newfstat system calls respectively (assume we have a compat #define when there's no newfstat and just a regular fstat and do so for ppc).
Snag struct kstat (the Linux kernel stat(2), et al interface) from musl and attribute properly.
Sponsored by: Netflix
show more ...
|
| #
ae366d51
|
| 01-Jul-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Add HOST_O_ constants for open, etc
Add the common O_ constants for the open, fcntl, etc system calls. They are different than FreeBSD's. While they can differ based on architecture, they are
kboot: Add HOST_O_ constants for open, etc
Add the common O_ constants for the open, fcntl, etc system calls. They are different than FreeBSD's. While they can differ based on architecture, they are constant for architectures we care about, and those architectures use the 'generic' version so future architectures will also work.
Sponsored by: Netflix
show more ...
|
| #
edc23ddf
|
| 07-Jul-2022 |
Warner Losh <imp@FreeBSD.org> |
kboot: Reimplement older system calls in terms of newer ones
aarch64 doesn't have open, just openat, etc. Cope.
Sponsored by: Netflix
|