From owner-svn-src-head@freebsd.org Fri Dec 18 16:16:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 115F24BCBC6; Fri, 18 Dec 2020 16:16:04 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CyDW775Z4z4rVx; Fri, 18 Dec 2020 16:16:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1FD75CC9; Fri, 18 Dec 2020 16:16:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0BIGG3v4048951; Fri, 18 Dec 2020 16:16:03 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0BIGG3XH048949; Fri, 18 Dec 2020 16:16:03 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202012181616.0BIGG3XH048949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 18 Dec 2020 16:16:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368765 - in head/sys/amd64: amd64 include X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head/sys/amd64: amd64 include X-SVN-Commit-Revision: 368765 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2020 16:16:04 -0000 Author: mhorne Date: Fri Dec 18 16:16:03 2020 New Revision: 368765 URL: https://svnweb.freebsd.org/changeset/base/368765 Log: amd64: use register macros for gdb_cpu_getreg() Prefer these newly-added definitions to bare values. MFC after: 2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Modified: head/sys/amd64/amd64/gdb_machdep.c head/sys/amd64/include/gdb_machdep.h Modified: head/sys/amd64/amd64/gdb_machdep.c ============================================================================== --- head/sys/amd64/amd64/gdb_machdep.c Fri Dec 18 16:09:24 2020 (r368764) +++ head/sys/amd64/amd64/gdb_machdep.c Fri Dec 18 16:16:03 2020 (r368765) @@ -60,31 +60,31 @@ gdb_cpu_getreg(int regnum, size_t *regsz) if (kdb_thread == curthread) { switch (regnum) { - case 0: return (&kdb_frame->tf_rax); - case 2: return (&kdb_frame->tf_rcx); - case 3: return (&kdb_frame->tf_rdx); - case 4: return (&kdb_frame->tf_rsi); - case 5: return (&kdb_frame->tf_rdi); - case 8: return (&kdb_frame->tf_r8); - case 9: return (&kdb_frame->tf_r9); - case 10: return (&kdb_frame->tf_r10); - case 11: return (&kdb_frame->tf_r11); - case 17: return (&kdb_frame->tf_rflags); - case 18: return (&kdb_frame->tf_cs); - case 19: return (&kdb_frame->tf_ss); + case GDB_REG_RAX: return (&kdb_frame->tf_rax); + case GDB_REG_RCX: return (&kdb_frame->tf_rcx); + case GDB_REG_RDX: return (&kdb_frame->tf_rdx); + case GDB_REG_RSI: return (&kdb_frame->tf_rsi); + case GDB_REG_RDI: return (&kdb_frame->tf_rdi); + case GDB_REG_R8: return (&kdb_frame->tf_r8); + case GDB_REG_R9: return (&kdb_frame->tf_r9); + case GDB_REG_R10: return (&kdb_frame->tf_r10); + case GDB_REG_R11: return (&kdb_frame->tf_r11); + case GDB_REG_RFLAGS: return (&kdb_frame->tf_rflags); + case GDB_REG_CS: return (&kdb_frame->tf_cs); + case GDB_REG_SS: return (&kdb_frame->tf_ss); } } switch (regnum) { - case 1: return (&kdb_thrctx->pcb_rbx); - case 6: return (&kdb_thrctx->pcb_rbp); - case 7: return (&kdb_thrctx->pcb_rsp); - case 12: return (&kdb_thrctx->pcb_r12); - case 13: return (&kdb_thrctx->pcb_r13); - case 14: return (&kdb_thrctx->pcb_r14); - case 15: return (&kdb_thrctx->pcb_r15); - case 16: return (&kdb_thrctx->pcb_rip); - case 18: return (&_kcodesel); - case 19: return (&_kdatasel); + case GDB_REG_RBX: return (&kdb_thrctx->pcb_rbx); + case GDB_REG_RBP: return (&kdb_thrctx->pcb_rbp); + case GDB_REG_RSP: return (&kdb_thrctx->pcb_rsp); + case GDB_REG_R12: return (&kdb_thrctx->pcb_r12); + case GDB_REG_R13: return (&kdb_thrctx->pcb_r13); + case GDB_REG_R14: return (&kdb_thrctx->pcb_r14); + case GDB_REG_R15: return (&kdb_thrctx->pcb_r15); + case GDB_REG_PC: return (&kdb_thrctx->pcb_rip); + case GDB_REG_CS: return (&_kcodesel); + case GDB_REG_SS: return (&_kdatasel); } return (NULL); } Modified: head/sys/amd64/include/gdb_machdep.h ============================================================================== --- head/sys/amd64/include/gdb_machdep.h Fri Dec 18 16:09:24 2020 (r368764) +++ head/sys/amd64/include/gdb_machdep.h Fri Dec 18 16:16:03 2020 (r368765) @@ -50,6 +50,9 @@ #define GDB_REG_R14 14 #define GDB_REG_R15 15 #define GDB_REG_PC 16 +#define GDB_REG_RFLAGS 17 +#define GDB_REG_CS 18 +#define GDB_REG_SS 19 _Static_assert(GDB_BUFSZ >= (GDB_NREGS * 16), "buffer fits 'g' regs"); static __inline size_t