From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6861 invoked by alias); 28 May 2009 18:18:24 -0000 Received: (qmail 6853 invoked by uid 22791); 28 May 2009 18:18:23 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_43 X-Spam-Check-By: sourceware.org Received: from web111617.mail.gq1.yahoo.com (HELO web111617.mail.gq1.yahoo.com) (67.195.23.104) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Thu, 28 May 2009 18:18:18 +0000 Received: (qmail 98171 invoked by uid 60001); 28 May 2009 18:18:15 -0000 Message-ID: <353851.97620.qm@web111617.mail.gq1.yahoo.com> Received: from [70.98.240.34] by web111617.mail.gq1.yahoo.com via HTTP; Thu, 28 May 2009 11:18:15 PDT References: <516867.32690.qm@web111606.mail.gq1.yahoo.com> Date: Thu, 28 May 2009 20:59:00 -0000 From: Jamie Prescott Subject: Re: Forgetting return values To: Adam Nemet Cc: gcc@gcc.gnu.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-05/txt/msg00662.txt.bz2 > From: Adam Nemet > To: Jamie Prescott > Cc: gcc@gcc.gnu.org > Sent: Thursday, May 28, 2009 11:10:49 AM > Subject: Re: Forgetting return values > > Jamie Prescott writes: > > static inline int set_prop(char const *path, char const *name, > > void const *data, int size) > > { > > int error; > > > > asm volatile ("int\t11\n\t" > > : "=a0" (error): "a0" (path), "a1" (name), "a2" (data), > > "a3" (size)); > > > > return error; > > } > > > > extern int calc(int); > > > > int proc(int i) > > { > > int j = calc(i); > > > > return set_prop(0, 0, &j, sizeof(int)); > > } > ... > > > > Why is the memory clobber required, and why GCC does not understand to > > sync the value to memory when passing the address to a function? > > Because you never inform GCC that you will use the value at > address *NAME. Try to use "m"(*name) rather than "a1"(name) in the asm. That's 'data', not 'name'. But OK, got it. unfortunately, I cannot use "m" since that value need to go into a specific register. Any other solution? - Jamie