Added mach_sys_msg_trap system call, and the host_page_size trap.
This commit is contained in:
parent
983202f1ed
commit
e9adbe1e47
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mach_host.c,v 1.1 2002/11/10 02:18:03 manu Exp $ */
|
/* $NetBSD: mach_host.c,v 1.2 2002/11/10 09:41:45 manu Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||||
|
@ -37,13 +37,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: mach_host.c,v 1.1 2002/11/10 02:18:03 manu Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: mach_host.c,v 1.2 2002/11/10 09:41:45 manu Exp $");
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
|
||||||
|
#include <uvm/uvm_extern.h>
|
||||||
|
#include <uvm/uvm_param.h>
|
||||||
|
|
||||||
#include <compat/mach/mach_types.h>
|
#include <compat/mach/mach_types.h>
|
||||||
#include <compat/mach/mach_host.h>
|
#include <compat/mach/mach_host.h>
|
||||||
|
|
||||||
|
@ -89,3 +92,26 @@ mach_host_info(msgh)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
mach_host_page_size(msgh)
|
||||||
|
mach_msg_header_t *msgh;
|
||||||
|
{
|
||||||
|
mach_host_page_size_request_t req;
|
||||||
|
mach_host_page_size_reply_t rep;
|
||||||
|
size_t msglen;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
DPRINTF(("mach_host_page_size\n"));
|
||||||
|
bzero(&rep, sizeof(rep));
|
||||||
|
msglen = sizeof(mach_host_page_size_reply_t);
|
||||||
|
rep.rep_msgh.msgh_bits = 0x1200; /* XXX why? */
|
||||||
|
rep.rep_msgh.msgh_size = sizeof(rep);
|
||||||
|
rep.rep_msgh.msgh_local_port = req.req_msgh.msgh_local_port;
|
||||||
|
rep.rep_msgh.msgh_id = 302; /* XXX why? */
|
||||||
|
rep.rep_page_size = PAGE_SIZE;
|
||||||
|
|
||||||
|
if ((error = copyout(&rep, msgh, msglen)) != 0)
|
||||||
|
return error;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mach_host.h,v 1.1 2002/11/10 02:18:03 manu Exp $ */
|
/* $NetBSD: mach_host.h,v 1.2 2002/11/10 09:41:45 manu Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||||
|
@ -42,6 +42,8 @@
|
||||||
#include <compat/mach/mach_types.h>
|
#include <compat/mach/mach_types.h>
|
||||||
#include <compat/mach/mach_message.h>
|
#include <compat/mach/mach_message.h>
|
||||||
|
|
||||||
|
/* host_info */
|
||||||
|
|
||||||
typedef mach_integer_t mach_host_flavor_t;
|
typedef mach_integer_t mach_host_flavor_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -99,6 +101,20 @@ struct mach_host_priority_info {
|
||||||
mach_integer_t maximum_priority;
|
mach_integer_t maximum_priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* host_page_size */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
mach_msg_header_t req_msgh;
|
||||||
|
} mach_host_page_size_request_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
mach_msg_header_t rep_msgh;
|
||||||
|
mach_ndr_record_t rep_ndr;
|
||||||
|
mach_kern_return_t rep_retval;
|
||||||
|
mach_vm_size_t rep_page_size;
|
||||||
|
} mach_host_page_size_reply_t;
|
||||||
|
|
||||||
int mach_host_info __P((mach_msg_header_t *));
|
int mach_host_info __P((mach_msg_header_t *));
|
||||||
|
int mach_host_page_size __P((mach_msg_header_t *));
|
||||||
|
|
||||||
#endif /* _MACH_HOST_H_ */
|
#endif /* _MACH_HOST_H_ */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mach_misc.c,v 1.7 2002/11/10 02:18:03 manu Exp $ */
|
/* $NetBSD: mach_misc.c,v 1.8 2002/11/10 09:41:45 manu Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: mach_misc.c,v 1.7 2002/11/10 02:18:03 manu Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: mach_misc.c,v 1.8 2002/11/10 09:41:45 manu Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
@ -206,6 +206,40 @@ mach_sys_msg_overwrite_trap(struct proc *p, void *v, register_t *r) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
mach_sys_msg_trap(struct proc *p, void *v, register_t *r) {
|
||||||
|
struct mach_sys_msg_trap_args *ap = v;
|
||||||
|
int error;
|
||||||
|
struct mach_subsystem_namemap *namemap;
|
||||||
|
*r = 0;
|
||||||
|
|
||||||
|
switch (SCARG(ap, option)) {
|
||||||
|
case MACH_SEND_MSG|MACH_RCV_MSG:
|
||||||
|
if (SCARG(ap, msg)) {
|
||||||
|
mach_msg_header_t mh;
|
||||||
|
if ((error = copyin(SCARG(ap, msg), &mh,
|
||||||
|
sizeof(mh))) != 0)
|
||||||
|
return error;
|
||||||
|
#ifdef DEBUG_MACH
|
||||||
|
mach_print_msg_header_t(&mh);
|
||||||
|
#endif /* DEBUG_MACH */
|
||||||
|
for (namemap = mach_namemap;
|
||||||
|
namemap->map_id; namemap++)
|
||||||
|
if (namemap->map_id == mh.msgh_id)
|
||||||
|
break;
|
||||||
|
if (namemap->map_id) {
|
||||||
|
DPRINTF(("mach_%s()\n", namemap->map_name));
|
||||||
|
return (*namemap->map_handler)(SCARG(ap, msg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
uprintf("unhandled sys_msg_trap option %x\n",
|
||||||
|
SCARG(ap, option));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
mach_sys_semaphore_signal_trap(struct proc *p, void *v, register_t *r) {
|
mach_sys_semaphore_signal_trap(struct proc *p, void *v, register_t *r) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mach_namemap.c,v 1.1 2002/11/10 02:18:03 manu Exp $ */
|
/* $NetBSD: mach_namemap.c,v 1.2 2002/11/10 09:41:45 manu Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.1 2002/11/10 02:18:03 manu Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.2 2002/11/10 09:41:45 manu Exp $");
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.1 2002/11/10 02:18:03 manu Exp $"
|
||||||
|
|
||||||
struct mach_subsystem_namemap mach_namemap[] = {
|
struct mach_subsystem_namemap mach_namemap[] = {
|
||||||
{ 200, mach_host_info, "host_info" },
|
{ 200, mach_host_info, "host_info" },
|
||||||
|
{ 202, mach_host_page_size," host_page_size" },
|
||||||
{ 0, NULL, NULL },
|
{ 0, NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mach_syscall.h,v 1.3 2001/11/13 02:09:02 lukem Exp $ */
|
/* $NetBSD: mach_syscall.h,v 1.4 2002/11/10 09:41:45 manu Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* System call numbers.
|
* System call numbers.
|
||||||
|
@ -19,6 +19,9 @@
|
||||||
/* syscall: "host_self_trap" ret: "mach_port_name_t" args: */
|
/* syscall: "host_self_trap" ret: "mach_port_name_t" args: */
|
||||||
#define MACH_SYS_host_self_trap 29
|
#define MACH_SYS_host_self_trap 29
|
||||||
|
|
||||||
|
/* syscall: "msg_trap" ret: "mach_msg_return_t" args: "mach_msg_header_t *" "mach_msg_option_t" "mach_msg_size_t" "mach_msg_size_t" "mach_port_name_t" "mach_msg_timeout_t" "mach_port_name_t" */
|
||||||
|
#define MACH_SYS_msg_trap 31
|
||||||
|
|
||||||
/* syscall: "msg_overwrite_trap" ret: "mach_kern_return_t" args: "mach_msg_header_t *" "mach_msg_option_t" "mach_msg_size_t" "mach_msg_size_t" "mach_port_name_t" "mach_msg_timeout_t" "mach_port_name_t" "mach_msg_header_t *" "mach_msg_size_t" */
|
/* syscall: "msg_overwrite_trap" ret: "mach_kern_return_t" args: "mach_msg_header_t *" "mach_msg_option_t" "mach_msg_size_t" "mach_msg_size_t" "mach_port_name_t" "mach_msg_timeout_t" "mach_port_name_t" "mach_msg_header_t *" "mach_msg_size_t" */
|
||||||
#define MACH_SYS_msg_overwrite_trap 32
|
#define MACH_SYS_msg_overwrite_trap 32
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mach_syscallargs.h,v 1.3 2001/11/13 02:09:03 lukem Exp $ */
|
/* $NetBSD: mach_syscallargs.h,v 1.4 2002/11/10 09:41:45 manu Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* System call argument lists.
|
* System call argument lists.
|
||||||
|
@ -27,6 +27,16 @@
|
||||||
} be; \
|
} be; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct mach_sys_msg_trap_args {
|
||||||
|
syscallarg(mach_msg_header_t *) msg;
|
||||||
|
syscallarg(mach_msg_option_t) option;
|
||||||
|
syscallarg(mach_msg_size_t) send_size;
|
||||||
|
syscallarg(mach_msg_size_t) rcv_size;
|
||||||
|
syscallarg(mach_port_name_t) rcv_name;
|
||||||
|
syscallarg(mach_msg_timeout_t) timeout;
|
||||||
|
syscallarg(mach_port_name_t) notify;
|
||||||
|
};
|
||||||
|
|
||||||
struct mach_sys_msg_overwrite_trap_args {
|
struct mach_sys_msg_overwrite_trap_args {
|
||||||
syscallarg(mach_msg_header_t *) msg;
|
syscallarg(mach_msg_header_t *) msg;
|
||||||
syscallarg(mach_msg_option_t) option;
|
syscallarg(mach_msg_option_t) option;
|
||||||
|
@ -159,6 +169,7 @@ int mach_sys_reply_port(struct proc *, void *, register_t *);
|
||||||
int mach_sys_thread_self_trap(struct proc *, void *, register_t *);
|
int mach_sys_thread_self_trap(struct proc *, void *, register_t *);
|
||||||
int mach_sys_task_self_trap(struct proc *, void *, register_t *);
|
int mach_sys_task_self_trap(struct proc *, void *, register_t *);
|
||||||
int mach_sys_host_self_trap(struct proc *, void *, register_t *);
|
int mach_sys_host_self_trap(struct proc *, void *, register_t *);
|
||||||
|
int mach_sys_msg_trap(struct proc *, void *, register_t *);
|
||||||
int mach_sys_msg_overwrite_trap(struct proc *, void *, register_t *);
|
int mach_sys_msg_overwrite_trap(struct proc *, void *, register_t *);
|
||||||
int mach_sys_semaphore_signal_trap(struct proc *, void *, register_t *);
|
int mach_sys_semaphore_signal_trap(struct proc *, void *, register_t *);
|
||||||
int mach_sys_semaphore_signal_all_trap(struct proc *, void *, register_t *);
|
int mach_sys_semaphore_signal_all_trap(struct proc *, void *, register_t *);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mach_syscalls.c,v 1.3 2001/11/13 02:09:03 lukem Exp $ */
|
/* $NetBSD: mach_syscalls.c,v 1.4 2002/11/10 09:41:45 manu Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* System call names.
|
* System call names.
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: mach_syscalls.c,v 1.3 2001/11/13 02:09:03 lukem Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: mach_syscalls.c,v 1.4 2002/11/10 09:41:45 manu Exp $");
|
||||||
|
|
||||||
#if defined(_KERNEL_OPT)
|
#if defined(_KERNEL_OPT)
|
||||||
#if defined(_KERNEL_OPT)
|
#if defined(_KERNEL_OPT)
|
||||||
|
@ -58,7 +58,7 @@ const char *const mach_syscallnames[] = {
|
||||||
"task_self_trap", /* 28 = task_self_trap */
|
"task_self_trap", /* 28 = task_self_trap */
|
||||||
"host_self_trap", /* 29 = host_self_trap */
|
"host_self_trap", /* 29 = host_self_trap */
|
||||||
"#30 (unimplemented)", /* 30 = unimplemented */
|
"#30 (unimplemented)", /* 30 = unimplemented */
|
||||||
"#31 (unimplemented)", /* 31 = unimplemented */
|
"msg_trap", /* 31 = msg_trap */
|
||||||
"msg_overwrite_trap", /* 32 = msg_overwrite_trap */
|
"msg_overwrite_trap", /* 32 = msg_overwrite_trap */
|
||||||
"semaphore_signal_trap", /* 33 = semaphore_signal_trap */
|
"semaphore_signal_trap", /* 33 = semaphore_signal_trap */
|
||||||
"semaphore_signal_all_trap", /* 34 = semaphore_signal_all_trap */
|
"semaphore_signal_all_trap", /* 34 = semaphore_signal_all_trap */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mach_sysent.c,v 1.3 2001/11/13 02:09:03 lukem Exp $ */
|
/* $NetBSD: mach_sysent.c,v 1.4 2002/11/10 09:41:45 manu Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* System call switch table.
|
* System call switch table.
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: mach_sysent.c,v 1.3 2001/11/13 02:09:03 lukem Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: mach_sysent.c,v 1.4 2002/11/10 09:41:45 manu Exp $");
|
||||||
|
|
||||||
#if defined(_KERNEL_OPT)
|
#if defined(_KERNEL_OPT)
|
||||||
#include "opt_ntp.h"
|
#include "opt_ntp.h"
|
||||||
|
@ -89,8 +89,8 @@ struct sysent mach_sysent[] = {
|
||||||
mach_sys_host_self_trap }, /* 29 = host_self_trap */
|
mach_sys_host_self_trap }, /* 29 = host_self_trap */
|
||||||
{ 0, 0, 0,
|
{ 0, 0, 0,
|
||||||
sys_nosys }, /* 30 = unimplemented */
|
sys_nosys }, /* 30 = unimplemented */
|
||||||
{ 0, 0, 0,
|
{ 7, s(struct mach_sys_msg_trap_args), 0,
|
||||||
sys_nosys }, /* 31 = unimplemented */
|
mach_sys_msg_trap }, /* 31 = msg_trap */
|
||||||
{ 9, s(struct mach_sys_msg_overwrite_trap_args), 0,
|
{ 9, s(struct mach_sys_msg_overwrite_trap_args), 0,
|
||||||
mach_sys_msg_overwrite_trap }, /* 32 = msg_overwrite_trap */
|
mach_sys_msg_overwrite_trap }, /* 32 = msg_overwrite_trap */
|
||||||
{ 1, s(struct mach_sys_semaphore_signal_trap_args), 0,
|
{ 1, s(struct mach_sys_semaphore_signal_trap_args), 0,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
$NetBSD: syscalls.master,v 1.2 2001/07/29 19:30:57 christos Exp $
|
$NetBSD: syscalls.master,v 1.3 2002/11/10 09:41:45 manu Exp $
|
||||||
|
|
||||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||||
|
|
||||||
|
@ -81,7 +81,14 @@
|
||||||
28 STD { mach_port_name_t mach_sys_task_self_trap(void); }
|
28 STD { mach_port_name_t mach_sys_task_self_trap(void); }
|
||||||
29 STD { mach_port_name_t mach_sys_host_self_trap(void); }
|
29 STD { mach_port_name_t mach_sys_host_self_trap(void); }
|
||||||
30 UNIMPL
|
30 UNIMPL
|
||||||
31 UNIMPL
|
31 STD { mach_msg_return_t mach_sys_msg_trap( \
|
||||||
|
mach_msg_header_t *msg, \
|
||||||
|
mach_msg_option_t option, \
|
||||||
|
mach_msg_size_t send_size, \
|
||||||
|
mach_msg_size_t rcv_size, \
|
||||||
|
mach_port_name_t rcv_name, \
|
||||||
|
mach_msg_timeout_t timeout, \
|
||||||
|
mach_port_name_t notify); }
|
||||||
32 STD { mach_kern_return_t mach_sys_msg_overwrite_trap( \
|
32 STD { mach_kern_return_t mach_sys_msg_overwrite_trap( \
|
||||||
mach_msg_header_t *msg, \
|
mach_msg_header_t *msg, \
|
||||||
mach_msg_option_t option, \
|
mach_msg_option_t option, \
|
||||||
|
|
Loading…
Reference in New Issue