diff options
| author | Warner Losh <imp@FreeBSD.org> | 2022-06-27 23:49:21 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2022-07-15 18:00:50 +0000 |
| commit | 76949f503f008b28865bd0fd026a550a3cb48619 (patch) | |
| tree | dc5eba1193129c8a95326b73538a47bf474d94a3 | |
| parent | a647d4a4d15df856d590c39c19d3973ec2e18825 (diff) | |
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
| -rw-r--r-- | stand/kboot/arch/amd64/syscall_nr.h | 1 | ||||
| -rw-r--r-- | stand/kboot/arch/powerpc64/syscall_nr.h | 1 | ||||
| -rw-r--r-- | stand/kboot/host_syscall.h | 1 | ||||
| -rw-r--r-- | stand/kboot/host_syscalls.c | 6 |
4 files changed, 9 insertions, 0 deletions
diff --git a/stand/kboot/arch/amd64/syscall_nr.h b/stand/kboot/arch/amd64/syscall_nr.h index c22c80ea7cb9..7813eff92890 100644 --- a/stand/kboot/arch/amd64/syscall_nr.h +++ b/stand/kboot/arch/amd64/syscall_nr.h @@ -4,6 +4,7 @@ #define SYS_kexec_load 246 #define SYS_lseek 8 #define SYS_mmap 9 +#define SYS_munmap 11 #define SYS_newfstat 5 #define SYS_newfstatat 262 #define SYS_openat 257 diff --git a/stand/kboot/arch/powerpc64/syscall_nr.h b/stand/kboot/arch/powerpc64/syscall_nr.h index aa94e6a82bb7..9471fd48ceb2 100644 --- a/stand/kboot/arch/powerpc64/syscall_nr.h +++ b/stand/kboot/arch/powerpc64/syscall_nr.h @@ -5,6 +5,7 @@ #define SYS_kexec_load 268 #define SYS_llseek 140 #define SYS_mmap 90 +#define SYS_munmap 91 #define SYS_newfstat SYS_fstat #define SYS_newfstatat 291 #define SYS_openat 286 diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h index 6ff20f7ba393..8007f29feb9d 100644 --- a/stand/kboot/host_syscall.h +++ b/stand/kboot/host_syscall.h @@ -96,6 +96,7 @@ int host_gettimeofday(struct host_timeval *a, void *b); int host_kexec_load(uint32_t start, int nsegs, uint32_t segs, uint32_t flags); ssize_t host_llseek(int fd, int32_t offset_high, int32_t offset_lo, uint64_t *result, int whence); void *host_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off); +int host_munmap(void *addr, size_t len); int host_open(const char *path, int flags, int mode); ssize_t host_read(int fd, void *buf, size_t nbyte); int host_reboot(int, int, int, uintptr_t); diff --git a/stand/kboot/host_syscalls.c b/stand/kboot/host_syscalls.c index 9cc6c6cd873e..3cfccdc0c718 100644 --- a/stand/kboot/host_syscalls.c +++ b/stand/kboot/host_syscalls.c @@ -58,6 +58,12 @@ host_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off) } int +host_munmap(void *addr, size_t len) +{ + return host_syscall(SYS_munmap, (uintptr_t)addr, len); +} + +int host_open(const char *path, int flags, int mode) { return host_syscall(SYS_openat, HOST_AT_FDCWD, (uintptr_t)path, flags, mode); |
