From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26996 invoked by alias); 5 Feb 2016 20:09:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 26981 invoked by uid 89); 5 Feb 2016 20:09:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00,KAM_ASCII_DIVIDERS,SPF_PASS autolearn=no version=3.3.2 spammy=*regs, Low, agent X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 05 Feb 2016 20:09:26 +0000 Received: from EUSAAHC003.ericsson.se (Unknown_Domain [147.117.188.81]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id D5.99.32102.E5105B65; Fri, 5 Feb 2016 21:09:03 +0100 (CET) Received: from [142.133.110.95] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.83) with Microsoft SMTP Server id 14.3.248.2; Fri, 5 Feb 2016 15:09:23 -0500 Subject: Re: [PATCH 4/8] Implement target_emit_ops To: Yao Qi , , Pierre Langlois References: <1442230282-20751-1-git-send-email-pierre.langlois@arm.com> <1442580184-22562-1-git-send-email-yao.qi@linaro.org> <1442580184-22562-5-git-send-email-yao.qi@linaro.org> From: Antoine Tremblay Message-ID: <56B50172.7040608@ericsson.com> Date: Fri, 05 Feb 2016 20:09:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1442580184-22562-5-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00157.txt.bz2 On 09/18/2015 08:43 AM, Yao Qi wrote: > From: Pierre Langlois > > This patch implements compiling agent expressions to native code for > AArch64. This allows us to compile conditions set on fast tracepoints. > > The compiled function has the following prologue: > > High *------------------------------------------------------* > | LR | > | FP | <- FP > | x1 (ULONGEST *value) | > | x0 (unsigned char *regs) | > Low *------------------------------------------------------* > > We save the function's argument on the stack as well as the return > address and the frame pointer. We then set the current frame pointer to > point to the previous one. > > The generated code for the expression will freely update the stack > pointer so we use the frame pointer to refer to `*value' and `*regs'. > `*value' needs to be accessed in the epilogue of the function, in order > to set it to whatever is on top of the stack. `*regs' needs to be passed > down to the `gdb_agent_get_reg' function with the `reg' operation. > > +static void > +aarch64_emit_prologue (void) > +{ > + uint32_t buf[16]; > + uint32_t *p = buf; > + > + /* This function emit a prologue for the following function prototype: > + > + e .... Hi, I'm working on adding JIT compiling of agent expressions for ARM and I've been looking at the aarch64 implementation. I'm wondering is there a reason we don't use gcc to generate the native bytecode like done on x86 ? x86 has a macro like so : #define EMIT_ASM(NAME, INSNS) do { extern unsigned char start_ ## NAME, end_ ## NAME; add_insns (&start_ ## NAME, &end_ ## NAME - &start_ ## NAME); __asm__ ("jmp end_" #NAME "\n" "\t" "start_" #NAME ":" "\t" INSNS "\n" "\t" "end_" #NAME ":"); } while (0) Could the same be done for armv7 or there's a reason that prevents it ? Same question for aarch64 ? Thanks, Antoine