Added vm_inherit mach trap.
This commit is contained in:
parent
14c54c3327
commit
39e39a5b0f
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mach_namemap.c,v 1.8 2002/12/10 21:36:45 manu Exp $ */
|
/* $NetBSD: mach_namemap.c,v 1.9 2002/12/11 21:23:37 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.8 2002/12/10 21:36:45 manu Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.9 2002/12/11 21:23:37 manu Exp $");
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -70,6 +70,7 @@ struct mach_subsystem_namemap mach_namemap[] = {
|
||||||
{ 3801, mach_vm_allocate, "vm_allocate" },
|
{ 3801, mach_vm_allocate, "vm_allocate" },
|
||||||
{ 3802, mach_vm_deallocate, "vm_deallocate" },
|
{ 3802, mach_vm_deallocate, "vm_deallocate" },
|
||||||
{ 3803, mach_vm_protect, "vm_protect" },
|
{ 3803, mach_vm_protect, "vm_protect" },
|
||||||
|
{ 3804, mach_vm_inherit, "vm_inherit" },
|
||||||
{ 3812, mach_vm_map, "vm_map" },
|
{ 3812, mach_vm_map, "vm_map" },
|
||||||
{ 0, NULL, NULL },
|
{ 0, NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mach_vm.c,v 1.18 2002/12/10 21:36:45 manu Exp $ */
|
/* $NetBSD: mach_vm.c,v 1.19 2002/12/11 21:23:37 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_vm.c,v 1.18 2002/12/10 21:36:45 manu Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: mach_vm.c,v 1.19 2002/12/11 21:23:37 manu Exp $");
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -127,9 +127,11 @@ mach_vm_map(p, msgh, maxlen, dst)
|
||||||
case MACH_VM_INHERIT_SHARE:
|
case MACH_VM_INHERIT_SHARE:
|
||||||
SCARG(&cup, flags) |= MAP_INHERIT;
|
SCARG(&cup, flags) |= MAP_INHERIT;
|
||||||
break;
|
break;
|
||||||
|
case MACH_VM_INHERIT_COPY:
|
||||||
|
SCARG(&cup, flags) |= MAP_COPY;
|
||||||
|
break;
|
||||||
case MACH_VM_INHERIT_NONE:
|
case MACH_VM_INHERIT_NONE:
|
||||||
break;
|
break;
|
||||||
case MACH_VM_INHERIT_COPY:
|
|
||||||
case MACH_VM_INHERIT_DONATE_COPY:
|
case MACH_VM_INHERIT_DONATE_COPY:
|
||||||
default:
|
default:
|
||||||
uprintf("mach_vm_map: unsupported inherance flag %d\n",
|
uprintf("mach_vm_map: unsupported inherance flag %d\n",
|
||||||
|
@ -445,3 +447,38 @@ bad2:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
mach_vm_inherit(p, msgh, maxlen, dst)
|
||||||
|
struct proc *p;
|
||||||
|
mach_msg_header_t *msgh;
|
||||||
|
size_t maxlen;
|
||||||
|
mach_msg_header_t *dst;
|
||||||
|
{
|
||||||
|
mach_vm_inherit_request_t req;
|
||||||
|
mach_vm_inherit_reply_t rep;
|
||||||
|
struct sys_minherit_args cup;
|
||||||
|
register_t retval;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
if ((error = copyin(msgh, &req, sizeof(req))) != 0)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
bzero(&rep, sizeof(rep));
|
||||||
|
|
||||||
|
SCARG(&cup, addr) = (void *)req.req_addr;
|
||||||
|
SCARG(&cup, len) = req.req_size;
|
||||||
|
/* Flags map well between Mach and NetBSD, just a 8 bit shift */
|
||||||
|
SCARG(&cup, inherit) = req.req_inh << 8;
|
||||||
|
|
||||||
|
if ((error = sys_minherit(p, &cup, &retval)) != 0)
|
||||||
|
return MACH_MSG_ERROR(p, msgh, &req, &rep, error, maxlen, dst);
|
||||||
|
|
||||||
|
rep.rep_msgh.msgh_bits =
|
||||||
|
MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE);
|
||||||
|
rep.rep_msgh.msgh_size = sizeof(rep) - sizeof(rep.rep_trailer);
|
||||||
|
rep.rep_msgh.msgh_local_port = req.req_msgh.msgh_local_port;
|
||||||
|
rep.rep_msgh.msgh_id = req.req_msgh.msgh_id + 100;
|
||||||
|
rep.rep_trailer.msgh_trailer_size = 8;
|
||||||
|
|
||||||
|
return MACH_MSG_RETURN(p, &rep, msgh, sizeof(rep), maxlen, dst);
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mach_vm.h,v 1.9 2002/12/10 21:36:45 manu Exp $ */
|
/* $NetBSD: mach_vm.h,v 1.10 2002/12/11 21:23:37 manu Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||||
|
@ -164,6 +164,22 @@ typedef struct {
|
||||||
mach_msg_trailer_t rep_trailer;
|
mach_msg_trailer_t rep_trailer;
|
||||||
} mach_vm_protect_reply_t;
|
} mach_vm_protect_reply_t;
|
||||||
|
|
||||||
|
/* vm_inherit */
|
||||||
|
typedef struct {
|
||||||
|
mach_msg_header_t req_msgh;
|
||||||
|
mach_ndr_record_t req_ndr;
|
||||||
|
mach_vm_address_t req_addr;
|
||||||
|
mach_vm_size_t req_size;
|
||||||
|
mach_vm_inherit_t req_inh;
|
||||||
|
} mach_vm_inherit_request_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
mach_msg_header_t rep_msgh;
|
||||||
|
mach_ndr_record_t rep_ndr;
|
||||||
|
mach_kern_return_t rep_retval;
|
||||||
|
mach_msg_trailer_t rep_trailer;
|
||||||
|
} mach_vm_inherit_reply_t;
|
||||||
|
|
||||||
int mach_vm_map(struct proc *, mach_msg_header_t *,
|
int mach_vm_map(struct proc *, mach_msg_header_t *,
|
||||||
size_t, mach_msg_header_t *);
|
size_t, mach_msg_header_t *);
|
||||||
int mach_vm_allocate(struct proc *, mach_msg_header_t *,
|
int mach_vm_allocate(struct proc *, mach_msg_header_t *,
|
||||||
|
@ -174,5 +190,7 @@ int mach_vm_wire(struct proc *, mach_msg_header_t *,
|
||||||
size_t, mach_msg_header_t *);
|
size_t, mach_msg_header_t *);
|
||||||
int mach_vm_protect(struct proc *, mach_msg_header_t *,
|
int mach_vm_protect(struct proc *, mach_msg_header_t *,
|
||||||
size_t, mach_msg_header_t *);
|
size_t, mach_msg_header_t *);
|
||||||
|
int mach_vm_inherit(struct proc *, mach_msg_header_t *,
|
||||||
|
size_t, mach_msg_header_t *);
|
||||||
|
|
||||||
#endif /* _MACH_VM_H_ */
|
#endif /* _MACH_VM_H_ */
|
||||||
|
|
Loading…
Reference in New Issue