PERFORCE change 28208 for review

Peter Wemm peter at FreeBSD.org
Sat Apr 5 02:34:41 PST 2003


http://perforce.freebsd.org/chv.cgi?CH=28208

Change 28208 by peter at 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


More information about the p4-projects mailing list