Module Name:    src
Committed By:   thorpej
Date:           Sat Apr  6 20:25:27 UTC 2019

Modified Files:
        src/sys/arch/amd64/amd64: copy.S
        src/sys/arch/i386/i386: copy.S

Log Message:
Fix a think-o / paste-o in the max user address check, pointed out
by maxv@.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amd64/amd64/copy.S
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/i386/i386/copy.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/copy.S
diff -u src/sys/arch/amd64/amd64/copy.S:1.31 src/sys/arch/amd64/amd64/copy.S:1.32
--- src/sys/arch/amd64/amd64/copy.S:1.31	Sat Apr  6 03:06:24 2019
+++ src/sys/arch/amd64/amd64/copy.S	Sat Apr  6 20:25:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.31 2019/04/06 03:06:24 thorpej Exp $	*/
+/*	$NetBSD: copy.S,v 1.32 2019/04/06 20:25:26 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -386,15 +386,15 @@ END(copystr)
 
 /**************************************************************************/
 
-#define	UFETCHSTORE_PROLOGUE						\
-	movq	$VM_MAXUSER_ADDRESS-1,%r11			;	\
+#define	UFETCHSTORE_PROLOGUE(x)						\
+	movq	$VM_MAXUSER_ADDRESS-x,%r11			;	\
 	cmpq	%r11,%rdi					;	\
 	ja	_C_LABEL(copy_efault)
 
 /* LINTSTUB: int _ufetch_8(const uint8_t *uaddr, uint8_t *valp); */
 ENTRY(_ufetch_8)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(1)
 
 	SMAP_DISABLE
 .L_ufetch_8_start:
@@ -411,7 +411,7 @@ END(_ufetch_8)
 /* LINTSTUB: int _ufetch_16(const uint16_t *uaddr, uint16_t *valp); */
 ENTRY(_ufetch_16)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(2)
 
 	SMAP_DISABLE
 .L_ufetch_16_start:
@@ -428,7 +428,7 @@ END(_ufetch_16)
 /* LINTSTUB: int _ufetch_32(const uint32_t *uaddr, uint32_t *valp); */
 ENTRY(_ufetch_32)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(4)
 
 	SMAP_DISABLE
 .L_ufetch_32_start:
@@ -445,7 +445,7 @@ END(_ufetch_32)
 /* LINTSTUB: int _ufetch_64(const uint64_t *uaddr, uint64_t *valp); */
 ENTRY(_ufetch_64)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(8)
 
 	SMAP_DISABLE
 .L_ufetch_64_start:
@@ -462,7 +462,7 @@ END(_ufetch_64)
 /* LINTSTUB: int _ustore_8(uint8_t *uaddr, uint8_t val); */
 ENTRY(_ustore_8)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(1)
 
 	SMAP_DISABLE
 .L_ustore_8_start:
@@ -478,7 +478,7 @@ END(_ustore_8)
 /* LINTSTUB: int _ustore_16(uint16_t *uaddr, uint16_t val); */
 ENTRY(_ustore_16)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(2)
 
 	SMAP_DISABLE
 .L_ustore_16_start:
@@ -494,7 +494,7 @@ END(_ustore_16)
 /* LINTSTUB: int _ustore_32(uint32_t *uaddr, uint32_t val); */
 ENTRY(_ustore_32)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(4)
 
 	SMAP_DISABLE
 .L_ustore_32_start:
@@ -510,7 +510,7 @@ END(_ustore_32)
 /* LINTSTUB: int _ustore_64(uint64_t *uaddr, uint64_t val); */
 ENTRY(_ustore_64)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(8)
 
 	SMAP_DISABLE
 .L_ustore_64_start:

Index: src/sys/arch/i386/i386/copy.S
diff -u src/sys/arch/i386/i386/copy.S:1.29 src/sys/arch/i386/i386/copy.S:1.30
--- src/sys/arch/i386/i386/copy.S:1.29	Sat Apr  6 03:06:25 2019
+++ src/sys/arch/i386/i386/copy.S	Sat Apr  6 20:25:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.29 2019/04/06 03:06:25 thorpej Exp $	*/
+/*	$NetBSD: copy.S,v 1.30 2019/04/06 20:25:27 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2004, 2008 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: copy.S,v 1.29 2019/04/06 03:06:25 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copy.S,v 1.30 2019/04/06 20:25:27 thorpej Exp $");
 
 #include "assym.h"
 
@@ -500,15 +500,15 @@ END(copystr)
 
 /**************************************************************************/
 
-#define	UFETCHSTORE_PROLOGUE						\
+#define	UFETCHSTORE_PROLOGUE(x)						\
 	movl	4(%esp),%edx					;	\
-	cmpl	$VM_MAXUSER_ADDRESS-4,%edx			;	\
+	cmpl	$VM_MAXUSER_ADDRESS-x,%edx			;	\
 	ja	_C_LABEL(ufetchstore_efault)
 
 /* LINTSTUB: int _ufetch_8(const uint8_t *uaddr, uint8_t *valp); */
 ENTRY(_ufetch_8)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(1)
 
 	SMAP_DISABLE
 .L_ufetch_8_start:
@@ -526,7 +526,7 @@ END(_ufetch_8)
 /* LINTSTUB: int _ufetch_16(const uint16_t *uaddr, uint16_t *valp); */
 ENTRY(_ufetch_16)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(2)
 
 	SMAP_DISABLE
 .L_ufetch_16_start:
@@ -544,7 +544,7 @@ END(_ufetch_16)
 /* LINTSTUB: int _ufetch_32(const uint32_t *uaddr, uint32_t *valp); */
 ENTRY(_ufetch_32)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(4)
 
 	SMAP_DISABLE
 .L_ufetch_32_start:
@@ -562,7 +562,7 @@ END(_ufetch_32)
 /* LINTSTUB: int _ustore_8(uint8_t *uaddr, uint8_t val); */
 ENTRY(_ustore_8)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(1)
 	movb	8(%esp),%al
 
 	SMAP_DISABLE
@@ -579,7 +579,7 @@ END(_ustore_8)
 /* LINTSTUB: int _ustore_16(uint16_t *uaddr, uint16_t val); */
 ENTRY(_ustore_16)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(2)
 	movw	8(%esp),%ax
 
 	SMAP_DISABLE
@@ -596,7 +596,7 @@ END(_ustore_16)
 /* LINTSTUB: int _ustore_32(uint32_t *uaddr, uint32_t val); */
 ENTRY(_ustore_32)
 	DEFERRED_SWITCH_CHECK
-	UFETCHSTORE_PROLOGUE
+	UFETCHSTORE_PROLOGUE(4)
 	movl	8(%esp),%eax
 
 	SMAP_DISABLE

Reply via email to