More efforts on the XDarwin front. Introduce io_connect_method_scalari_structo
and io_connect_method_structi_structo. We don't know at all how this stuff works, but at least we can imitate what Darwin does.
This commit is contained in:
parent
5eaf3c3113
commit
31b52bb7f2
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: darwin_ioframebuffer.c,v 1.5 2003/05/13 20:48:16 manu Exp $ */
|
||||
/* $NetBSD: darwin_ioframebuffer.c,v 1.6 2003/05/14 14:41:05 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_ioframebuffer.c,v 1.5 2003/05/13 20:48:16 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_ioframebuffer.c,v 1.6 2003/05/14 14:41:05 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -63,7 +63,6 @@ static char darwin_iofbconfig[] = "<dict ID=\"0\"><key>IOFBModes</key><array ID=
|
||||
|
||||
static char darwin_ioframebuffer_properties[] = "<dict ID=\"0\"><key>IOClass</key><string ID=\"1\">AppleBacklightDisplay</string><key>IOProbeScore</key><integer size=\"32\" ID=\"2\">0xbb8</integer><key>IOProviderClass</key><string ID=\"3\">IODisplayConnect</string><key>CFBundleIdentifier</key><string ID=\"4\">com.apple.iokit.IOGraphicsFamily</string><key>IOMatchCategory</key><string ID=\"5\">IODefaultMatchCategory</string><key>IODisplayConnectFlags</key><data ID=\"6\">AAAIxA==</data><key>AppleDisplayType</key><integer size=\"32\" ID=\"7\">0x2</integer><key>AppleSense</key><integer size=\"32\" ID=\"8\">0x400</integer><key>DisplayVendorID</key><integer size=\"32\" ID=\"9\">0x756e6b6e</integer><key>DisplayProductID</key><integer size=\"32\" ID=\"10\">0x20000</integer><key>IODisplayParameters</key><dict ID=\"11\"><key>brightness</key><dict ID=\"12\"><key>max</key><integer size=\"32\" ID=\"13\">0x73</integer><key>min</key><integer size=\"32\" ID=\"14\">0x3a</integer><key>value</key><integer size=\"32\" ID=\"15\">0x7f</integer></dict><key>commit</key><dict ID=\"16\"><key>reg</key><integer size=\"32\" ID=\"17\">0x0</integer></dict></dict><key>IODisplayGUID</key><integer size=\"64\" ID=\"18\">0x610000000000000</integer><key>Power Management protected data</key><string ID=\"19\">{ theNumberOfPowerStates = 4, version 1, power state 0 = { capabilityFlags 00000000, outputPowerCharacter 00000000, inputPowerRequirement 00000000, staticPower 0, unbudgetedPower 0, powerToAttain 0, timeToAttain 0, settleUpTime 0, timeToLower 0, settleDownTime 0, powerDomainBudget 0 }, power state 1 = { capabilityFlags 00000000, outputPowerCharacter 00000000, inputPowerRequirement 00000000, staticPower 0, unbudgetedPower 0, powerToAttain 0, timeToAttain 0, settleUpTime 0, timeToLower 0, settleDownTime 0, powerDomainBudget 0 }, power state 2 = { capabilityFlags 00008000, outputPowerCharacter 00000000, inputPowerRequirement 00000002, staticPower 0, unbudgetedPower 0, powerToAttain 0, timeToAttain 0, settleUpTime 0, timeToLower 0, settleDownTime 0, powerDomainBudget 0 }, power state 3 = { capabilityFlags 0000c000, outputPowerCharacter 00000000, inputPowerRequirement 00000002, staticPower 0, unbudgetedPower 0, powerToAttain 0, timeToAttain 0, settleUpTime 0, timeToLower 0, settleDownTime 0, powerDomainBudget 0 }, aggressiveness = 0, myCurrentState = 0, parentsCurrentPowerFlags = 00000002, maxCapability = 3 }</string><key>Power Management private data</key><string ID=\"20\">{ this object = 0114c800, interested driver = 0114c800, driverDesire = 0, deviceDesire = 0, ourDesiredPowerState = 0, previousReqest = 0 }</string></dict>";
|
||||
|
||||
|
||||
struct mach_iokit_property darwin_ioframebuffer_properties_array[] = {
|
||||
{ "IOFBDependentID", NULL },
|
||||
{ "IOFBDependentIndex", NULL },
|
||||
@ -80,6 +79,8 @@ struct mach_iokit_devclass darwin_ioframebuffer_devclass = {
|
||||
darwin_ioframebuffer_properties,
|
||||
darwin_ioframebuffer_properties_array,
|
||||
darwin_ioframebuffer_connect_method_scalari_scalaro,
|
||||
darwin_ioframebuffer_connect_method_scalari_structo,
|
||||
darwin_ioframebuffer_connect_method_structi_structo,
|
||||
NULL,
|
||||
"IOFramebuffer",
|
||||
};
|
||||
@ -95,6 +96,176 @@ darwin_ioframebuffer_connect_method_scalari_scalaro(args)
|
||||
|
||||
#ifdef DEBUG_DARWIN
|
||||
printf("darwin_ioframebuffer_connect_method_scalari_scalaro()\n");
|
||||
printf("select = %d, incount = %d, in0 = %d, in1 = %d, in2 = %d\n",
|
||||
req->req_selector, req->req_incount, req->req_in[0],
|
||||
req->req_in[1], req->req_in[2]);
|
||||
printf("outcount = %d\n", req->req_in[req->req_incount]);
|
||||
#endif
|
||||
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_outcount = 0;
|
||||
|
||||
/*
|
||||
* XXX this is ugly, but we don't really know what we are doing here.
|
||||
*/
|
||||
if (req->req_in[0] == 0x00000003) {
|
||||
#ifdef DEBUG_MACH
|
||||
printf("flavor 1\n");
|
||||
#endif
|
||||
rep->rep_outcount = 1;
|
||||
rep->rep_outcount = 0;
|
||||
}
|
||||
|
||||
/* Called from main() */
|
||||
if ((req->req_selector == 0) && (req->req_in[0] == 0x2) &&
|
||||
(req->req_in[1] == 0x20) && (req->req_in[2] == 0x20) &&
|
||||
(req->req_in[req->req_incount] >= 0)) {
|
||||
#ifdef DEBUG_MACH
|
||||
printf("flavor 2\n");
|
||||
#endif
|
||||
rep->rep_outcount = 0;
|
||||
}
|
||||
|
||||
/* called from IOFramebufferServerOpen() */
|
||||
if ((req->req_selector == 0x2) &&
|
||||
(req->req_in[req->req_incount] >= 2)) {
|
||||
#ifdef DEBUG_MACH
|
||||
printf("flavor 3\n");
|
||||
#endif
|
||||
rep->rep_outcount = 2;
|
||||
rep->rep_out[0] = 0x2e;
|
||||
rep->rep_out[1] = 2;
|
||||
}
|
||||
|
||||
/* IOFBRebuild gives this */
|
||||
if ((req->req_selector == 0x12) && (req->req_in[0] == 0x6d726466) &&
|
||||
(req->req_in[req->req_incount] >= 1)) {
|
||||
#ifdef DEBUG_MACH
|
||||
printf("flavor 4\n");
|
||||
#endif
|
||||
rep->rep_outcount = 1;
|
||||
rep->rep_out[0] = 0;
|
||||
}
|
||||
rep->rep_out[rep->rep_outcount + 1] = 8; /* XXX Trailer */
|
||||
|
||||
*msglen = sizeof(*rep) - ((16 - rep->rep_outcount) * sizeof(int));
|
||||
rep->rep_msgh.msgh_size = *msglen - sizeof(rep->rep_trailer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
darwin_ioframebuffer_connect_method_scalari_structo(args)
|
||||
struct mach_trap_args *args;
|
||||
{
|
||||
mach_io_connect_method_scalari_structo_request_t *req = args->smsg;
|
||||
mach_io_connect_method_scalari_structo_reply_t *rep = args->rmsg;
|
||||
size_t *msglen = args->rsize;
|
||||
|
||||
#ifdef DEBUG_DARWIN
|
||||
printf("darwin_ioframebuffer_connect_method_scalari_structo()\n");
|
||||
printf("select = %d, incount = %d, in0 = %d, in1 = %d, in2 = %d\n",
|
||||
req->req_selector, req->req_incount, req->req_in[0],
|
||||
req->req_in[1], req->req_in[2]);
|
||||
printf("outcount = %d\n", req->req_in[req->req_incount]);
|
||||
#endif
|
||||
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_outcount = 0;
|
||||
|
||||
/*
|
||||
* XXX this is ugly, but we don't really know what we are doing here.
|
||||
*/
|
||||
/* IOFBGetPixelInformation gives this */
|
||||
if ((req->req_selector == 1) && (req->req_incount == 3) &&
|
||||
(req->req_in[0] == 0x2e) &&
|
||||
(req->req_in[1] == 0x0) &&
|
||||
(req->req_in[2] == 0x0) &&
|
||||
(req->req_in[req->req_incount] >= 0xac)) { /* req_outcount */
|
||||
#ifdef DEBUG_MACH
|
||||
printf("flavor 1\n");
|
||||
#endif
|
||||
rep->rep_outcount = req->req_in[req->req_incount];
|
||||
memset(&rep->rep_out[0], 0, rep->rep_outcount * sizeof(int));
|
||||
rep->rep_out[2] = 0x4;
|
||||
rep->rep_out[11] = 0x8;
|
||||
rep->rep_out[19] = 0x1;
|
||||
rep->rep_out[23] = 0x8;
|
||||
rep->rep_out[27] = 0xff;
|
||||
rep->rep_out[88] = 0x50;
|
||||
rep->rep_out[89] = 0x50;
|
||||
rep->rep_out[90] = 0x50;
|
||||
rep->rep_out[91] = 0x50;
|
||||
rep->rep_out[92] = 0x50;
|
||||
rep->rep_out[93] = 0x50;
|
||||
rep->rep_out[94] = 0x50;
|
||||
rep->rep_out[95] = 0x50;
|
||||
rep->rep_out[158] = 0x4;
|
||||
rep->rep_out[162] = 0x3;
|
||||
}
|
||||
|
||||
/* IOFBGetPixelInformation gives this too */
|
||||
if ((req->req_selector == 1) && (req->req_incount == 3) &&
|
||||
(req->req_in[0] == 0x2e) &&
|
||||
(req->req_in[1] == 0x1) &&
|
||||
(req->req_in[2] == 0x0) &&
|
||||
(req->req_in[req->req_incount] >= 0xac)) { /* req_outcount */
|
||||
#ifdef DEBUG_MACH
|
||||
printf("flavor 1\n");
|
||||
#endif
|
||||
rep->rep_outcount = req->req_in[req->req_incount];
|
||||
memset(&rep->rep_out[0], 0, rep->rep_outcount * sizeof(int));
|
||||
rep->rep_out[2] = 0x8;
|
||||
rep->rep_out[11] = 0x10;
|
||||
rep->rep_out[15] = 0x2;
|
||||
rep->rep_out[19] = 0x3;
|
||||
rep->rep_out[23] = 0x5;
|
||||
rep->rep_out[26] = 0x7c;
|
||||
rep->rep_out[30] = 0x3;
|
||||
rep->rep_out[31] = 0xe0;
|
||||
rep->rep_out[35] = 0x1f;
|
||||
rep->rep_out[88] = 0x2d;
|
||||
rep->rep_out[89] = 0x52;
|
||||
rep->rep_out[90] = 0x52;
|
||||
rep->rep_out[91] = 0x52;
|
||||
rep->rep_out[92] = 0x52;
|
||||
rep->rep_out[93] = 0x52;
|
||||
rep->rep_out[94] = 0x47;
|
||||
rep->rep_out[95] = 0x47;
|
||||
rep->rep_out[96] = 0x47;
|
||||
rep->rep_out[97] = 0x47;
|
||||
rep->rep_out[98] = 0x47;
|
||||
rep->rep_out[99] = 0x42;
|
||||
rep->rep_out[99] = 0x42;
|
||||
rep->rep_out[100] = 0x42;
|
||||
rep->rep_out[101] = 0x42;
|
||||
rep->rep_out[102] = 0x42;
|
||||
rep->rep_out[103] = 0x42;
|
||||
rep->rep_out[158] = 0x4;
|
||||
rep->rep_out[162] = 0x3;
|
||||
}
|
||||
rep->rep_out[rep->rep_outcount + 7] = 8; /* XXX Trailer */
|
||||
|
||||
*msglen = sizeof(*rep) - (4096 - rep->rep_outcount);
|
||||
rep->rep_msgh.msgh_size = *msglen - sizeof(rep->rep_trailer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
darwin_ioframebuffer_connect_method_structi_structo(args)
|
||||
struct mach_trap_args *args;
|
||||
{
|
||||
mach_io_connect_method_structi_structo_request_t *req = args->smsg;
|
||||
mach_io_connect_method_structi_structo_reply_t *rep = args->rmsg;
|
||||
size_t *msglen = args->rsize;
|
||||
|
||||
#ifdef DEBUG_DARWIN
|
||||
printf("darwin_ioframebuffer_connect_method_structi_structo()\n");
|
||||
#endif
|
||||
rep->rep_msgh.msgh_bits =
|
||||
MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE);
|
||||
@ -105,20 +276,7 @@ darwin_ioframebuffer_connect_method_scalari_scalaro(args)
|
||||
rep->rep_out[0] = 1;
|
||||
rep->rep_out[rep->rep_outcount + 1] = 8; /* XXX Trailer */
|
||||
|
||||
/*
|
||||
* XXX this is ugly, but we don't really know what we are doing here.
|
||||
*/
|
||||
rep->rep_outcount = 1;
|
||||
rep->rep_out[0] = 1;
|
||||
if (req->req_in[0] == 0x00000003) {
|
||||
rep->rep_outcount = 0;
|
||||
}
|
||||
if (req->req_in[0] == 0x6d726466) {
|
||||
rep->rep_outcount = 1;
|
||||
rep->rep_out[0] = 0;
|
||||
}
|
||||
rep->rep_out[rep->rep_outcount + 1] = 8; /* XXX Trailer */
|
||||
|
||||
*msglen = sizeof(*rep) - ((4096 + rep->rep_outcount) * sizeof(int));
|
||||
*msglen = sizeof(*rep) - (4096 - rep->rep_outcount);
|
||||
rep->rep_msgh.msgh_size = *msglen - sizeof(rep->rep_trailer);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: darwin_ioframebuffer.h,v 1.4 2003/05/13 20:48:16 manu Exp $ */
|
||||
/* $NetBSD: darwin_ioframebuffer.h,v 1.5 2003/05/14 14:41:05 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -43,5 +43,9 @@ extern struct mach_iokit_devclass darwin_ioframebuffer_devclass;
|
||||
|
||||
int
|
||||
darwin_ioframebuffer_connect_method_scalari_scalaro(struct mach_trap_args *);
|
||||
int
|
||||
darwin_ioframebuffer_connect_method_scalari_structo(struct mach_trap_args *);
|
||||
int
|
||||
darwin_ioframebuffer_connect_method_structi_structo(struct mach_trap_args *);
|
||||
|
||||
#endif /* _DARWIN_IOFRAMEBUFFER_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: darwin_iohidsystem.c,v 1.4 2003/04/29 22:16:38 manu Exp $ */
|
||||
/* $NetBSD: darwin_iohidsystem.c,v 1.5 2003/05/14 14:41:05 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_iohidsystem.c,v 1.4 2003/04/29 22:16:38 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_iohidsystem.c,v 1.5 2003/05/14 14:41:05 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -72,6 +72,8 @@ struct mach_iokit_devclass darwin_iohidsystem_devclass = {
|
||||
NULL,
|
||||
NULL,
|
||||
darwin_iohidsystem_connect_method_scalari_scalaro,
|
||||
NULL,
|
||||
NULL,
|
||||
darwin_iohidsystem_connect_map_memory,
|
||||
"IOHIDSystem",
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mach_iokit.c,v 1.15 2003/05/13 20:48:16 manu Exp $ */
|
||||
/* $NetBSD: mach_iokit.c,v 1.16 2003/05/14 14:41:04 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include "opt_compat_darwin.h"
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_iokit.c,v 1.15 2003/05/13 20:48:16 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_iokit.c,v 1.16 2003/05/14 14:41:04 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -602,7 +602,7 @@ mach_io_registry_entry_get_properties(args)
|
||||
mid = mr->mr_port->mp_data;
|
||||
if (mid->mid_properties == NULL)
|
||||
return mach_iokit_error(args, MACH_IOKIT_EINVAL);
|
||||
size = strlen(mid->mid_properties);
|
||||
size = strlen(mid->mid_properties) + 1; /* Include trailing zero */
|
||||
|
||||
va = vm_map_min(&l->l_proc->p_vmspace->vm_map);
|
||||
if ((error = uvm_map(&l->l_proc->p_vmspace->vm_map, &va,
|
||||
@ -659,19 +659,24 @@ mach_io_registry_entry_get_property(args)
|
||||
struct mach_iokit_devclass *mid;
|
||||
struct mach_iokit_property *mip;
|
||||
|
||||
/* We do not handle non zero offset and multiple names yet */
|
||||
#ifdef DEBUG_MACH
|
||||
/*
|
||||
* We do not handle non zero offset and multiple names,
|
||||
* but it seems that Darwin binaries just jold random values
|
||||
* in theses fields. We have yet to see a real use of
|
||||
* non null offset / multiple names.
|
||||
*/
|
||||
if (req->req_property_nameoffset != 0) {
|
||||
printf("pid %d.%d: mach_io_registry_entry_get_property "
|
||||
"offset = %d\n", l->l_proc->p_pid, l->l_lid,
|
||||
"offset = %d (ignoring)\n", l->l_proc->p_pid, l->l_lid,
|
||||
req->req_property_nameoffset);
|
||||
return mach_iokit_error(args, MACH_IOKIT_EINVAL);
|
||||
}
|
||||
if (req->req_property_namecount != 1) {
|
||||
printf("pid %d.%d: mach_io_registry_entry_get_property "
|
||||
"count = %d\n", l->l_proc->p_pid, l->l_lid,
|
||||
"count = %d (ignoring)\n", l->l_proc->p_pid, l->l_lid,
|
||||
req->req_property_namecount);
|
||||
return mach_iokit_error(args, MACH_IOKIT_EINVAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Find the port */
|
||||
mn = req->req_msgh.msgh_remote_port;
|
||||
@ -697,7 +702,7 @@ mach_io_registry_entry_get_property(args)
|
||||
|
||||
/* And copyout its associated value */
|
||||
va = vm_map_min(&l->l_proc->p_vmspace->vm_map);
|
||||
size = strlen(mip->mip_value);
|
||||
size = strlen(mip->mip_value) + 1; /* Include trailing zero */
|
||||
|
||||
if ((error = uvm_map(&l->l_proc->p_vmspace->vm_map, &va,
|
||||
round_page(size), NULL, UVM_UNKNOWN_OFFSET, 0,
|
||||
@ -729,7 +734,7 @@ mach_io_registry_entry_get_property(args)
|
||||
rep->rep_properties.copy = 2; /* XXX */
|
||||
rep->rep_properties.pad1 = 0; /* XXX */
|
||||
rep->rep_properties.type = 0; /* XXX */
|
||||
rep->rep_properties_count = 1;
|
||||
rep->rep_properties_count = size;
|
||||
rep->rep_trailer.msgh_trailer_size = 8;
|
||||
|
||||
*msglen = sizeof(*rep);
|
||||
@ -860,3 +865,98 @@ mach_io_iterator_reset(args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
mach_io_connect_method_scalari_structo(args)
|
||||
struct mach_trap_args *args;
|
||||
{
|
||||
mach_io_connect_method_scalari_structo_request_t *req = args->smsg;
|
||||
mach_io_connect_method_scalari_structo_reply_t *rep = args->rmsg;
|
||||
size_t *msglen = args->rsize;
|
||||
struct lwp *l = args->l;
|
||||
mach_port_t mn;
|
||||
struct mach_right *mr;
|
||||
struct mach_iokit_devclass *mid;
|
||||
|
||||
mn = req->req_msgh.msgh_remote_port;
|
||||
if ((mr = mach_right_check(mn, l, MACH_PORT_TYPE_ALL_RIGHTS)) == NULL)
|
||||
return mach_iokit_error(args, MACH_IOKIT_EPERM);
|
||||
|
||||
if (mr->mr_port->mp_datatype == MACH_MP_IOKIT_DEVCLASS) {
|
||||
mid = mr->mr_port->mp_data;
|
||||
if (mid->mid_connect_method_scalari_structo == NULL)
|
||||
printf("no connect_method_scalari_structo method "
|
||||
"for darwin_iokit_class %s\n", mid->mid_name);
|
||||
else
|
||||
return (mid->mid_connect_method_scalari_structo)(args);
|
||||
}
|
||||
|
||||
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_outcount = 0;
|
||||
rep->rep_out[rep->rep_outcount + 1] = 8; /* XXX Trailer */
|
||||
|
||||
*msglen = sizeof(*rep) - ((4096 + rep->rep_outcount) * sizeof(int));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
mach_io_connect_method_structi_structo(args)
|
||||
struct mach_trap_args *args;
|
||||
{
|
||||
mach_io_connect_method_structi_structo_request_t *req = args->smsg;
|
||||
mach_io_connect_method_structi_structo_reply_t *rep = args->rmsg;
|
||||
size_t *msglen = args->rsize;
|
||||
struct lwp *l = args->l;
|
||||
mach_port_t mn;
|
||||
struct mach_right *mr;
|
||||
struct mach_iokit_devclass *mid;
|
||||
|
||||
mn = req->req_msgh.msgh_remote_port;
|
||||
if ((mr = mach_right_check(mn, l, MACH_PORT_TYPE_ALL_RIGHTS)) == NULL)
|
||||
return mach_iokit_error(args, MACH_IOKIT_EPERM);
|
||||
|
||||
if (mr->mr_port->mp_datatype == MACH_MP_IOKIT_DEVCLASS) {
|
||||
mid = mr->mr_port->mp_data;
|
||||
if (mid->mid_connect_method_structi_structo == NULL)
|
||||
printf("no connect_method_structi_structo method "
|
||||
"for darwin_iokit_class %s\n", mid->mid_name);
|
||||
else
|
||||
return (mid->mid_connect_method_structi_structo)(args);
|
||||
}
|
||||
|
||||
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_outcount = 0;
|
||||
rep->rep_out[rep->rep_outcount + 1] = 8; /* XXX Trailer */
|
||||
|
||||
*msglen = sizeof(*rep) - ((4096 + rep->rep_outcount) * sizeof(int));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
mach_io_connect_set_properties(args)
|
||||
struct mach_trap_args *args;
|
||||
{
|
||||
mach_io_connect_set_properties_request_t *req = args->smsg;
|
||||
mach_io_connect_set_properties_reply_t *rep = args->rmsg;
|
||||
size_t *msglen = args->rsize;
|
||||
struct lwp *l = args->l;
|
||||
|
||||
printf("pid %d.%d: mach_io_connect_set_properties\n",
|
||||
l->l_proc->p_pid, l->l_lid);
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mach_iokit.h,v 1.12 2003/05/13 20:48:16 manu Exp $ */
|
||||
/* $NetBSD: mach_iokit.h,v 1.13 2003/05/14 14:41:04 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -104,7 +104,7 @@ typedef struct {
|
||||
mach_ndr_record_t rep_ndr;
|
||||
mach_kern_return_t rep_retval;
|
||||
mach_msg_type_number_t rep_outcount;
|
||||
int rep_out[4096];
|
||||
int rep_out[16];
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_io_connect_method_scalari_scalaro_reply_t;
|
||||
|
||||
@ -373,6 +373,65 @@ typedef struct {
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_io_iterator_reset_reply_t;
|
||||
|
||||
/* io_connect_set_properties */
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t req_msgh;
|
||||
mach_msg_body_t req_body;
|
||||
mach_msg_ool_descriptor_t req_properties;
|
||||
mach_ndr_record_t req_ndr;
|
||||
mach_msg_type_number_t req_count;
|
||||
} mach_io_connect_set_properties_request_t;
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t rep_msgh;
|
||||
mach_ndr_record_t rep_ndr;
|
||||
mach_kern_return_t rep_retval;
|
||||
mach_natural_t rep_result;
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_io_connect_set_properties_reply_t;
|
||||
|
||||
/* io_connect_method_scalari_structo */
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t req_msgh;
|
||||
mach_ndr_record_t req_ndr;
|
||||
int req_selector;
|
||||
mach_msg_type_number_t req_incount;
|
||||
int req_in[16];
|
||||
mach_msg_type_number_t req_outcount;
|
||||
} mach_io_connect_method_scalari_structo_request_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_outcount;
|
||||
char rep_out[4096];
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_io_connect_method_scalari_structo_reply_t;
|
||||
|
||||
/* io_connect_method_structi_structo */
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t req_msgh;
|
||||
mach_ndr_record_t req_ndr;
|
||||
int req_selector;
|
||||
mach_msg_type_number_t req_incount;
|
||||
int req_in[4096];
|
||||
mach_msg_type_number_t req_outcount;
|
||||
|
||||
} mach_io_connect_method_structi_structo_request_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_outcount;
|
||||
char rep_out[4096];
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_io_connect_method_structi_structo_reply_t;
|
||||
|
||||
int mach_io_service_get_matching_services(struct mach_trap_args *);
|
||||
int mach_io_iterator_next(struct mach_trap_args *);
|
||||
int mach_io_service_open(struct mach_trap_args *);
|
||||
@ -392,6 +451,9 @@ int mach_io_registry_entry_get_properties(struct mach_trap_args *);
|
||||
int mach_io_registry_entry_get_path(struct mach_trap_args *);
|
||||
int mach_io_connect_map_memory(struct mach_trap_args *);
|
||||
int mach_io_iterator_reset(struct mach_trap_args *);
|
||||
int mach_io_connect_set_properties(struct mach_trap_args *);
|
||||
int mach_io_connect_method_scalari_structo(struct mach_trap_args *);
|
||||
int mach_io_connect_method_structi_structo(struct mach_trap_args *);
|
||||
|
||||
extern struct mach_iokit_devclass *mach_iokit_devclasses[];
|
||||
|
||||
@ -410,6 +472,8 @@ struct mach_iokit_devclass {
|
||||
char *mid_properties;
|
||||
struct mach_iokit_property *mid_properties_array;
|
||||
int (*mid_connect_method_scalari_scalaro)(struct mach_trap_args *);
|
||||
int (*mid_connect_method_scalari_structo)(struct mach_trap_args *);
|
||||
int (*mid_connect_method_structi_structo)(struct mach_trap_args *);
|
||||
int (*mid_connect_map_memory)(struct mach_trap_args *);
|
||||
char *mid_name;
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mach_namemap.c,v 1.25 2003/04/30 07:32:17 manu Exp $ */
|
||||
/* $NetBSD: mach_namemap.c,v 1.26 2003/05/14 14:41:05 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.25 2003/04/30 07:32:17 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.26 2003/05/14 14:41:05 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -84,8 +84,13 @@ struct mach_subsystem_namemap mach_namemap[] = {
|
||||
{ 2818, mach_io_connect_set_notification_port,
|
||||
"io_connect_set_notification_port" },
|
||||
{ 2819, mach_io_connect_map_memory, "io_connect_map_memory" },
|
||||
{ 2821, mach_io_connect_set_properties, "io_connect_set_properties" },
|
||||
{ 2822, mach_io_connect_method_scalari_scalaro,
|
||||
"io_connect_method_scalari_scalaro" },
|
||||
{ 2823, mach_io_connect_method_scalari_structo,
|
||||
"io_connect_method_scalari_structo" },
|
||||
{ 2825, mach_io_connect_method_structi_structo,
|
||||
"io_connect_method_structi_structo" },
|
||||
{ 2826, mach_io_registry_entry_get_path,
|
||||
"io_registry_entry_get_path" },
|
||||
{ 2827, mach_io_registry_get_root_entry,
|
||||
|
Loading…
Reference in New Issue
Block a user