- Cleanup msg bits and trailer values
- a few dumb bug fixes
This commit is contained in:
parent
6f08fa6ecb
commit
d56caea9ae
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mach_host.c,v 1.5 2002/11/11 01:18:44 manu Exp $ */
|
||||
/* $NetBSD: mach_host.c,v 1.6 2002/11/11 09:28:00 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_host.c,v 1.5 2002/11/11 01:18:44 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_host.c,v 1.6 2002/11/11 09:28:00 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/malloc.h>
|
||||
@ -60,23 +60,28 @@ mach_host_info(p, msgh)
|
||||
{
|
||||
mach_host_info_request_t req;
|
||||
mach_host_info_reply_t rep;
|
||||
mach_host_info_reply_simple_t *reps;
|
||||
int error;
|
||||
int msglen;
|
||||
|
||||
if ((error = copyin(msgh, &req, sizeof(req))) != 0)
|
||||
return error;
|
||||
|
||||
bzero(&rep, sizeof(rep));
|
||||
|
||||
rep.rep_msgh.msgh_size = sizeof(rep);
|
||||
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;
|
||||
|
||||
msglen = sizeof(rep);
|
||||
|
||||
switch(req.req_flavor) {
|
||||
case MACH_HOST_BASIC_INFO: {
|
||||
struct mach_host_basic_info *info;
|
||||
|
||||
rep.rep_msgh.msgh_bits = 0x1200; /* XXX why? */
|
||||
|
||||
info = (struct mach_host_basic_info *)&rep.rep_data[0];
|
||||
info->max_cpus = 1; /* XXX fill this accurately */
|
||||
info->avail_cpus = 1;
|
||||
@ -87,8 +92,11 @@ mach_host_info(p, msgh)
|
||||
}
|
||||
|
||||
case MACH_HOST_MACH_MSG_TRAP:
|
||||
rep.rep_msgh.msgh_bits = 0x1200; /* XXX why? */
|
||||
rep.rep_msgh.msgh_size = 0x28; /* only headers, no data */
|
||||
reps = (mach_host_info_reply_simple_t *)&rep;
|
||||
reps->rep_msgh.msgh_size =
|
||||
sizeof(*reps) - sizeof(reps->rep_trailer);
|
||||
reps->rep_trailer.msgh_trailer_size = 8;
|
||||
msglen = sizeof(*reps);
|
||||
break;
|
||||
|
||||
case MACH_HOST_SCHED_INFO:
|
||||
@ -102,7 +110,7 @@ mach_host_info(p, msgh)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((error = copyout(&rep, msgh, rep.rep_msgh.msgh_size)) != 0)
|
||||
if ((error = copyout(&rep, msgh, msglen)) != 0)
|
||||
return error;
|
||||
|
||||
return 0;
|
||||
@ -123,11 +131,13 @@ mach_host_page_size(p, msgh)
|
||||
|
||||
bzero(&rep, sizeof(rep));
|
||||
|
||||
rep.rep_msgh.msgh_bits = 0x1200; /* XXX why? */
|
||||
rep.rep_msgh.msgh_size = sizeof(rep);
|
||||
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_page_size = PAGE_SIZE;
|
||||
rep.rep_trailer.msgh_trailer_size = 8;
|
||||
|
||||
if ((error = copyout(&rep, msgh, sizeof(rep))) != 0)
|
||||
return error;
|
||||
@ -143,14 +153,21 @@ mach_host_get_clock_service(p, msgh)
|
||||
mach_host_get_clock_service_reply_t rep;
|
||||
int error;
|
||||
|
||||
if ((error = copyin(msgh, &req, sizeof(req))) != 0)
|
||||
return error;
|
||||
|
||||
bzero(&rep, sizeof(rep));
|
||||
rep.rep_msgh.msgh_bits = 0x80001200; /* XXX why? */
|
||||
rep.rep_msgh.msgh_size = sizeof(rep);
|
||||
|
||||
rep.rep_msgh.msgh_bits =
|
||||
MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE) |
|
||||
MACH_MSGH_BITS_COMPLEX;
|
||||
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_body.msgh_descriptor_count = 1; /* XXX why? */
|
||||
rep.rep_clock_serv.name = 0x60b; /* XXX */
|
||||
rep.rep_clock_serv.disposition = 0x11; /* XXX */
|
||||
rep.rep_trailer.msgh_trailer_size = 8;
|
||||
|
||||
if ((error = copyout(&rep, msgh, sizeof(rep))) != 0)
|
||||
return error;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mach_host.h,v 1.3 2002/11/10 21:53:40 manu Exp $ */
|
||||
/* $NetBSD: mach_host.h,v 1.4 2002/11/11 09:28:00 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -67,6 +67,14 @@ typedef struct {
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_host_info_reply_t;
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t rep_msgh;
|
||||
mach_ndr_record_t rep_ndr;
|
||||
mach_kern_return_t rep_retval;
|
||||
mach_msg_type_number_t rep_count;
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_host_info_reply_simple_t;
|
||||
|
||||
#define MACH_HOST_BASIC_INFO 1
|
||||
#define MACH_HOST_SCHED_INFO 3
|
||||
#define MACH_HOST_RESOURCE_SIZES 4
|
||||
@ -117,6 +125,7 @@ typedef struct {
|
||||
mach_ndr_record_t rep_ndr;
|
||||
mach_kern_return_t rep_retval;
|
||||
mach_vm_size_t rep_page_size;
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_host_page_size_reply_t;
|
||||
|
||||
/* host_get_clock_service */
|
||||
@ -131,7 +140,7 @@ typedef struct {
|
||||
mach_msg_header_t rep_msgh;
|
||||
mach_msg_body_t rep_body;
|
||||
mach_msg_port_descriptor_t rep_clock_serv;
|
||||
mach_msg_trailer_t req_trailer;
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_host_get_clock_service_reply_t;
|
||||
|
||||
int mach_host_info __P((struct proc *, mach_msg_header_t *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mach_message.h,v 1.4 2002/11/10 21:53:40 manu Exp $ */
|
||||
/* $NetBSD: mach_message.h,v 1.5 2002/11/11 09:28:00 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -80,6 +80,7 @@ typedef unsigned int mach_msg_type_number_t;
|
||||
#define MACH_MSGH_BITS_COMPLEX 0x80000000
|
||||
#define MACH_MSGH_LOCAL_BITS(bits) (((bits) >> 8) & 0xff)
|
||||
#define MACH_MSGH_REMOTE_BITS(bits) ((bits) & 0xff)
|
||||
#define MACH_MSGH_REPLY_LOCAL_BITS(bits) (((bits) << 8) & 0xff00)
|
||||
|
||||
#define MACH_MSG_TYPE_MOVE_RECEIVE 16
|
||||
#define MACH_MSG_TYPE_MOVE_SEND 17
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mach_port.c,v 1.2 2002/11/10 22:05:35 manu Exp $ */
|
||||
/* $NetBSD: mach_port.c,v 1.3 2002/11/11 09:28:00 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_port.c,v 1.2 2002/11/10 22:05:35 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_port.c,v 1.3 2002/11/11 09:28:00 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -107,10 +107,13 @@ mach_port_deallocate(p, msgh)
|
||||
return error;
|
||||
|
||||
bzero(&rep, sizeof(rep));
|
||||
rep.rep_msgh.msgh_bits = 0x1200; /* XXX why? */
|
||||
rep.rep_msgh.msgh_size = sizeof(rep);
|
||||
|
||||
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;
|
||||
|
||||
if ((error = copyout(&rep, msgh, sizeof(rep))) != 0)
|
||||
return error;
|
||||
@ -130,11 +133,13 @@ mach_port_allocate(p, msgh)
|
||||
return error;
|
||||
|
||||
bzero(&rep, sizeof(rep));
|
||||
rep.rep_msgh.msgh_bits = 0x1200; /* XXX why? */
|
||||
rep.rep_msgh.msgh_size = sizeof(rep);
|
||||
|
||||
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 = 1811; /* XXX why? */
|
||||
rep.rep_trailer.msgh_trailer_size = 8;
|
||||
|
||||
if ((error = copyout(&rep, msgh, sizeof(rep))) != 0)
|
||||
return error;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mach_task.c,v 1.2 2002/11/10 22:05:35 manu Exp $ */
|
||||
/* $NetBSD: mach_task.c,v 1.3 2002/11/11 09:28:00 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_task.c,v 1.2 2002/11/10 22:05:35 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_task.c,v 1.3 2002/11/11 09:28:00 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -62,14 +62,17 @@ mach_task_get_special_port(p, msgh)
|
||||
return error;
|
||||
|
||||
bzero(&rep, sizeof(rep));
|
||||
rep.rep_msgh.msgh_bits = 0x8001200; /* XXX why? */
|
||||
rep.rep_msgh.msgh_size = sizeof(rep);
|
||||
|
||||
rep.rep_msgh.msgh_bits =
|
||||
MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE) |
|
||||
MACH_MSGH_BITS_COMPLEX;
|
||||
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_msgh_body.msgh_descriptor_count = 1; /* XXX why ? */
|
||||
rep.rep_special_port.name = 0x90f; /* XXX why? */
|
||||
rep.rep_special_port.disposition = 0x11; /* XXX why? */
|
||||
rep.rep_trailer.msgh_trailer_size = 8; /* XXX why? */
|
||||
rep.rep_trailer.msgh_trailer_size = 8;
|
||||
|
||||
if ((error = copyout(&rep, msgh, sizeof(rep))) != 0)
|
||||
return error;
|
||||
@ -89,8 +92,11 @@ mach_ports_lookup(p, msgh)
|
||||
return error;
|
||||
|
||||
bzero(&rep, sizeof(rep));
|
||||
rep.rep_msgh.msgh_bits = 0x8001200; /* XXX why? */
|
||||
rep.rep_msgh.msgh_size = sizeof(rep);
|
||||
|
||||
rep.rep_msgh.msgh_bits =
|
||||
MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE) |
|
||||
MACH_MSGH_BITS_COMPLEX;
|
||||
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_msgh_body.msgh_descriptor_count = 1; /* XXX why ? */
|
||||
@ -99,6 +105,7 @@ mach_ports_lookup(p, msgh)
|
||||
rep.rep_init_port_set.copy = 2; /* XXX why ? */
|
||||
rep.rep_init_port_set.disposition = 0x11; /* XXX why? */
|
||||
rep.rep_init_port_set.type = 2; /* XXX why? */
|
||||
rep.rep_trailer.msgh_trailer_size = 8;
|
||||
|
||||
if ((error = copyout(&rep, msgh, sizeof(rep))) != 0)
|
||||
return error;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mach_vm.c,v 1.3 2002/11/11 01:18:44 manu Exp $ */
|
||||
/* $NetBSD: mach_vm.c,v 1.4 2002/11/11 09:28:00 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_vm.c,v 1.3 2002/11/11 01:18:44 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_vm.c,v 1.4 2002/11/11 09:28:00 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -77,12 +77,12 @@ mach_vm_map(p, msgh)
|
||||
if ((error = sys_mmap(p, &cup, &rep.rep_retval)) != 0)
|
||||
rep.rep_retval = native_to_mach_errno[error];
|
||||
|
||||
rep.rep_msgh.msgh_bits = 0x1200; /* XXX why? */
|
||||
rep.rep_msgh.msgh_size = sizeof(rep);
|
||||
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_type = 0x80001513; /* XXX why? */
|
||||
rep.rep_trailer.msgh_trailer_size = 0x00000713; /* XXX why? */
|
||||
rep.rep_trailer.msgh_trailer_size = 8;
|
||||
|
||||
if ((error = copyout(&rep, msgh, sizeof(rep))) != 0)
|
||||
return error;
|
||||
@ -110,10 +110,12 @@ mach_vm_deallocate(p, msgh)
|
||||
if ((error = sys_munmap(p, &cup, &rep.rep_retval)) != 0)
|
||||
rep.rep_retval = native_to_mach_errno[error];
|
||||
|
||||
rep.rep_msgh.msgh_bits = 0x1200; /* XXX why? */
|
||||
rep.rep_msgh.msgh_size = sizeof(rep);
|
||||
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;
|
||||
|
||||
if ((error = copyout(&rep, msgh, sizeof(rep))) != 0)
|
||||
return error;
|
||||
|
Loading…
Reference in New Issue
Block a user