Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Apr 2003 02:34:38 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 28208 for review
Message-ID:  <200304051034.h35AYc1h046850@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=28208

Change 28208 by peter@peter_overcee on 2003/04/05 02:33:40

	add [fs]uword64() for imgact_elf64.c

Affected files ...

.. //depot/projects/hammer/sys/x86_64/x86_64/support.s#15 edit

Differences ...

==== //depot/projects/hammer/sys/x86_64/x86_64/support.s#15 (text+ko) ====

@@ -210,7 +210,20 @@
  *
  *	Fetch a byte (sword, word) from user memory
  */
-ENTRY(fuword)
+ENTRY(fuword64)
+	movq	PCPU(CURPCB),%rcx
+	movq	$fusufault,PCB_ONFAULT(%rcx)
+	movq	8(%rsp),%rdx			/* from */
+
+	movq	$VM_MAXUSER_ADDRESS-8,%rax
+	cmpq	%rax,%rdx			/* verify address is valid */
+	ja	fusufault
+
+	movq	(%rdx),%rax
+	movq	$0,PCB_ONFAULT(%rcx)
+	ret
+
+ENTRY(fuword32)
 	movq	PCPU(CURPCB),%rcx
 	movq	$fusufault,PCB_ONFAULT(%rcx)
 	movq	8(%rsp),%rdx			/* from */
@@ -225,8 +238,8 @@
 	movq	$0,PCB_ONFAULT(%rcx)
 	ret
 
-ENTRY(fuword32)
-	jmp	fuword
+ENTRY(fuword)
+	jmp	fuword32
 
 /*
  * These two routines are called from the profiling code, potentially
@@ -288,7 +301,23 @@
  *
  *	Write a byte (word, longword) to user memory
  */
-ENTRY(suword)
+ENTRY(suword64)
+	movq	PCPU(CURPCB),%rcx
+	movq	$fusufault,PCB_ONFAULT(%rcx)
+	movq	8(%rsp),%rdx
+
+	movq	$VM_MAXUSER_ADDRESS-8,%rax
+	cmpq	%rax,%rdx			/* verify address validity */
+	ja	fusufault
+
+	movq	16(%rsp),%rax
+	movq	%rax,(%rdx)
+	xorq	%rax,%rax
+	movq	PCPU(CURPCB),%rcx
+	movq	%rax,PCB_ONFAULT(%rcx)
+	ret
+
+ENTRY(suword32)
 	movq	PCPU(CURPCB),%rcx
 	movq	$fusufault,PCB_ONFAULT(%rcx)
 	movq	8(%rsp),%rdx
@@ -304,8 +333,8 @@
 	movq	%rax,PCB_ONFAULT(%rcx)
 	ret
 
-ENTRY(suword32)
-	jmp	suword
+ENTRY(suword)
+	jmp	suword32
 
 /*
  * suword16 - MP SAFE



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