From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27373 invoked by alias); 5 Mar 2003 19:47:18 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 27366 invoked from network); 5 Mar 2003 19:47:18 -0000 Received: from unknown (HELO localhost.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 5 Mar 2003 19:47:18 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id D40082A9C for ; Wed, 5 Mar 2003 14:47:14 -0500 (EST) Message-ID: <3E665442.2070007@redhat.com> Date: Wed, 05 Mar 2003 19:47:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb@sources.redhat.com Subject: dummy frame on stack and SPARC Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-03/txt/msg00108.txt.bz2 (thinking out loud) The sparc architecture, when calling a struct return function has a sequence like: call struct_return_function, return address = pc + 8 nop .word sizeof returned object return_address: ... next instruction .... That is, the return address is several instructions beyond the call instruction and, more importantly, one of those "instructions" is an a word to inform the callee of additional ABI information (from memory, how much space the return structure needs). When correctly implemeting sparc dummy calls, this behavior needs to be implemented. Hence the call needs 2 words (the struct return size and the breakpoint)instead of just one (the breakpoint) and the code dummy no longer fits in _start. Conseqently, the SPARC, by default, pushes the code dummy on the stack. Problem is, this assumes that the target has an executable stack (security?). As a consequence, the SPARC either: - writes a two word code dummy onto the stack and correctly handls struct return - writes a one word code dummy into _start and fails when given a struct return function Instead of doing this, would it be possible to always write the code dummy onto the stack and, when the stack isn't executable, recognize the sigseg (?) as an attempt to return to the call dummy? The only thing I'm not sure about is exactly when a SPARC will recognize the segmentation violation and abort. It, thanks to the delayed branch code, could be a cycle too early :-( Andrew