Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat Fix a bug in io_registry_entry_get_property: one ...
details: https://anonhg.NetBSD.org/src/rev/607e689858a7
branches: trunk
changeset: 547127:607e689858a7
user: manu <manu%NetBSD.org@localhost>
date: Tue May 13 20:48:16 2003 +0000
description:
Fix a bug in io_registry_entry_get_property: one of the field in the
return packet was wrong (port descriptor instead of VM area descriptor),
thus leading to SIGSEGV when calling IOKit's IOFBCreateSharedCursor().
Now this is fixed we can move forward again on graphic mode.
diffstat:
sys/compat/darwin/darwin_ioframebuffer.c | 111 +++++++---------------
sys/compat/darwin/darwin_ioframebuffer.h | 3 +-
sys/compat/mach/mach_iokit.c | 151 ++++++++++++++++++++----------
sys/compat/mach/mach_iokit.h | 16 +-
4 files changed, 144 insertions(+), 137 deletions(-)
diffs (truncated from 395 to 300 lines):
diff -r efcfd24c1a41 -r 607e689858a7 sys/compat/darwin/darwin_ioframebuffer.c
--- a/sys/compat/darwin/darwin_ioframebuffer.c Tue May 13 15:49:26 2003 +0000
+++ b/sys/compat/darwin/darwin_ioframebuffer.c Tue May 13 20:48:16 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: darwin_ioframebuffer.c,v 1.4 2003/04/29 22:16:38 manu Exp $ */
+/* $NetBSD: darwin_ioframebuffer.c,v 1.5 2003/05/13 20:48:16 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.4 2003/04/29 22:16:38 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: darwin_ioframebuffer.c,v 1.5 2003/05/13 20:48:16 manu Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -57,88 +57,33 @@
#include <compat/darwin/darwin_ioframebuffer.h>
#include <compat/darwin/darwin_iokit.h>
+/* This is ugly, but we hope to see it going away quickly */
+
+static char darwin_iofbconfig[] = "<dict ID=\"0\"><key>IOFBModes</key><array ID=\"1\"><dict ID=\"2\"><key>AID</key><integer size=\"32\" ID=\"3\">0xee</integer><key>DM</key><data
ID=\"4\">AAACAAAAAYAAMgAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"5\">0x3e</integer></dict><dict ID=\"6\"><key>AID</key><integer size=\"32\"
ID=\"7\">0x82</integer><key>DM</key><data ID=\"8\">AAACAAAAAYAAPAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"9\">0x3</integer></dict><dict
ID=\"10\"><key>AID</key><integer size=\"32\" ID=\"11\">0xe8</integer><key>DM</key><data ID=\"12\">AAACAAAAAYAAPAAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\"
ID=\"13\">0x37</integer></dict><dict ID=\"14\"><key>DM</key><data ID=\"15\">AAACAAAAAYAARgAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\"
ID=\"16\">0x5</integer></dict><dict ID=\"17\"><key>AID</key><reference IDREF=\"11\"/><key>DM</key><data ID=\"18\">AAACgAAAAeAAPAAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer
size=\"32\" ID=\"19\">0x38</integer></dict><dict ID=\"20\"><key>AID</key><reference IDREF=\"3\"/><key>DM</key><data
ID=\"21\">AAACgAAAAeAAMgAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"22\">0x3f</integer></dict><dict ID=\"23\"><key>AID</key><integer size=\"32\"
ID=\"24\">0x96</integer><key>DM</key><data ID=\"25\">AAACgAAAAeAAPAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"26\">0x6</integer></dict><dict
ID=\"27\"><key>AID</key><integer size=\"32\" ID=\"28\">0x8c</integer><key>DM</key><data ID=\"29\">AAACgAAAAeAAQwAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\"
ID=\"30\">0x7</integer></dict><dict ID=\"31\"><key>AID</key><integer size=\"32\" ID=\"32\">0x98</integer><key>DM</key><data
ID=\"33\">AAACgAAAAeAASAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"34\">0x8</integer></dict><dict ID=\"35\"><key>AID</key><integer size=\"32\"
ID=\"36\">0x9a</integer><key>DM</key><data ID=\"37\">AAACgAAAAeAASwAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"38\">0x9</integer></dict><dict
ID=\"39\"><key>AID</key><integer size=\"32\" ID=\"40\">0x9e</integer><key>DM</key><data ID=\"41\">AAACgAAAAeAAVQAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\"
ID=\"42\">0xa</integer></dict><dict ID=\"43\"><key>AID</key><integer size=\"32\" ID=\"44\">0xa0</integer><key>DM</key><data
ID=\"45\">AAACgAAAA2YASwAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"46\">0xe</integer></dict><dict ID=\"47\"><key>AID</key><reference
IDREF=\"3\"/><key>DM</key><data ID=\"48\">AAAC0AAAAeAAMgAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"49\">0x4b</integer></dict><dict
ID=\"50\"><key>AID</key><reference IDREF=\"11\"/><key>DM</key><data ID=\"51\">AAAC0AAAAeAAPAAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\"
ID=\"52\">0x4d</integer></dict><dict ID=\"53\"><key>AID</key><reference IDREF=\"3\"/><key>DM</key><data ID=\"54\">AAAC0AAAAkAAMgAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer
size=\"32\" ID=\"55\">0x4c</integer></dict><dict ID=\"56\"><key>AID</key><reference IDREF=\"11\"/><key>DM</key><data
ID=\"57\">AAAC0AAAAkAAPAAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"58\">0x4e</integer></dict><dict ID=\"59\"><key>AID</key><reference
IDREF=\"3\"/><key>DM</key><data ID=\"60\">AAADIAAAAlgAMgAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"61\">0x40</integer></dict><dict
ID=\"62\"><key>AID</key><integer size=\"32\" ID=\"63\">0xb4</integer><key>DM</key><data ID=\"64\">AAADIAAAAlgAOAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\"
ID=\"65\">0xf</integer></dict><dict ID=\"66\"><key>AID</key><integer size=\"32\" ID=\"67\">0xb6</integer><key>DM</key><data
ID=\"68\">AAADIAAAAlgAPAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"69\">0x10</integer></dict><dict ID=\"70\"><key>AID</key><reference
IDREF=\"11\"/><key>DM</key><data ID=\"71\">AAADIAAAAlgAPAAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"72\">0x39</integer></dict><dict
ID=\"73\"><key>AID</key><integer size=\"32\" ID=\"74\">0x2a</integer><key>ID</key><integer size=\"32\" ID=\"75\">0x2d</integer><key>DF</key><integer size=\"32\"
ID=\"76\">0x400</integer><key>DM</key><data ID=\"77\">AAADIAAAAlgAAAAAAAAAAgAABAAAAAAAAAAAAAAAAAAAAAAA</data></dict><dict ID=\"78\"><key>DF</key><integer size=\"32\"
ID=\"79\">0x100</integer><key>DM</key><data ID=\"80\">AAADIAAAAlgAPAAAAAAAAgAAAQAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"81\">0x32</integer></dict><dict
ID=\"82\"><key>AID</key><integer size=\"32\" ID=\"83\">0xb8</integer><key>DM</key><data ID=\"84\">AAADIAAAAlgASAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\"
ID=\"85\">0x11</integer></dict><dict ID=\"86\"><key>AID</key><integer size=\"32\" ID=\"87\">0xba</integer><key>DM</key><data
ID=\"88\">AAADIAAAAlgASwAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"89\">0x12</integer></dict><dict ID=\"90\"><key>AID</key><reference
IDREF=\"74\"/><key>ID</key><integer size=\"32\" ID=\"91\">0x46</integer><key>DF</key><reference IDREF=\"76\"/><key>DM</key><reference IDREF=\"77\"/></dict><dict ID=\"92\"><key>AID</key><integer
size=\"32\" ID=\"93\">0xbc</integer><key>DM</key><data ID=\"94\">AAADIAAAAlgAVQAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"95\">0x13</integer></dict><dict
ID=\"96\"><key>AID</key><reference IDREF=\"3\"/><key>DM</key><data ID=\"97\">AAADQAAAAnAAMgAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\"
ID=\"98\">0x41</integer></dict><dict ID=\"99\"><key>AID</key><reference IDREF=\"11\"/><key>DM</key><data ID=\"100\">AAADQAAAAnAAPAAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer
size=\"32\" ID=\"101\">0x3a</integer></dict><dict ID=\"102\"><key>AID</key><integer size=\"32\" ID=\"103\">0xaa</integer><key>DM</key><data
ID=\"104\">AAADQAAAAnAASwAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"105\">0x17</integer></dict><dict ID=\"106\"><key>DM</key><data
ID=\"107\">AAADVAAAAoAAPAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"108\">0x18</integer></dict><dict ID=\"109\"><key>AID</key><integer size=\"32\"
ID=\"110\">0xbe</integer><key>DM</key><data ID=\"111\">AAAEAAAAAwAAPAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"112\">0x19</integer></dict><dict
ID=\"113\"><key>AID</key><reference IDREF=\"74\"/><key>ID</key><integer size=\"32\" ID=\"114\">0x2e</integer><key>DF</key><integer size=\"32\" ID=\"115\">0x407</integer><key>DM</key><data
ID=\"116\">AAAEAAAAAwAAAAAAAAAAAgAABAcAAAAAAAAAAAAAAAAAAAAA</data></dict><dict ID=\"117\"><key>AID</key><reference IDREF=\"110\"/><key>ID</key><integer size=\"32\"
ID=\"118\">0x33</integer><key>DF</key><reference IDREF=\"79\"/><key>DM</key><data ID=\"119\">AAAEAAAAAwAAPAAAAAAAAgAAAQAAAAAAAAAAAAAAAAAAAAAA</data></dict><dict ID=\"120\"><key>AID</key><integer
size=\"32\" ID=\"121\">0xc8</integer><key>DM</key><data ID=\"122\">AAAEAAAAAwAARgAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"123\">0x1a</integer></dict><dict
ID=\"124\"><key>AID</key><integer size=\"32\" ID=\"125\">0xcc</integer><key>DM</key><data ID=\"126\">AAAEAAAAAwAASwAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\"
ID=\"127\">0x1b</integer></dict><dict ID=\"128\"><key>AID</key><integer size=\"32\" ID=\"129\">0xd2</integer><key>DM</key><reference IDREF=\"126\"/><key>ID</key><integer size=\"32\"
ID=\"130\">0x1c</integer></dict><dict ID=\"131\"><key>AID</key><integer size=\"32\" ID=\"132\">0xd0</integer><key>DM</key><data
ID=\"133\">AAAEAAAAAwAAVQAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"134\">0x1d</integer></dict><dict ID=\"135\"><key>AID</key><integer size=\"32\"
ID=\"136\">0xdc</integer><key>DM</key><data ID=\"137\">AAAEgAAAA2YASwAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"138\">0x21</integer></dict><dict
ID=\"139\"><key>AID</key><integer size=\"32\" ID=\"140\">0xfa</integer><key>DM</key><data ID=\"141\">AAAFAAAAA8AASwAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\"
ID=\"142\">0x22</integer></dict><dict ID=\"143\"><key>AID</key><integer size=\"32\" ID=\"144\">0x104</integer><key>DM</key><data
ID=\"145\">AAAFAAAABAAAPAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\" ID=\"146\">0x23</integer></dict><dict ID=\"147\"><key>AID</key><integer size=\"32\"
ID=\"148\">0x106</integer><key>DM</key><data ID=\"149\">AAAFAAAABAAASwAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA</data><key>ID</key><integer size=\"32\"
ID=\"150\">0x24</integer></dict></array><key>IODisplayConnectFlags</key><integer size=\"32\" ID=\"151\">0x0</integer></dict>";
+
+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 },
+ { "graphic-options", "<integer size=\"32\" ID=\"0\">0x0</integer>"},
+ { "IOFBConfig", darwin_iofbconfig },
+ { "IOFBMemorySize",
+ "<integer size=\"32\" ID=\"0\">0x1000000</integer>"},
+ { NULL, 0}
+};
+
struct mach_iokit_devclass darwin_ioframebuffer_devclass = {
"<dict ID=\"0\"><key>IOProviderClass</key>"
"<string ID=\"1\">IOFramebuffer</string></dict>",
- "<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>",
- darwin_ioframebuffer_registry_entry_get_property,
+ darwin_ioframebuffer_properties,
+ darwin_ioframebuffer_properties_array,
darwin_ioframebuffer_connect_method_scalari_scalaro,
NULL,
"IOFramebuffer",
};
-struct mach_iokit_property darwin_ioframebuffer_properties[] = {
- { "IOFBDependentID", 0 },
- { "IOFBDependentIndex", 0},
- { "graphic-options", 0x28},
- { "IOFBConfig", 0x219f},
- { "IOFBMemorySize", 0x2e},
- { NULL, 0}
-};
-
-int
-darwin_ioframebuffer_registry_entry_get_property(args)
- struct mach_trap_args *args;
-{
- mach_io_registry_entry_get_property_request_t *req = args->smsg;
- mach_io_registry_entry_get_property_reply_t *rep = args->rmsg;
- size_t *msglen = args->rsize;
- struct lwp *l = args->l;
- struct mach_port *mp;
- struct mach_right *mr;
- struct mach_iokit_property *mip;
- size_t len;
-
-#ifdef DEBUG_DARWIN
- printf("darwin_ioframebuffer_registry_entry_get_property()\n");
-#endif
- len = strlen(mip->mip_name);
- for (mip = darwin_ioframebuffer_properties; mip->mip_name; mip++) {
- if (memcmp(mip->mip_name, req->req_propery_name, len) == 0)
- break;
- }
- if (mip->mip_value == 0)
- return mach_iokit_error(args, MACH_IOKIT_ENOENT);
-
- mp = mach_port_get();
- mp->mp_flags |= MACH_MP_INKERNEL;
- mr = mach_right_get(mp, l, MACH_PORT_TYPE_SEND, 0);
-
- 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_body.msgh_descriptor_count = 1;
- rep->rep_properties.name = (mach_port_t)mr->mr_name;
- rep->rep_properties.disposition = 0x11; /* XXX */
- rep->rep_properties_count = mip->mip_value;
- rep->rep_trailer.msgh_trailer_size = 8;
-
- *msglen = sizeof(*rep);
- return 0;
-}
int
darwin_ioframebuffer_connect_method_scalari_scalaro(args)
@@ -160,6 +105,20 @@
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));
return 0;
}
diff -r efcfd24c1a41 -r 607e689858a7 sys/compat/darwin/darwin_ioframebuffer.h
--- a/sys/compat/darwin/darwin_ioframebuffer.h Tue May 13 15:49:26 2003 +0000
+++ b/sys/compat/darwin/darwin_ioframebuffer.h Tue May 13 20:48:16 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: darwin_ioframebuffer.h,v 1.3 2003/03/09 18:33:29 manu Exp $ */
+/* $NetBSD: darwin_ioframebuffer.h,v 1.4 2003/05/13 20:48:16 manu Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -41,7 +41,6 @@
extern struct mach_iokit_devclass darwin_ioframebuffer_devclass;
-int darwin_ioframebuffer_registry_entry_get_property(struct mach_trap_args *);
int
darwin_ioframebuffer_connect_method_scalari_scalaro(struct mach_trap_args *);
diff -r efcfd24c1a41 -r 607e689858a7 sys/compat/mach/mach_iokit.c
--- a/sys/compat/mach/mach_iokit.c Tue May 13 15:49:26 2003 +0000
+++ b/sys/compat/mach/mach_iokit.c Tue May 13 20:48:16 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mach_iokit.c,v 1.14 2003/04/30 18:38:19 manu Exp $ */
+/* $NetBSD: mach_iokit.c,v 1.15 2003/05/13 20:48:16 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.14 2003/04/30 18:38:19 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_iokit.c,v 1.15 2003/05/13 20:48:16 manu Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -321,52 +321,6 @@
}
int
-mach_io_registry_entry_get_property(args)
- struct mach_trap_args *args;
-{
- mach_io_registry_entry_get_property_request_t *req = args->smsg;
- mach_io_registry_entry_get_property_reply_t *rep = args->rmsg;
- size_t *msglen = args->rsize;
- struct lwp *l = args->l;
- struct mach_port *mp;
- struct mach_right *mr;
- mach_port_t mn;
- 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_registry_entry_get_property == NULL)
- printf("no registry_entry_get_property method "
- "for darwin_iokit_class %s\n", mid->mid_name);
- else
- return (mid->mid_registry_entry_get_property)(args);
- }
-
- mp = mach_port_get();
- mp->mp_flags |= MACH_MP_INKERNEL;
- mr = mach_right_get(mp, l, MACH_PORT_TYPE_SEND, 0);
-
- 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;
- rep->rep_properties.name = (mach_port_t)mr->mr_name;
- rep->rep_properties.disposition = 0x11; /* XXX */
- rep->rep_properties_count = 1; /* XXX */
- rep->rep_trailer.msgh_trailer_size = 8;
-
- *msglen = sizeof(*rep);
- return 0;
-}
-
-int
mach_io_registry_entry_create_iterator(args)
struct mach_trap_args *args;
{
@@ -648,11 +602,12 @@
mid = mr->mr_port->mp_data;
if (mid->mid_properties == NULL)
return mach_iokit_error(args, MACH_IOKIT_EINVAL);
- size = round_page(strlen(mid->mid_properties));
+ size = strlen(mid->mid_properties);
va = vm_map_min(&l->l_proc->p_vmspace->vm_map);
- if ((error = uvm_map(&l->l_proc->p_vmspace->vm_map, &va, size,
- NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_ALL,
+ if ((error = uvm_map(&l->l_proc->p_vmspace->vm_map, &va,
+ round_page(size), NULL, UVM_UNKNOWN_OFFSET, 0,
+ UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_ALL,
UVM_INH_COPY, UVM_ADV_NORMAL, UVM_FLAG_COPYONW))) != 0)
return mach_msg_error(args, error);
@@ -688,6 +643,100 @@
}
int
+mach_io_registry_entry_get_property(args)
+ struct mach_trap_args *args;
+{
+ mach_io_registry_entry_get_property_request_t *req = args->smsg;
+ mach_io_registry_entry_get_property_reply_t *rep = args->rmsg;
+ size_t *msglen = args->rsize;
+ struct lwp *l = args->l;
+ int error;
+ vaddr_t va;
+ size_t size;
+ size_t len;
+ mach_port_t mn;
+ struct mach_right *mr;
+ struct mach_iokit_devclass *mid;
+ struct mach_iokit_property *mip;
+
+ /* We do not handle non zero offset and multiple names yet */
+ 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,
+ 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,
+ req->req_property_namecount);
+ return mach_iokit_error(args, MACH_IOKIT_EINVAL);
+ }
+
+ /* Find the port */
+ 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);
+
+ /* Find the devclass information */
+ if (mr->mr_port->mp_datatype != MACH_MP_IOKIT_DEVCLASS)
+ return mach_iokit_error(args, MACH_IOKIT_EINVAL);
+
+ mid = mr->mr_port->mp_data;
+ if (mid->mid_properties_array == NULL)
+ return mach_iokit_error(args, MACH_IOKIT_EINVAL);
+
+ /* Lookup the property name */
+ for (mip = mid->mid_properties_array; mip->mip_name; mip++) {
Home |
Main Index |
Thread Index |
Old Index