From patchwork Fri Jun 3 02:36:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 69211 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp44940qgf; Thu, 2 Jun 2016 19:36:51 -0700 (PDT) X-Received: by 10.36.54.200 with SMTP id l191mr1934980itl.79.1464921410937; Thu, 02 Jun 2016 19:36:50 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id w2si2465474pay.144.2016.06.02.19.36.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 19:36:50 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-return-131902-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of gdb-patches-return-131902-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gdb-patches-return-131902-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; q=dns; s=default; b=Hy3Q5s+p7u02XjtVmdXXmDQcCLg18 Q+rldRWS7yzvzsksy1qohZjcRRxf5c81dTrW3Z1V/zqvE4ALgsseXx6Xjbo3BOoR ukzUvlw9I6ir3ZWCvs6I66neYlV21OTwt2a9iuhSYUH5Uy/sFt9Rt2SuHlL9iEKT Fqofar/f79YIn4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; s=default; bh=4Y6KGIi7OhY1pep45nj4oComWWs=; b=CiU cxv1JStDSYNxEPbTOAwfqwngpnLEeWfLBZKPCQgVKg2xYTt0DGYSPJV8G7nbQT1T M9asFFe8XDFU/EQop9D5cbrinn2FkNsQIPOUcnILhiKMTOFFkJAnEGo2+nDZ5Rpx nvV0SrnFJSuVllqrMw/M1YF/t6aQxjncqUIKsfkw= Received: (qmail 43745 invoked by alias); 3 Jun 2016 02:36:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 43729 invoked by uid 89); 3 Jun 2016 02:36:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=littleendian, shortly, team X-HELO: mail-oi0-f48.google.com Received: from mail-oi0-f48.google.com (HELO mail-oi0-f48.google.com) (209.85.218.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 03 Jun 2016 02:36:32 +0000 Received: by mail-oi0-f48.google.com with SMTP id k23so107171707oih.0 for ; Thu, 02 Jun 2016 19:36:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=8/Z89oJ0L/e5rzJCshmw+ILSfE3IiZ8JtKsF//wAtDg=; b=AbNL7WkovvnfjnAMu8Mfe0/c2EjrLAjy+mnutkRj9QhXr/5Qs3EXAa3+I1AnSTkned Si8e7mFO2kMbFPcc8N7bk3kIJqnieo5aDU5n7kDP5vxMHnki9IQbk9tSz4rhhGnrAffa gNI+ZVCaHny50p9Cpl9KtzYoIahTtAT0AcWdSJObTDf/BRMXjRettM9gsmWdr7bg+OmG kMLMzS/ddqwJQaBNqm6Zg3VRuqFAvILdWilc1mpmtj1yNSiYcF8B9b5EcksjRuAvewrm DAu0w1hBTT9+oWfJ53p0nBLeWINw97zep6hdwQuA18rh/neKQ746RSgSa/1tcKnDE5l0 oCJw== X-Gm-Message-State: ALyK8tIpgAXaf2TStkXDxKTTugQCi7mVleYvbqN4w1b3qYSMdwxU8Kp6VOMJ8ckVo3a/doUOU/lz9P2FUx2UAsKc MIME-Version: 1.0 X-Received: by 10.202.85.145 with SMTP id j139mr588487oib.100.1464921390313; Thu, 02 Jun 2016 19:36:30 -0700 (PDT) Received: by 10.157.35.91 with HTTP; Thu, 2 Jun 2016 19:36:30 -0700 (PDT) Date: Thu, 2 Jun 2016 19:36:30 -0700 Message-ID: Subject: [PATCH] aarch64 sim big-endian support From: Jim Wilson To: gdb-patches@sourceware.org On aarch64, code is always little-endian, even when compiling big-endian, so we need to force little-endian when reading instructions. Running the gcc C language testsuite, I get for an aarch64-elf target # of expected passes 35433 # of unexpected failures 254 # of unsupported tests 131 and for an aarch64_be-elf target with the attached patch I get # of expected passes 35200 # of unexpected failures 487 # of unsupported tests 131 so this simple patch gets us most of the way there. I haven't tried looking at the other problems yet. I also have a dejagnu patch I wrote to make this work, which I will be submitting to the dejagnu team shortly. Jim 2016-06-02 Jim Wilson sim/aarch64/ * simulator.c (aarch64_step): New var saved_target_byte_order. Force byte order to BFD_ENDIAN_LITTLE before pc read, then restore saved value. diff --git a/sim/aarch64/simulator.c b/sim/aarch64/simulator.c index 88cb03d..5a1814c 100644 --- a/sim/aarch64/simulator.c +++ b/sim/aarch64/simulator.c @@ -14078,12 +14078,18 @@ static bfd_boolean aarch64_step (sim_cpu *cpu) { uint64_t pc = aarch64_get_PC (cpu); + enum bfd_endian saved_target_byte_order; if (pc == TOP_LEVEL_RETURN_PC) return FALSE; aarch64_set_next_PC (cpu, pc + 4); + + /* Code is always little-endian. */ + saved_target_byte_order = current_target_byte_order; + current_target_byte_order = BFD_ENDIAN_LITTLE; aarch64_get_instr (cpu) = aarch64_get_mem_u32 (cpu, pc); + current_target_byte_order = saved_target_byte_order; TRACE_INSN (cpu, " pc = %" PRIx64 " instr = %08x", pc, aarch64_get_instr (cpu));