From owner-svn-src-all@freebsd.org Wed Jul 1 13:59:27 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96DFB990F6B; Wed, 1 Jul 2015 13:59:27 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 717141E7A; Wed, 1 Jul 2015 13:59:27 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t61DxRrR041407; Wed, 1 Jul 2015 13:59:27 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t61DxQEB041405; Wed, 1 Jul 2015 13:59:26 GMT (envelope-from br@FreeBSD.org) Message-Id: <201507011359.t61DxQEB041405@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 1 Jul 2015 13:59:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285003 - head/lib/libproc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2015 13:59:27 -0000 Author: br Date: Wed Jul 1 13:59:26 2015 New Revision: 285003 URL: https://svnweb.freebsd.org/changeset/base/285003 Log: Make libproc compilable on AArch64. Modified: head/lib/libproc/proc_bkpt.c head/lib/libproc/proc_regs.c Modified: head/lib/libproc/proc_bkpt.c ============================================================================== --- head/lib/libproc/proc_bkpt.c Wed Jul 1 11:28:42 2015 (r285002) +++ head/lib/libproc/proc_bkpt.c Wed Jul 1 13:59:26 2015 (r285003) @@ -42,18 +42,24 @@ __FBSDID("$FreeBSD$"); #include #include "_libproc.h" -#if defined(__i386__) || defined(__amd64__) -#define BREAKPOINT_INSTR 0xcc /* int 0x3 */ +#if defined(__aarch64__) +#define AARCH64_BRK 0xd4200000 +#define AARCH64_BRK_IMM16_SHIFT 5 +#define AARCH64_BRK_IMM16_VAL (0xd << AARCH64_BRK_IMM16_SHIFT) +#define BREAKPOINT_INSTR (AARCH64_BRK | AARCH64_BRK_IMM16_VAL) +#define BREAKPOINT_INSTR_SZ 4 +#elif defined(__amd64__) || defined(__i386__) +#define BREAKPOINT_INSTR 0xcc /* int 0x3 */ #define BREAKPOINT_INSTR_SZ 1 +#elif defined(__arm__) +#define BREAKPOINT_INSTR 0xe7ffffff /* bkpt */ +#define BREAKPOINT_INSTR_SZ 4 #elif defined(__mips__) -#define BREAKPOINT_INSTR 0xd /* break */ +#define BREAKPOINT_INSTR 0xd /* break */ #define BREAKPOINT_INSTR_SZ 4 #elif defined(__powerpc__) -#define BREAKPOINT_INSTR 0x7fe00008 /* trap */ -#define BREAKPOINT_INSTR_SZ 4 -#elif defined(__arm__) -#define BREAKPOINT_INSTR 0xe7ffffff /* bkpt */ -#define BREAKPOINT_INSTR_SZ 4 +#define BREAKPOINT_INSTR 0x7fe00008 /* trap */ +#define BREAKPOINT_INSTR_SZ 4 #else #error "Add support for your architecture" #endif Modified: head/lib/libproc/proc_regs.c ============================================================================== --- head/lib/libproc/proc_regs.c Wed Jul 1 11:28:42 2015 (r285002) +++ head/lib/libproc/proc_regs.c Wed Jul 1 13:59:26 2015 (r285003) @@ -54,7 +54,9 @@ proc_regget(struct proc_handle *phdl, pr return (-1); switch (reg) { case REG_PC: -#if defined(__amd64__) +#if defined(__aarch64__) + *regvalue = regs.elr; +#elif defined(__amd64__) *regvalue = regs.r_rip; #elif defined(__arm__) *regvalue = regs.r_pc; @@ -67,7 +69,9 @@ proc_regget(struct proc_handle *phdl, pr #endif break; case REG_SP: -#if defined(__amd64__) +#if defined(__aarch64__) + *regvalue = regs.sp; +#elif defined(__amd64__) *regvalue = regs.r_rsp; #elif defined(__arm__) *regvalue = regs.r_sp; @@ -101,7 +105,9 @@ proc_regset(struct proc_handle *phdl, pr return (-1); switch (reg) { case REG_PC: -#if defined(__amd64__) +#if defined(__aarch64__) + regs.elr = regvalue; +#elif defined(__amd64__) regs.r_rip = regvalue; #elif defined(__arm__) regs.r_pc = regvalue; @@ -114,7 +120,9 @@ proc_regset(struct proc_handle *phdl, pr #endif break; case REG_SP: -#if defined(__amd64__) +#if defined(__aarch64__) + regs.sp = regvalue; +#elif defined(__amd64__) regs.r_rsp = regvalue; #elif defined(__arm__) regs.r_sp = regvalue;