More work on exceptions. Once a task has raised an exception, it remains
blocked in the kernel. The task that catched the exception may unblock it by sending a reply to the exception message (Of course it will have to change something so that the exception is not immediatly raised again). Handling of this reply is a bit complicated, as the kernel acts as the client instead of the server. In this situation, we receive a message but we will not send any reply (the message we receive is already a reply). I have not found anything better than a special case in mach_msg_overwrite_trap() to handle this. A surprise: exceptions ports are preserved accross forks. While we are there, use appropriate 64 bit types for make_memory_entry_64.
This commit is contained in:
parent
88ed237274
commit
e04d06c9bb
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: darwin_exec.c,v 1.23 2003/11/17 01:52:14 manu Exp $ */
|
||||
/* $NetBSD: darwin_exec.c,v 1.24 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "opt_compat_darwin.h" /* For COMPAT_DARWIN in mach_port.h */
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_exec.c,v 1.23 2003/11/17 01:52:14 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_exec.c,v 1.24 2003/11/18 01:40:18 manu Exp $");
|
||||
|
||||
#include "opt_syscall_debug.h"
|
||||
|
||||
|
@ -229,6 +229,9 @@ darwin_e_proc_exec(p, epp)
|
|||
|
||||
darwin_e_proc_init(p, p->p_vmspace);
|
||||
|
||||
/* Setup the mach_emuldata part of darwin_emuldata */
|
||||
mach_e_proc_exec(p, epp);
|
||||
|
||||
ded = (struct darwin_emuldata *)p->p_emuldata;
|
||||
if (p->p_pid == darwin_init_pid)
|
||||
ded->ded_fakepid = 1;
|
||||
|
@ -254,6 +257,9 @@ darwin_e_proc_fork(p, parent)
|
|||
/* Use parent's vmspace because our vmspace may not be setup yet */
|
||||
darwin_e_proc_init(p, parent->p_vmspace);
|
||||
|
||||
/* Setup the mach_emuldata part of darwin_emuldata */
|
||||
mach_e_proc_fork(p, parent);
|
||||
|
||||
ded1 = p->p_emuldata;
|
||||
ded2 = parent->p_emuldata;
|
||||
|
||||
|
@ -291,6 +297,7 @@ darwin_e_proc_init(p, vmspace)
|
|||
ded->ded_fakepid = 0;
|
||||
ded->ded_wsdev = NODEV;
|
||||
|
||||
/* Initalize the mach_emuldata part of darwin_emuldata */
|
||||
mach_e_proc_init(p, vmspace);
|
||||
|
||||
return;
|
||||
|
@ -373,6 +380,10 @@ darwin_e_proc_exit(p)
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
* Cleanup mach_emuldata part of darwin_emuldata
|
||||
* It will also free p->p_emuldata.
|
||||
*/
|
||||
mach_e_proc_exit(p);
|
||||
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_exec.c,v 1.35 2003/11/17 01:52:14 manu Exp $ */
|
||||
/* $NetBSD: mach_exec.c,v 1.36 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_exec.c,v 1.35 2003/11/17 01:52:14 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_exec.c,v 1.36 2003/11/18 01:40:18 manu Exp $");
|
||||
|
||||
#include "opt_syscall_debug.h"
|
||||
|
||||
|
@ -62,9 +62,6 @@ __KERNEL_RCSID(0, "$NetBSD: mach_exec.c,v 1.35 2003/11/17 01:52:14 manu Exp $");
|
|||
#include <compat/mach/mach_exec.h>
|
||||
|
||||
static int mach_cold = 1; /* Have we initialized COMPAT_MACH structures? */
|
||||
|
||||
static void mach_e_proc_exec(struct proc *, struct exec_package *);
|
||||
static void mach_e_proc_fork(struct proc *, struct proc *);
|
||||
static void mach_init(void);
|
||||
|
||||
extern struct sysent sysent[];
|
||||
|
@ -192,7 +189,7 @@ exec_mach_probe(path)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
mach_e_proc_exec(p, epp)
|
||||
struct proc *p;
|
||||
struct exec_package *epp;
|
||||
|
@ -202,7 +199,7 @@ mach_e_proc_exec(p, epp)
|
|||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
mach_e_proc_fork(p, parent)
|
||||
struct proc *p;
|
||||
struct proc *parent;
|
||||
|
@ -217,7 +214,9 @@ mach_e_proc_fork(p, parent)
|
|||
|
||||
med1 = p->p_emuldata;
|
||||
med2 = parent->p_emuldata;
|
||||
/* Nothing is inherited across forks in struct mach_emuldata */
|
||||
|
||||
/* Exception ports are inherited between forks. */
|
||||
(void)memcpy(med1->med_exc, med2->med_exc, sizeof(med1->med_exc));
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_exec.h,v 1.20 2003/11/17 13:20:06 manu Exp $ */
|
||||
/* $NetBSD: mach_exec.h,v 1.21 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -68,6 +68,8 @@ int exec_mach_copyargs(struct proc *, struct exec_package *,
|
|||
int exec_mach_probe(char **);
|
||||
void mach_e_proc_init(struct proc *, struct vmspace *);
|
||||
void mach_e_proc_exit(struct proc *);
|
||||
void mach_e_proc_exec(struct proc *, struct exec_package *);
|
||||
void mach_e_proc_fork(struct proc *, struct proc *);
|
||||
|
||||
extern const struct emul emul_mach;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_message.c,v 1.29 2003/11/15 22:55:35 manu Exp $ */
|
||||
/* $NetBSD: mach_message.c,v 1.30 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.29 2003/11/15 22:55:35 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.30 2003/11/18 01:40:18 manu Exp $");
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
#include "opt_compat_mach.h" /* For COMPAT_MACH in <sys/ktrace.h> */
|
||||
|
@ -180,15 +180,7 @@ mach_sys_msg_overwrite_trap(l, v, retval)
|
|||
if (mp->mp_flags & MACH_MP_INKERNEL) {
|
||||
struct mach_trap_args args;
|
||||
mach_msg_header_t *rm;
|
||||
|
||||
/*
|
||||
* Check that the local port is valid, else
|
||||
* we will not be able to send the reply
|
||||
*/
|
||||
if (lr == NULL) {
|
||||
*retval = MACH_SEND_INVALID_REPLY;
|
||||
goto out1;
|
||||
}
|
||||
size_t min_reqlen, max_replen;
|
||||
|
||||
/*
|
||||
* Look for the function that will handle it,
|
||||
|
@ -207,6 +199,35 @@ mach_sys_msg_overwrite_trap(l, v, retval)
|
|||
*retval = MACH_SEND_INVALID_DEST;
|
||||
goto out1;
|
||||
}
|
||||
min_reqlen = srv->srv_reqlen;
|
||||
max_replen = srv->srv_replen;
|
||||
|
||||
/*
|
||||
* Special case when the kernel behaves as
|
||||
* the client: replies to exceptions and
|
||||
* notifications. There will be no reply,
|
||||
* as we already receive a reply.
|
||||
* - request and reply are swapped
|
||||
* - there will be no reply, so set lr to NULL.
|
||||
* - skip the lr == NULL test
|
||||
* XXX This is inelegant.
|
||||
*/
|
||||
if ((sm->msgh_id >= 2501) && (sm->msgh_id <= 2503)) {
|
||||
min_reqlen = srv->srv_replen;
|
||||
max_replen = srv->srv_reqlen;
|
||||
lr = NULL;
|
||||
goto skip_null_lr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that the local port is valid, else
|
||||
* we will not be able to send the reply
|
||||
*/
|
||||
if (lr == NULL) {
|
||||
*retval = MACH_SEND_INVALID_REPLY;
|
||||
goto out1;
|
||||
}
|
||||
skip_null_lr:
|
||||
|
||||
/*
|
||||
* Sanity check message length. We do not want the
|
||||
|
@ -214,11 +235,11 @@ mach_sys_msg_overwrite_trap(l, v, retval)
|
|||
* 1) use kernel memory located after
|
||||
* the end of the request message.
|
||||
*/
|
||||
if (send_size < srv->srv_reqlen) {
|
||||
if (send_size < min_reqlen) {
|
||||
#ifdef DEBUG_MACH
|
||||
printf("mach server %s: smsg overflow: "
|
||||
"send = %d, min = %d\n",
|
||||
srv->srv_name, send_size, srv->srv_reqlen);
|
||||
srv->srv_name, send_size, min_reqlen);
|
||||
#endif
|
||||
*retval = MACH_SEND_MSG_TOO_SMALL;
|
||||
goto out1;
|
||||
|
@ -228,13 +249,13 @@ mach_sys_msg_overwrite_trap(l, v, retval)
|
|||
* 2) give away random kernel data to the user program
|
||||
* when the reply message is copied out.
|
||||
*/
|
||||
if (rcv_size > srv->srv_replen) {
|
||||
if (rcv_size > max_replen) {
|
||||
#ifdef DEBUG_MACH
|
||||
printf("mach server %s: rmsg overflow: "
|
||||
"recv = %d, max = %d\n",
|
||||
srv->srv_name, rcv_size, srv->srv_replen);
|
||||
srv->srv_name, rcv_size, max_replen);
|
||||
#endif
|
||||
rcv_size = srv->srv_replen;
|
||||
rcv_size = max_replen;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -249,9 +270,13 @@ mach_sys_msg_overwrite_trap(l, v, retval)
|
|||
* Invoke the server. We give it the opportunity
|
||||
* to shorten rcv_size if there is less data in
|
||||
* the reply than what the sender expected.
|
||||
* If lr is NULL, this is a no reply operation.
|
||||
*/
|
||||
rm = malloc(srv->srv_replen,
|
||||
M_EMULDATA, M_WAITOK | M_ZERO);
|
||||
if (lr != NULL)
|
||||
rm = malloc(max_replen,
|
||||
M_EMULDATA, M_WAITOK | M_ZERO);
|
||||
else
|
||||
rm = NULL;
|
||||
|
||||
args.l = l;
|
||||
args.smsg = sm;
|
||||
|
@ -261,14 +286,20 @@ mach_sys_msg_overwrite_trap(l, v, retval)
|
|||
if ((*retval = (*srv->srv_handler)(&args)) != 0)
|
||||
goto out1;
|
||||
|
||||
/*
|
||||
* No-reply opration: everything is done.
|
||||
*/
|
||||
if (lr == NULL)
|
||||
goto out1;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
/*
|
||||
* Catch potential bug in the server (santity
|
||||
* Catch potential bug in the server (sanity
|
||||
* check #3): did it output a larger message
|
||||
* then the one that was allocated?
|
||||
*/
|
||||
if ((SCARG(uap, option) & MACH_RCV_MSG) &&
|
||||
(rcv_size > srv->srv_replen)) {
|
||||
(rcv_size > max_replen)) {
|
||||
uprintf("mach_msg: reply too big in %s\n",
|
||||
srv->srv_name);
|
||||
}
|
||||
|
@ -290,8 +321,17 @@ mach_sys_msg_overwrite_trap(l, v, retval)
|
|||
mach_bootstrap_port->mp_recv->mr_sethead);
|
||||
#endif
|
||||
wakeup(mp->mp_recv->mr_sethead);
|
||||
free(sm, M_EMULDATA);
|
||||
*retval = 0;
|
||||
out1:
|
||||
free(sm, M_EMULDATA);
|
||||
/*
|
||||
* Skip the recieve part and return now if
|
||||
* - there has been an error in the send part
|
||||
* - this is a no-reply operation (lr == NULL)
|
||||
*/
|
||||
if ((*retval != 0) || (lr == NULL))
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
/*
|
||||
* The message is not to be handled by the kernel.
|
||||
|
@ -353,12 +393,6 @@ mach_sys_msg_overwrite_trap(l, v, retval)
|
|||
*/
|
||||
wakeup(mp->mp_recv->mr_sethead);
|
||||
}
|
||||
|
||||
out1:
|
||||
if (*retval != 0) {
|
||||
free(sm, M_EMULDATA);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_notify.c,v 1.4 2003/11/17 13:20:06 manu Exp $ */
|
||||
/* $NetBSD: mach_notify.c,v 1.5 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_notify.c,v 1.4 2003/11/17 13:20:06 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_notify.c,v 1.5 2003/11/18 01:40:18 manu Exp $");
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
#include "opt_compat_mach.h" /* For COMPAT_MACH in <sys/ktrace.h> */
|
||||
|
@ -55,6 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: mach_notify.c,v 1.4 2003/11/17 13:20:06 manu Exp $")
|
|||
#include <compat/mach/mach_exec.h>
|
||||
#include <compat/mach/mach_thread.h>
|
||||
#include <compat/mach/mach_notify.h>
|
||||
#include <compat/mach/mach_message.h>
|
||||
#include <compat/mach/mach_services.h>
|
||||
|
||||
static void mach_siginfo_to_exception(const struct ksiginfo *, int *);
|
||||
|
||||
|
@ -260,7 +262,11 @@ mach_exception(l, ksi, exc_port, exc, task, thread)
|
|||
int behavior, flavor;
|
||||
mach_msg_header_t *msgh;
|
||||
size_t msglen;
|
||||
struct mach_right *exc_right;
|
||||
struct mach_right *exc_mr;
|
||||
struct mach_emuldata *med;
|
||||
struct mach_right *kernel_mr;
|
||||
struct lwp *catcher_lwp;
|
||||
int error;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (exc_port->mp_datatype != MACH_MP_EXC_FLAGS)
|
||||
|
@ -268,8 +274,16 @@ mach_exception(l, ksi, exc_port, exc, task, thread)
|
|||
#endif
|
||||
behavior = (int)exc_port->mp_data >> 16;
|
||||
flavor = (int)exc_port->mp_data & 0xffff;
|
||||
exc_right = mach_right_get(exc_port, l, MACH_PORT_TYPE_SEND, 0);
|
||||
|
||||
/*
|
||||
* We want the port names in the target process, that is,
|
||||
* the process with receive right for exc_port.
|
||||
*/
|
||||
catcher_lwp = exc_port->mp_recv->mr_lwp;
|
||||
med = catcher_lwp->l_proc->p_emuldata;
|
||||
exc_mr = mach_right_get(exc_port, catcher_lwp, MACH_PORT_TYPE_SEND, 0);
|
||||
kernel_mr = mach_right_get(med->med_kernel,
|
||||
catcher_lwp, MACH_PORT_TYPE_SEND, 0);
|
||||
|
||||
switch (behavior) {
|
||||
case MACH_EXCEPTION_DEFAULT: {
|
||||
|
@ -284,7 +298,8 @@ mach_exception(l, ksi, exc_port, exc, task, thread)
|
|||
MACH_MSGH_REMOTE_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE);
|
||||
req->req_msgh.msgh_size =
|
||||
sizeof(*req) - sizeof(req->req_trailer);
|
||||
req->req_msgh.msgh_local_port = exc_right->mr_name;
|
||||
req->req_msgh.msgh_remote_port = kernel_mr->mr_name;
|
||||
req->req_msgh.msgh_local_port = exc_mr->mr_name;
|
||||
req->req_msgh.msgh_id = MACH_EXC_RAISE_MSGID;
|
||||
req->req_body.msgh_descriptor_count = 2;
|
||||
req->req_thread.name = thread->mr_name;
|
||||
|
@ -313,7 +328,8 @@ mach_exception(l, ksi, exc_port, exc, task, thread)
|
|||
MACH_MSGH_REMOTE_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE);
|
||||
req->req_msgh.msgh_size =
|
||||
sizeof(*req) - sizeof(req->req_trailer);
|
||||
req->req_msgh.msgh_local_port = exc_right->mr_name;
|
||||
req->req_msgh.msgh_remote_port = kernel_mr->mr_name;
|
||||
req->req_msgh.msgh_local_port = exc_mr->mr_name;
|
||||
req->req_msgh.msgh_id = MACH_EXCEPTION_STATE;
|
||||
req->req_exc = exc;
|
||||
req->req_codecount = 2;
|
||||
|
@ -342,7 +358,8 @@ mach_exception(l, ksi, exc_port, exc, task, thread)
|
|||
MACH_MSGH_REMOTE_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE);
|
||||
req->req_msgh.msgh_size =
|
||||
sizeof(*req) - sizeof(req->req_trailer);
|
||||
req->req_msgh.msgh_local_port = exc_right->mr_name;
|
||||
req->req_msgh.msgh_remote_port = kernel_mr->mr_name;
|
||||
req->req_msgh.msgh_local_port = exc_mr->mr_name;
|
||||
req->req_msgh.msgh_id = MACH_EXC_RAISE_STATE_IDENTITY_MSGID;
|
||||
req->req_body.msgh_descriptor_count = 2;
|
||||
req->req_thread.name = thread->mr_name;
|
||||
|
@ -371,9 +388,19 @@ mach_exception(l, ksi, exc_port, exc, task, thread)
|
|||
break;
|
||||
}
|
||||
|
||||
(void)mach_message_get(msgh, msglen, exc_port, l);
|
||||
(void)mach_message_get(msgh, msglen, exc_port, NULL);
|
||||
wakeup(exc_port->mp_recv->mr_sethead);
|
||||
|
||||
/*
|
||||
* The thread that caused the exception is now
|
||||
* supposed to wait for a reply to its message.
|
||||
* This is to avoid an endless loop on the same
|
||||
* exception.
|
||||
*/
|
||||
error = tsleep(kernel_mr->mr_port, PZERO|PCATCH, "mach_exc", 0);
|
||||
if ((error == ERESTART) || (error == EINTR))
|
||||
return error;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -450,3 +477,62 @@ mach_siginfo_to_exception(ksi, code)
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
mach_exception_raise(args)
|
||||
struct mach_trap_args *args;
|
||||
{
|
||||
mach_exception_raise_reply_t *rep;
|
||||
struct lwp *l = args->l;
|
||||
mach_port_t mn;
|
||||
struct mach_right *mr;
|
||||
struct mach_emuldata *med;
|
||||
|
||||
/*
|
||||
* No typo here: the reply is in the sent message.
|
||||
* The kernel is acting as a client that gets the
|
||||
* reply message to its exception message.
|
||||
*/
|
||||
rep = args->smsg;
|
||||
|
||||
/*
|
||||
* Sanity check the remote port: it should be a
|
||||
* right to the process' kernel port
|
||||
*/
|
||||
mn = rep->rep_msgh.msgh_remote_port;
|
||||
if ((mr = mach_right_check(mn, l, MACH_PORT_TYPE_ALL_RIGHTS)) == 0)
|
||||
return MACH_SEND_INVALID_RIGHT;
|
||||
|
||||
med = (struct mach_emuldata *)l->l_proc->p_emuldata;
|
||||
if (med->med_kernel != mr->mr_port) {
|
||||
#ifdef DEBUG_MACH
|
||||
printf("mach_exception_raise: remote port not kernel port\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This message is sent by the process catching the
|
||||
* exception to release the process that raised the exception.
|
||||
* We wake it up if the return value is 0 (no error), else
|
||||
* we should ignore this message.
|
||||
*/
|
||||
if (rep->rep_retval == 0)
|
||||
wakeup(mr->mr_port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
mach_exception_raise_state(args)
|
||||
struct mach_trap_args *args;
|
||||
{
|
||||
return mach_exception_raise(args);
|
||||
}
|
||||
|
||||
int
|
||||
mach_exception_raise_state_identity(args)
|
||||
struct mach_trap_args *args;
|
||||
{
|
||||
return mach_exception_raise(args);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_notify.h,v 1.4 2003/11/17 13:20:06 manu Exp $ */
|
||||
/* $NetBSD: mach_notify.h,v 1.5 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -124,6 +124,7 @@ void mach_notify_port_dead_name(struct lwp *, struct mach_right *);
|
|||
#define MACH_EXC_RAISE_STATE_MSGID 2402
|
||||
#define MACH_EXC_RAISE_STATE_IDENTITY_MSGID 2403
|
||||
|
||||
/* exception_raise. The kernel is the client, not the server */
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t req_msgh;
|
||||
|
@ -137,6 +138,14 @@ typedef struct {
|
|||
mach_msg_trailer_t req_trailer;
|
||||
} mach_exception_raise_request_t;
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t rep_msgh;
|
||||
mach_ndr_record_t rep_ndr;
|
||||
mach_kern_return_t rep_retval;
|
||||
} mach_exception_raise_reply_t;
|
||||
|
||||
/* exception_raise_state. The kernel is the client, not the server */
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t req_msgh;
|
||||
mach_ndr_record_t req_ndr;
|
||||
|
@ -149,6 +158,14 @@ typedef struct {
|
|||
mach_msg_trailer_t req_trailer;
|
||||
} mach_exception_raise_state_request_t;
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t rep_msgh;
|
||||
mach_ndr_record_t rep_ndr;
|
||||
mach_kern_return_t rep_retval;
|
||||
} mach_exception_raise_state_reply_t;
|
||||
|
||||
/* exception_raise_state_identity. The kernel is the client, not the server */
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t req_msgh;
|
||||
mach_msg_body_t req_body;
|
||||
|
@ -164,6 +181,13 @@ typedef struct {
|
|||
mach_msg_trailer_t req_trailer;
|
||||
} mach_exception_raise_state_identity_request_t;
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t rep_msgh;
|
||||
mach_ndr_record_t rep_ndr;
|
||||
mach_kern_return_t rep_retval;
|
||||
} mach_exception_raise_state_identity_reply_t;
|
||||
|
||||
|
||||
void mach_trapsignal(struct lwp *, const struct ksiginfo *);
|
||||
int mach_trapsignal1(struct lwp *, const struct ksiginfo *);
|
||||
int mach_exception(struct lwp *, const struct ksiginfo *,
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* $NetBSD: mach_services.c,v 1.6 2003/11/17 01:52:14 manu Exp $ */
|
||||
/* $NetBSD: mach_services.c,v 1.7 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*
|
||||
* Mach services table.
|
||||
*
|
||||
* DO NOT EDIT -- this file is automatically generated.
|
||||
* created from $NetBSD: mach_services.c,v 1.6 2003/11/17 01:52:14 manu Exp $
|
||||
* created from $NetBSD: mach_services.c,v 1.7 2003/11/18 01:40:18 manu Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_services.c,v 1.6 2003/11/17 01:52:14 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_services.c,v 1.7 2003/11/18 01:40:18 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -22,6 +22,7 @@ __KERNEL_RCSID(0, "$NetBSD: mach_services.c,v 1.6 2003/11/17 01:52:14 manu Exp $
|
|||
#include <compat/mach/mach_task.h>
|
||||
#include <compat/mach/mach_thread.h>
|
||||
#include <compat/mach/mach_semaphore.h>
|
||||
#include <compat/mach/mach_notify.h>
|
||||
#include <compat/mach/mach_vm.h>
|
||||
#include <compat/mach/mach_services.h>
|
||||
|
||||
|
@ -123,6 +124,9 @@ struct mach_service mach_services_table[] = {
|
|||
{2403, NULL, "exception_raise_state_identity", 0, 0},
|
||||
{2450, NULL, "unimpl. samples", 0, 0},
|
||||
{2451, NULL, "unimpl. notices", 0, 0},
|
||||
{2501, mach_exception_raise, "exception_raise", sizeof(mach_exception_raise_request_t), sizeof(mach_exception_raise_reply_t)},
|
||||
{2502, mach_exception_raise_state, "exception_raise_state", sizeof(mach_exception_raise_state_request_t), sizeof(mach_exception_raise_state_reply_t)},
|
||||
{2503, mach_exception_raise_state_identity, "exception_raise_state_identity", sizeof(mach_exception_raise_state_identity_request_t), sizeof(mach_exception_raise_state_identity_reply_t)},
|
||||
{2800, mach_io_object_get_class, "io_object_get_class", sizeof(mach_io_object_get_class_request_t), sizeof(mach_io_object_get_class_reply_t)},
|
||||
{2801, mach_io_object_conforms_to, "io_object_conforms_to", sizeof(mach_io_object_conforms_to_request_t), sizeof(mach_io_object_conforms_to_reply_t)},
|
||||
{2802, mach_io_iterator_next, "io_iterator_next", sizeof(mach_io_iterator_next_request_t), sizeof(mach_io_iterator_next_reply_t)},
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/* $NetBSD: mach_services.h,v 1.6 2003/11/17 01:52:14 manu Exp $ */
|
||||
/* $NetBSD: mach_services.h,v 1.7 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*
|
||||
* Mach services prototypes.
|
||||
*
|
||||
* DO NOT EDIT -- this file is automatically generated.
|
||||
* DO NOT EDIT -- this file is automatically generated.
|
||||
* created from $NetBSD: mach_services.h,v 1.6 2003/11/17 01:52:14 manu Exp $
|
||||
* created from $NetBSD: mach_services.h,v 1.7 2003/11/18 01:40:18 manu Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_services.h,v 1.6 2003/11/17 01:52:14 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_services.h,v 1.7 2003/11/18 01:40:18 manu Exp $");
|
||||
|
||||
#include <compat/mach/mach_types.h>
|
||||
#include <compat/mach/mach_message.h>
|
||||
|
@ -20,6 +20,9 @@ int mach_host_get_io_master(struct mach_trap_args *);
|
|||
int mach_host_get_clock_service(struct mach_trap_args *);
|
||||
int mach_bootstrap_look_up(struct mach_trap_args *);
|
||||
int mach_clock_get_time(struct mach_trap_args *);
|
||||
int mach_exception_raise(struct mach_trap_args *);
|
||||
int mach_exception_raise_state(struct mach_trap_args *);
|
||||
int mach_exception_raise_state_identity(struct mach_trap_args *);
|
||||
int mach_io_object_get_class(struct mach_trap_args *);
|
||||
int mach_io_object_conforms_to(struct mach_trap_args *);
|
||||
int mach_io_iterator_next(struct mach_trap_args *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: mach_services.master,v 1.4 2003/11/17 01:52:14 manu Exp $
|
||||
$NetBSD: mach_services.master,v 1.5 2003/11/18 01:40:18 manu Exp $
|
||||
;
|
||||
; Mach services list.
|
||||
;
|
||||
|
@ -15,6 +15,7 @@
|
|||
#include <compat/mach/mach_task.h>
|
||||
#include <compat/mach/mach_thread.h>
|
||||
#include <compat/mach/mach_semaphore.h>
|
||||
#include <compat/mach/mach_notify.h>
|
||||
#include <compat/mach/mach_vm.h>
|
||||
#include <compat/mach/mach_services.h>
|
||||
|
||||
|
@ -176,6 +177,15 @@
|
|||
2450 UNIMPL samples
|
||||
2451 UNIMPL notices
|
||||
|
||||
;
|
||||
; Mach exception Replies.
|
||||
; Defined because the kernel is the client here:
|
||||
; it has to handle replies instead of reequest.
|
||||
;
|
||||
2501 STD exception_raise
|
||||
2502 STD exception_raise_state
|
||||
2503 STD exception_raise_state_identity
|
||||
|
||||
;
|
||||
; Mach IOKit
|
||||
;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* $NetBSD: mach_services_names.c,v 1.3 2003/11/17 01:52:14 manu Exp $ */
|
||||
/* $NetBSD: mach_services_names.c,v 1.4 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*
|
||||
* Mach services names. This file is not built
|
||||
* by the kernel, it is included by kdump sources.
|
||||
*
|
||||
* created from $NetBSD: mach_services_names.c,v 1.3 2003/11/17 01:52:14 manu Exp $
|
||||
* created from $NetBSD: mach_services_names.c,v 1.4 2003/11/18 01:40:18 manu Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_services_names.c,v 1.3 2003/11/17 01:52:14 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_services_names.c,v 1.4 2003/11/18 01:40:18 manu Exp $");
|
||||
|
||||
struct mach_service_name {
|
||||
int srv_id;
|
||||
|
@ -113,6 +113,9 @@ struct mach_service_name mach_services_names[] = {
|
|||
{2403, "exception_raise_state_identity"},
|
||||
{2450, "unimpl. samples"},
|
||||
{2451, "unimpl. notices"},
|
||||
{2501, "exception_raise"},
|
||||
{2502, "exception_raise_state"},
|
||||
{2503, "exception_raise_state_identity"},
|
||||
{2800, "io_object_get_class"},
|
||||
{2801, "io_object_conforms_to"},
|
||||
{2802, "io_iterator_next"},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_task.c,v 1.35 2003/11/17 13:20:06 manu Exp $ */
|
||||
/* $NetBSD: mach_task.c,v 1.36 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
|
||||
|
@ -39,7 +39,7 @@
|
|||
#include "opt_compat_darwin.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_task.c,v 1.35 2003/11/17 13:20:06 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_task.c,v 1.36 2003/11/18 01:40:18 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -377,7 +377,7 @@ mach_task_get_exception_ports(args)
|
|||
rep->rep_old_handler[j].type = 0;
|
||||
rep->rep_masks[j] = 1 << i;
|
||||
rep->rep_old_behaviors[j] = (int)mr->mr_port->mp_data >> 16;
|
||||
rep->rep_old_flavors[j] = (int)mr->mr_port->mp_data & 0xff;
|
||||
rep->rep_old_flavors[j] = (int)mr->mr_port->mp_data & 0xffff;
|
||||
|
||||
j++;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_types.h,v 1.17 2003/11/16 01:14:07 manu Exp $ */
|
||||
/* $NetBSD: mach_types.h,v 1.18 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
|
||||
|
@ -58,9 +58,9 @@ typedef int mach_vm_prot_t;
|
|||
typedef int mach_thread_state_flavor_t;
|
||||
typedef unsigned int mach_natural_t;
|
||||
typedef unsigned long mach_vm_size_t;
|
||||
typedef u_quad_t mach_vm_size_64_t;
|
||||
typedef uint64_t mach_memory_object_size_t;
|
||||
typedef unsigned long mach_vm_offset_t;
|
||||
typedef u_quad_t mach_vm_offset_64_t;
|
||||
typedef uint64_t mach_memory_object_offset_t;
|
||||
typedef int mach_vm_region_flavor_t;
|
||||
typedef int mach_vm_behavior_t;
|
||||
typedef int mach_vm_sync_t;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_vm.h,v 1.21 2003/11/16 01:14:07 manu Exp $ */
|
||||
/* $NetBSD: mach_vm.h,v 1.22 2003/11/18 01:40:18 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
|
||||
|
@ -213,28 +213,26 @@ typedef struct {
|
|||
|
||||
/*
|
||||
* make_memory_entry_64
|
||||
* It is a bit difficult to see the difference between 32 bits
|
||||
* and 64 bits size and offset in Mach header files (the
|
||||
* difference seems to be only experimental)
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t req_msgh;
|
||||
mach_msg_body_t req_body;
|
||||
mach_msg_port_descriptor_t req_parent_entry;
|
||||
mach_ndr_record_t req_ndr;
|
||||
mach_vm_size_64_t req_size;
|
||||
mach_vm_offset_64_t req_offset;
|
||||
mach_memory_object_size_t req_size;
|
||||
mach_memory_object_offset_t req_offset;
|
||||
mach_vm_prot_t req_perm;
|
||||
} mach_make_memory_entry_64_request_t;
|
||||
} __attribute__((packed)) mach_make_memory_entry_64_request_t;
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t rep_msgh;
|
||||
mach_msg_body_t rep_body;
|
||||
mach_msg_port_descriptor_t rep_obj_handle;
|
||||
mach_ndr_record_t rep_ndr;
|
||||
mach_vm_size_64_t rep_size;
|
||||
mach_memory_object_size_t rep_size;
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_make_memory_entry_64_reply_t;
|
||||
} __attribute__((packed)) mach_make_memory_entry_64_reply_t;
|
||||
|
||||
/* vm_region */
|
||||
|
||||
|
|
Loading…
Reference in New Issue