瀏覽代碼

[SPARC64]: Fix branch signedness bug in all code patching.

The bug that hit SUN4V TLB patching exists elsewhere.
Make sure we cure all such cases.

Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller 19 年之前
父節點
當前提交
6241e5cc6a
共有 3 個文件被更改,包括 6 次插入3 次删除
  1. 2 1
      arch/sparc64/lib/NGpage.S
  2. 2 1
      arch/sparc64/lib/NGpatch.S
  3. 2 1
      arch/sparc64/lib/U3patch.S

+ 2 - 1
arch/sparc64/lib/NGpage.S

@@ -75,7 +75,8 @@ NGclear_user_page:	/* %o0=dest, %o1=vaddr */
 	or	%g2, %lo(OLD), %g2; \
 	or	%g2, %lo(OLD), %g2; \
 	sub	%g1, %g2, %g1; \
 	sub	%g1, %g2, %g1; \
 	sethi	%hi(BRANCH_ALWAYS), %g3; \
 	sethi	%hi(BRANCH_ALWAYS), %g3; \
-	srl	%g1, 2, %g1; \
+	sll	%g1, 11, %g1; \
+	srl	%g1, 11 + 2, %g1; \
 	or	%g3, %lo(BRANCH_ALWAYS), %g3; \
 	or	%g3, %lo(BRANCH_ALWAYS), %g3; \
 	or	%g3, %g1, %g3; \
 	or	%g3, %g1, %g3; \
 	stw	%g3, [%g2]; \
 	stw	%g3, [%g2]; \

+ 2 - 1
arch/sparc64/lib/NGpatch.S

@@ -12,7 +12,8 @@
 	or	%g2, %lo(OLD), %g2; \
 	or	%g2, %lo(OLD), %g2; \
 	sub	%g1, %g2, %g1; \
 	sub	%g1, %g2, %g1; \
 	sethi	%hi(BRANCH_ALWAYS), %g3; \
 	sethi	%hi(BRANCH_ALWAYS), %g3; \
-	srl	%g1, 2, %g1; \
+	sll	%g1, 11, %g1; \
+	srl	%g1, 11 + 2, %g1; \
 	or	%g3, %lo(BRANCH_ALWAYS), %g3; \
 	or	%g3, %lo(BRANCH_ALWAYS), %g3; \
 	or	%g3, %g1, %g3; \
 	or	%g3, %g1, %g3; \
 	stw	%g3, [%g2]; \
 	stw	%g3, [%g2]; \

+ 2 - 1
arch/sparc64/lib/U3patch.S

@@ -12,7 +12,8 @@
 	or	%g2, %lo(OLD), %g2; \
 	or	%g2, %lo(OLD), %g2; \
 	sub	%g1, %g2, %g1; \
 	sub	%g1, %g2, %g1; \
 	sethi	%hi(BRANCH_ALWAYS), %g3; \
 	sethi	%hi(BRANCH_ALWAYS), %g3; \
-	srl	%g1, 2, %g1; \
+	sll	%g1, 11, %g1; \
+	srl	%g1, 11 + 2, %g1; \
 	or	%g3, %lo(BRANCH_ALWAYS), %g3; \
 	or	%g3, %lo(BRANCH_ALWAYS), %g3; \
 	or	%g3, %g1, %g3; \
 	or	%g3, %g1, %g3; \
 	stw	%g3, [%g2]; \
 	stw	%g3, [%g2]; \