From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=38406 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTsck-0002hB-7H for qemu-devel@nongnu.org; Wed, 30 Jun 2010 04:26:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OTsce-0001lI-BF for qemu-devel@nongnu.org; Wed, 30 Jun 2010 04:26:24 -0400 Received: from cantor2.suse.de ([195.135.220.15]:59978 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OTsce-0001l3-06 for qemu-devel@nongnu.org; Wed, 30 Jun 2010 04:26:20 -0400 Subject: Re: [Qemu-devel] [PATCH] AppleSMC device emulation Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: multipart/alternative; boundary=Apple-Mail-28--1068534178 From: Alexander Graf In-Reply-To: Date: Wed, 30 Jun 2010 10:26:16 +0200 Message-Id: <1966955F-EF05-4F2C-B2FF-5228AF486528@suse.de> References: <1277822152-6715-1-git-send-email-agraf@suse.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: suse@csgraf.de, qemu-devel@nongnu.org --Apple-Mail-28--1068534178 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 29.06.2010, at 20:38, Blue Swirl wrote: > On Tue, Jun 29, 2010 at 2:35 PM, Alexander Graf wrote: >> Intel Macs have a chip called the "AppleSMC" which they use to = control >> certain Apple specific parts of the hardware, like the keyboard = background >> light. >>=20 >> That chip is also used to store a key that Mac OS X uses to decrypt = binaries. >>=20 >> This patch adds emulation for that chip, so we're getting one step = further >> to having Mac OS X run natively on Qemu. >>=20 >> Signed-off-by: Alexander Graf >> --- >> Makefile.target | 2 +- >> hw/applesmc.c | 225 = +++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 226 insertions(+), 1 deletions(-) >> create mode 100644 hw/applesmc.c >>=20 >>=20 [...] >>=20 >> +#ifdef DEBUG_SMC >> +#define smc_debug(...) printf(__VA_ARGS__) >=20 > How about: > #define smc_debug(fmt, ...) printf("APPLESMC: " fmt, ## __VA_ARGS__) Well, I went with smc_debug(...) fprintf(stderr, "APPLESMC: " = __VA_ARGS__). That way you can do fun things like smc_debug("Hello = World"); :) [...] >>=20 >> + >> + applesmc_add_key(s, "REV ", 6, = "\0x01\0x13\0x0f\0x00\0x00\0x03"); >> + applesmc_add_key(s, "OSK0", 32, s->osk); >> + applesmc_add_key(s, "OSK1", 32, s->osk + 32); >> + applesmc_add_key(s, "NATJ", 1, "\0"); >> + applesmc_add_key(s, "MSSP", 1, "\0"); >> + applesmc_add_key(s, "MSSD", 1, "\0x3"); >=20 > Please add a reset function which sets these, possibly freeing the old > keys. That is, if it is the correct action in reset. Hrm. I guess it's the closest thing to "correct". Alex --Apple-Mail-28--1068534178 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
On = Tue, Jun 29, 2010 at 2:35 PM, Alexander Graf <agraf@suse.de> = wrote:
Intel Macs have a chip called the = "AppleSMC" which they use to control
certain Apple specific parts of the hardware, like the = keyboard background
light.

That chip is = also used to store a key that Mac OS X uses to decrypt = binaries.

This patch adds = emulation for that chip, so we're getting one step = further
to having Mac OS X run = natively on Qemu.

Signed-off-by: = Alexander Graf <agraf@suse.de>
---
 Makefile.target |    2 = +-
 hw/applesmc.c   = |  225 = +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 226 insertions(+), 1 = deletions(-)
 create mode = 100644 hw/applesmc.c


[...]

+#ifdef = DEBUG_SMC
+#define = smc_debug(...) printf(__VA_ARGS__)

How = about:
#define smc_debug(fmt, ...) printf("APPLESMC: " fmt, ## = __VA_ARGS__)

Well, I went with = smc_debug(...) fprintf(stderr, "APPLESMC: " __VA_ARGS__). That way you = can do fun things like smc_debug("Hello = World");

:)

[...]
<= br>

+
+   =  applesmc_add_key(s, "REV ", 6, = "\0x01\0x13\0x0f\0x00\0x00\0x03");
+    applesmc_add_key(s, "OSK0", 32, = s->osk);
+   =  applesmc_add_key(s, "OSK1", 32, s->osk + = 32);
+   =  applesmc_add_key(s, "NATJ", 1, "\0");
+    applesmc_add_key(s, "MSSP", 1, = "\0");
+   =  applesmc_add_key(s, "MSSD", 1, "\0x3");

Please = add a reset function which sets these, possibly freeing the old
keys. = That is, if it is the correct action in = reset.

Hrm. I guess it's the = closest thing to = "correct".

Alex

= = --Apple-Mail-28--1068534178--