Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/usermode Enhance the NetBSD/usermode thunk interface
details: https://anonhg.NetBSD.org/src/rev/8dca4ce93f46
branches: trunk
changeset: 319607:8dca4ce93f46
user: reinoud <reinoud%NetBSD.org@localhost>
date: Mon Jun 04 19:53:01 2018 +0000
description:
Enhance the NetBSD/usermode thunk interface
diffstat:
sys/arch/usermode/include/thunk.h | 7 ++++++-
sys/arch/usermode/usermode/thunk.c | 38 ++++++++++++++++++++++++++++++++++++--
2 files changed, 42 insertions(+), 3 deletions(-)
diffs (115 lines):
diff -r 0335e25eff37 -r 8dca4ce93f46 sys/arch/usermode/include/thunk.h
--- a/sys/arch/usermode/include/thunk.h Mon Jun 04 16:46:46 2018 +0000
+++ b/sys/arch/usermode/include/thunk.h Mon Jun 04 19:53:01 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.64 2018/06/01 08:04:57 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.65 2018/06/04 19:53:01 reinoud Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -92,6 +92,7 @@
int thunk_timer_start(timer_t, int);
int thunk_timer_getoverrun(timer_t);
+void thunk_kill(pid_t pid, int sig);
void thunk_exit(int);
void thunk_abort(void);
@@ -136,6 +137,8 @@
void thunk_sigaddset(sigset_t *sa_mask, int sig);
int thunk_sigprocmask(int how, const sigset_t * set, sigset_t *oset);
int thunk_atexit(void (*function)(void));
+pid_t thunk_fork(void);
+int thunk_ioctl(int fd, unsigned long request, void *opaque);
int thunk_aio_read(struct aiocb *);
int thunk_aio_write(struct aiocb *);
@@ -166,6 +169,8 @@
int thunk_pollin_tap(int, int);
int thunk_pollout_tap(int, int);
+int thunk_assert_presence(vaddr_t from, size_t size);
+
typedef struct {
unsigned int sample_rate;
unsigned int precision;
diff -r 0335e25eff37 -r 8dca4ce93f46 sys/arch/usermode/usermode/thunk.c
--- a/sys/arch/usermode/usermode/thunk.c Mon Jun 04 16:46:46 2018 +0000
+++ b/sys/arch/usermode/usermode/thunk.c Mon Jun 04 19:53:01 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.89 2018/06/01 08:04:57 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.90 2018/06/04 19:53:01 reinoud Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.89 2018/06/01 08:04:57 reinoud Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.90 2018/06/04 19:53:01 reinoud Exp $");
#endif
#define _KMEMUSER
@@ -36,6 +36,7 @@
#define _I386_MACHTYPES_H_
#include "../include/types.h"
+
#include <sys/mman.h>
#include <stdarg.h>
#include <sys/reboot.h>
@@ -344,6 +345,12 @@
}
void
+thunk_kill(pid_t pid, int sig)
+{
+ kill(pid, sig);
+}
+
+void
thunk_exit(int status)
{
return exit(status);
@@ -646,6 +653,18 @@
return atexit(function);
}
+pid_t
+thunk_fork(void)
+{
+ return fork();
+}
+
+int
+thunk_ioctl(int fd, unsigned long request, void *opaque)
+{
+ return ioctl(fd, request, opaque);
+}
+
int
thunk_aio_read(struct aiocb *aiocbp)
{
@@ -862,6 +881,21 @@
return poll(fds, __arraycount(fds), timeout);
}
+
+/* simply make sure its present... yeah its silly */
+int
+thunk_assert_presence(vaddr_t from, size_t size)
+{
+ vaddr_t va;
+ int t = 0;
+
+ for (va = from; va < from + (vaddr_t) size; va += PAGE_SIZE) {
+ t += *(int *) va;
+ }
+ return t;
+}
+
+
int
thunk_audio_open(const char *path)
{
Home |
Main Index |
Thread Index |
Old Index