Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Dec 2018 17:52:09 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r342223 - in head/sys/riscv: include riscv
Message-ID:  <201812191752.wBJHq9nv091607@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Dec 19 17:52:09 2018
New Revision: 342223
URL: https://svnweb.freebsd.org/changeset/base/342223

Log:
  Replace uses of sbadaddr with stval.
  
  The sbadaddr register was renamed in version 1.10 of the privileged
  architecture specification.  No functional change intended.
  
  Submitted by:	Mitchell Horne <mhorne063@gmail.com>
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D18594

Modified:
  head/sys/riscv/include/frame.h
  head/sys/riscv/riscv/db_interface.c
  head/sys/riscv/riscv/exception.S
  head/sys/riscv/riscv/genassym.c
  head/sys/riscv/riscv/trap.c

Modified: head/sys/riscv/include/frame.h
==============================================================================
--- head/sys/riscv/include/frame.h	Wed Dec 19 17:48:37 2018	(r342222)
+++ head/sys/riscv/include/frame.h	Wed Dec 19 17:52:09 2018	(r342223)
@@ -55,7 +55,7 @@ struct trapframe {
 	uint64_t tf_a[8];
 	uint64_t tf_sepc;
 	uint64_t tf_sstatus;
-	uint64_t tf_sbadaddr;
+	uint64_t tf_stval;
 	uint64_t tf_scause;
 };
 

Modified: head/sys/riscv/riscv/db_interface.c
==============================================================================
--- head/sys/riscv/riscv/db_interface.c	Wed Dec 19 17:48:37 2018	(r342222)
+++ head/sys/riscv/riscv/db_interface.c	Wed Dec 19 17:52:09 2018	(r342223)
@@ -98,7 +98,7 @@ struct db_variable db_regs[] = {
 	{ "a7",		DB_OFFSET(tf_a[7]),	db_frame },
 	{ "sepc",	DB_OFFSET(tf_sepc),	db_frame },
 	{ "sstatus",	DB_OFFSET(tf_sstatus),	db_frame },
-	{ "sbadaddr",	DB_OFFSET(tf_sbadaddr),	db_frame },
+	{ "stval",	DB_OFFSET(tf_stval),	db_frame },
 	{ "scause",	DB_OFFSET(tf_scause),	db_frame },
 };
 

Modified: head/sys/riscv/riscv/exception.S
==============================================================================
--- head/sys/riscv/riscv/exception.S	Wed Dec 19 17:48:37 2018	(r342222)
+++ head/sys/riscv/riscv/exception.S	Wed Dec 19 17:52:09 2018	(r342223)
@@ -107,8 +107,8 @@ __FBSDID("$FreeBSD$");
 	sd	t0, (TF_SEPC)(sp)
 	csrr	t0, sstatus
 	sd	t0, (TF_SSTATUS)(sp)
-	csrr	t0, sbadaddr
-	sd	t0, (TF_SBADADDR)(sp)
+	csrr	t0, stval
+	sd	t0, (TF_STVAL)(sp)
 	csrr	t0, scause
 	sd	t0, (TF_SCAUSE)(sp)
 .endm

Modified: head/sys/riscv/riscv/genassym.c
==============================================================================
--- head/sys/riscv/riscv/genassym.c	Wed Dec 19 17:48:37 2018	(r342222)
+++ head/sys/riscv/riscv/genassym.c	Wed Dec 19 17:52:09 2018	(r342223)
@@ -96,6 +96,6 @@ ASSYM(TF_T, offsetof(struct trapframe, tf_t));
 ASSYM(TF_S, offsetof(struct trapframe, tf_s));
 ASSYM(TF_A, offsetof(struct trapframe, tf_a));
 ASSYM(TF_SEPC, offsetof(struct trapframe, tf_sepc));
-ASSYM(TF_SBADADDR, offsetof(struct trapframe, tf_sbadaddr));
+ASSYM(TF_STVAL, offsetof(struct trapframe, tf_stval));
 ASSYM(TF_SCAUSE, offsetof(struct trapframe, tf_scause));
 ASSYM(TF_SSTATUS, offsetof(struct trapframe, tf_sstatus));

Modified: head/sys/riscv/riscv/trap.c
==============================================================================
--- head/sys/riscv/riscv/trap.c	Wed Dec 19 17:48:37 2018	(r342222)
+++ head/sys/riscv/riscv/trap.c	Wed Dec 19 17:52:09 2018	(r342223)
@@ -170,7 +170,7 @@ static void
 data_abort(struct trapframe *frame, int usermode)
 {
 	struct vm_map *map;
-	uint64_t sbadaddr;
+	uint64_t stval;
 	struct thread *td;
 	struct pcb *pcb;
 	vm_prot_t ftype;
@@ -188,7 +188,7 @@ data_abort(struct trapframe *frame, int usermode)
 	td = curthread;
 	p = td->td_proc;
 	pcb = td->td_pcb;
-	sbadaddr = frame->tf_sbadaddr;
+	stval = frame->tf_stval;
 
 	if (td->td_critnest != 0 || td->td_intr_nesting_level != 0 ||
 	    WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK, NULL,
@@ -197,7 +197,7 @@ data_abort(struct trapframe *frame, int usermode)
 
 	if (usermode)
 		map = &td->td_proc->p_vmspace->vm_map;
-	else if (sbadaddr >= VM_MAX_USER_ADDRESS)
+	else if (stval >= VM_MAX_USER_ADDRESS)
 		map = kernel_map;
 	else {
 		if (pcb->pcb_onfault == 0)
@@ -205,7 +205,7 @@ data_abort(struct trapframe *frame, int usermode)
 		map = &td->td_proc->p_vmspace->vm_map;
 	}
 
-	va = trunc_page(sbadaddr);
+	va = trunc_page(stval);
 
 	if ((frame->tf_scause == EXCP_FAULT_STORE) ||
 	    (frame->tf_scause == EXCP_STORE_PAGE_FAULT)) {
@@ -249,7 +249,7 @@ data_abort(struct trapframe *frame, int usermode)
 				ucode = SEGV_ACCERR;
 			else
 				ucode = SEGV_MAPERR;
-			call_trapsignal(td, sig, ucode, (void *)sbadaddr);
+			call_trapsignal(td, sig, ucode, (void *)stval);
 		} else {
 			if (pcb->pcb_onfault != 0) {
 				frame->tf_a[0] = error;
@@ -267,7 +267,7 @@ done:
 
 fatal:
 	dump_regs(frame);
-	panic("Fatal page fault at %#lx: %#016lx", frame->tf_sepc, sbadaddr);
+	panic("Fatal page fault at %#lx: %#016lx", frame->tf_sepc, stval);
 }
 
 void
@@ -324,8 +324,8 @@ do_trap_supervisor(struct trapframe *frame)
 		break;
 	default:
 		dump_regs(frame);
-		panic("Unknown kernel exception %x badaddr %lx\n",
-			exception, frame->tf_sbadaddr);
+		panic("Unknown kernel exception %x trap value %lx\n",
+		    exception, frame->tf_stval);
 	}
 }
 
@@ -392,7 +392,7 @@ do_trap_user(struct trapframe *frame)
 		break;
 	default:
 		dump_regs(frame);
-		panic("Unknown userland exception %x, badaddr %lx\n",
-			exception, frame->tf_sbadaddr);
+		panic("Unknown userland exception %x, trap value %lx\n",
+		    exception, frame->tf_stval);
 	}
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812191752.wBJHq9nv091607>