hwreport writes one folder to the first read-write FAT mount, or mounts the first USB stick that takes vfat itself and unmounts it afterwards: summary.txt (machine, firmware, CPU, memory, every PCI and USB device with its driver or "-- no driver"), dmesg.txt, lspci.txt in the shape of lspci -nnk -xxx, lsusb.txt, dmi.txt, memmap.txt, the ACPI tables as raw .dat files iasl -d reads, and copies of /proc. Serials, the UUID and the MSDM/SLIC tables (a Windows licence key) are left out. It reads /sys, which is new: sysfs at Linux's paths and in Linux's formats -- /sys/bus/pci/devices with uevent, config and resource, /sys/bus/usb/devices, /sys/firmware/acpi/tables, dmi/tables, memmap and efi, /sys/class/dmi/id. toybox's lspci and lsusb work unmodified against it. The USB core now keeps a table of attached devices for it. The machine's name comes from SMBIOS (kernel/dev/dmi.c). The UEFI loader hands over the entry point from the configuration table, the kernel falls back to the 0xF0000 scan, and the log gets Linux's "DMI:" line. Two bugs found on the way: - The loader handed over at most 40 memory-map entries, in firmware order. A laptop's UEFI map is 60-150 descriptors with RAM above 4 GB listed last, so that is what was dropped. The entries now have their own area at 0x31000 with room for 256, are sorted before merging, and the kernel's 32 usable regions keep the largest when there are more. - MemTotal and sysinfo's totalram were PHYSTOP, an address, which counts the PCI hole: a 6 GB machine reported 8. Now the usable RAM, summed. usb.ids moves to /usr/share/hwdata, where lsusb looks for it, and pci.ids joins it (`make pci-ids`, BSD-3-Clause like usb.ids). Checked under QEMU q35: the report written to a FAT32 stick, fsck.fat clean, DSDT.dat disassembled by iasl on the host, lspci -k and lsusb showing names, 6 GB of RAM seen as 6137 MB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
137 lines
2.5 KiB
ArmAsm
137 lines
2.5 KiB
ArmAsm
#include "syscall.h"
|
|
#include "traps.h"
|
|
|
|
#define SYSCALL(name) \
|
|
.global name; \
|
|
name: \
|
|
mov $SYS_ ## name, %rax; \
|
|
mov %rcx, %r10 ;\
|
|
syscall ;\
|
|
ret
|
|
|
|
SYSCALL(fork)
|
|
.global _xv6_exit
|
|
_xv6_exit:
|
|
mov $SYS_exit, %rax
|
|
mov %rcx, %r10
|
|
syscall
|
|
ret
|
|
SYSCALL(wait)
|
|
SYSCALL(pipe)
|
|
SYSCALL(read)
|
|
SYSCALL(write)
|
|
SYSCALL(close)
|
|
SYSCALL(kill)
|
|
/* The raw stub is execve: three arguments, the Linux shape. exec() is a C
|
|
wrapper in glue.c that passes a null environment, so the 2-argument callers
|
|
in cmd/ cannot leave %rdx holding whatever happened to be there. */
|
|
.global execve
|
|
execve:
|
|
mov $SYS_exec, %rax
|
|
mov %rcx, %r10
|
|
syscall
|
|
ret
|
|
SYSCALL(open)
|
|
SYSCALL(mknod)
|
|
SYSCALL(unlink)
|
|
SYSCALL(fstat)
|
|
SYSCALL(link)
|
|
SYSCALL(mkdir)
|
|
SYSCALL(chdir)
|
|
SYSCALL(dup)
|
|
SYSCALL(dup2)
|
|
SYSCALL(fcntl)
|
|
SYSCALL(getpid)
|
|
SYSCALL(sbrk)
|
|
SYSCALL(sleep)
|
|
SYSCALL(uptime)
|
|
SYSCALL(vga_sync)
|
|
SYSCALL(getmouse)
|
|
SYSCALL(lseek)
|
|
SYSCALL(reboot)
|
|
SYSCALL(shutdown)
|
|
SYSCALL(sigfillset)
|
|
SYSCALL(sigprocmask)
|
|
SYSCALL(sigwait)
|
|
SYSCALL(alarm)
|
|
SYSCALL(waitpid)
|
|
SYSCALL(poll)
|
|
SYSCALL(setsid)
|
|
SYSCALL(mmap)
|
|
SYSCALL(munmap)
|
|
SYSCALL(delete)
|
|
SYSCALL(show)
|
|
SYSCALL(showstat)
|
|
SYSCALL(ftruncate)
|
|
SYSCALL(truncate)
|
|
SYSCALL(rename)
|
|
SYSCALL(symlink)
|
|
SYSCALL(readlink)
|
|
SYSCALL(getuid)
|
|
SYSCALL(geteuid)
|
|
SYSCALL(nanosleep)
|
|
SYSCALL(mprotect)
|
|
SYSCALL(ioctl)
|
|
SYSCALL(getcwd)
|
|
SYSCALL(arch_prctl)
|
|
SYSCALL(set_tid_address)
|
|
SYSCALL(set_robust_list)
|
|
SYSCALL(futex)
|
|
SYSCALL(clone)
|
|
SYSCALL(exit_group)
|
|
SYSCALL(wait4)
|
|
SYSCALL(getgid)
|
|
SYSCALL(getegid)
|
|
SYSCALL(umask)
|
|
SYSCALL(writev)
|
|
SYSCALL(readv)
|
|
SYSCALL(brk)
|
|
SYSCALL(prlimit)
|
|
SYSCALL(stat)
|
|
SYSCALL(lstat)
|
|
SYSCALL(access)
|
|
SYSCALL(openat)
|
|
SYSCALL(fchdir)
|
|
SYSCALL(enable_linux_abi)
|
|
SYSCALL(getrlimit)
|
|
SYSCALL(setuid)
|
|
SYSCALL(setgid)
|
|
SYSCALL(getsid)
|
|
SYSCALL(dup3)
|
|
SYSCALL(pipe2)
|
|
SYSCALL(clock_gettime)
|
|
SYSCALL(getppid)
|
|
SYSCALL(rt_sigaction)
|
|
SYSCALL(rt_sigsuspend)
|
|
SYSCALL(memfd_create)
|
|
SYSCALL(shmget)
|
|
SYSCALL(shmat)
|
|
SYSCALL(shmdt)
|
|
SYSCALL(socket)
|
|
SYSCALL(bind)
|
|
SYSCALL(listen)
|
|
SYSCALL(accept)
|
|
SYSCALL(accept4)
|
|
SYSCALL(connect)
|
|
SYSCALL(sendto)
|
|
SYSCALL(recvfrom)
|
|
SYSCALL(sockshutdown)
|
|
SYSCALL(socketpair)
|
|
SYSCALL(setsockopt)
|
|
SYSCALL(getsockopt)
|
|
SYSCALL(sendmsg)
|
|
SYSCALL(recvmsg)
|
|
SYSCALL(mount)
|
|
SYSCALL(umount2)
|
|
SYSCALL(sync)
|
|
SYSCALL(fsync)
|
|
SYSCALL(getdents64)
|
|
|
|
// Attributes and the index over them (SchFS phase 5). setxattr/getxattr/
|
|
// removexattr are Linux's; schfs_index and schfs_query are native, because
|
|
// asking a filesystem a question has no Linux equivalent.
|
|
SYSCALL(setxattr)
|
|
SYSCALL(getxattr)
|
|
SYSCALL(removexattr)
|
|
SYSCALL(schfs_index)
|
|
SYSCALL(schfs_query)
|