Received: from eggs.gnu.org ([2001:4830:134:3::10]:55238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmKld-0002Xg-Bc for qemu-devel@nongnu.org; Tue, 20 Sep 2016 09:07:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmKlY-0004Bg-Ex for qemu-devel@nongnu.org; Tue, 20 Sep 2016 09:07:20 -0400 In-Reply-To: <1474362073.2857.59.camel@kernel.crashing.org> References: <1474362073.2857.59.camel@kernel.crashing.org> Mime-Version: 1.0 (Apple Message framework v753.1) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: G 3 Date: Tue, 20 Sep 2016 09:07:01 -0400 Subject: Re: [Qemu-devel] [PATCH v2] add resolutions via command-line List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt Cc: "list@suse.de:PowerPC list:PowerPC" , qemu-devel qemu-devel On Sep 20, 2016, at 5:01 AM, Benjamin Herrenschmidt wrote: > On Tue, 2016-09-20 at 00:28 -0400, G 3 wrote: >> + RegEntryID *entry_id; >> + OSErr err; >> + OSStatus os_status = noErr; >> + Boolean is_done; >> + void *value; >> + RegPropertyValueSize property_size = -1; >> + int index, res_set_count; >> + char *set_str; >> + >> + #define PROPERTY_NAME "resolutions" >> + #define NODE_PATH "Devices:device-tree:options" >> + >> + /* init the entry variable */ >> + err = RegistryEntryIDInit(entry_id); >> + if (err != noErr) { >> + lprintf("Error: Failed to init entry variable! >> (Error: %d)\n", err); >> + return err; >> + } >> + is_done = false; >> + > > No, you need to allocate the RegistryEntryID on the stack otherwise > you are whacking at a random uninitialized pointer. IE: > > RegistryEntryID entry_id; > > RegistryEntryIDInit(&entry_id); > .../... > See if that helps with your OS X problem. Good catch. I missed that one. It didn't fix the problem. I think the options node isn't accessible for some reason in Mac OS X. > Also I don't like the > use of pow(), there must be a better way ... What did you have in mind? Do you want atoi() rewritten to exclude it? > Check if there's anything > of value to be picked up from DSL, otherwise, put those utilities > somewhere in common, other drivers might want them. What is DSL? Did you want me to put the pow() function in the MacDriverUtils.c file? > > (What does our lprintf implementation do for example ?) I think it prints to some virtual device. I'm not sure. I haven't figured out how to use it yet. If you could provide some directions I think I might be able to make it work.