git: 7429d6158ca9 - main - kboot: Initialize archsw at compile time
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 May 2025 15:33:31 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=7429d6158ca91195b30c807127b4758424887128
commit 7429d6158ca91195b30c807127b4758424887128
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-05-25 15:17:53 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-05-26 15:30:37 +0000
kboot: Initialize archsw at compile time
No need to initialize this at runtime. This trades .bss space + code in
.text for just .data and is net smaller.
Sponsored by: Netflix
---
stand/kboot/kboot/main.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/stand/kboot/kboot/main.c b/stand/kboot/kboot/main.c
index 5b7bfa246f55..668e5ac2706d 100644
--- a/stand/kboot/kboot/main.c
+++ b/stand/kboot/kboot/main.c
@@ -37,9 +37,6 @@
#include "stand.h"
#include <smbios.h>
-struct arch_switch archsw;
-extern void *_end;
-
int kboot_getdev(void **vdev, const char *devspec, const char **path);
ssize_t kboot_copyin(const void *src, vm_offset_t dest, const size_t len);
ssize_t kboot_copyout(vm_offset_t src, void *dest, const size_t len);
@@ -47,6 +44,16 @@ ssize_t kboot_readin(readin_handle_t fd, vm_offset_t dest, const size_t len);
int kboot_autoload(void);
static void kboot_zfs_probe(void);
+struct arch_switch archsw = {
+ .arch_getdev = kboot_getdev,
+ .arch_copyin = kboot_copyin,
+ .arch_copyout = kboot_copyout,
+ .arch_readin = kboot_readin,
+ .arch_autoload = kboot_autoload,
+ .arch_zfs_probe = kboot_zfs_probe,
+};
+extern void *_end;
+
extern int command_fdt_internal(int argc, char *argv[]);
/*
@@ -346,13 +353,6 @@ main(int argc, const char **argv)
const size_t heapsize = 64*1024*1024;
const char *bootdev;
- archsw.arch_getdev = kboot_getdev;
- archsw.arch_copyin = kboot_copyin;
- archsw.arch_copyout = kboot_copyout;
- archsw.arch_readin = kboot_readin;
- archsw.arch_autoload = kboot_autoload;
- archsw.arch_zfs_probe = kboot_zfs_probe;
-
/* Give us a sane world if we're running as init */
do_init();