Browse Source

Merge pull request #10 from fabled/master

fix x86_64 register order for swapcontext
William Pitcock 1 year ago
parent
commit
4f190cc561
No account linked to committer's email
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      arch/x86_64/swapcontext.S

+ 4
- 4
arch/x86_64/swapcontext.S View File

@@ -23,8 +23,8 @@ __swapcontext:
23 23
 	movq	%r14, 88(%rdi)
24 24
 	movq	%r15, 96(%rdi)
25 25
 	movq	%rdi, 104(%rdi)
26
-	movq	%rbp, 112(%rdi)
27
-	movq	%rsi, 120(%rdi)
26
+	movq	%rsi, 112(%rdi)
27
+	movq	%rbp, 120(%rdi)
28 28
 	movq	%rbx, 128(%rdi)
29 29
 	movq	%rdx, 136(%rdi)
30 30
 	movq	$1, 144(%rdi)		/* $1 is %rax */
@@ -51,7 +51,7 @@ __swapcontext:
51 51
 	movq	88(%rsi), %r14
52 52
 	movq	96(%rsi), %r15
53 53
 	movq	104(%rsi), %rdi
54
-	movq	112(%rsi), %rbp
54
+	movq	120(%rsi), %rbp
55 55
 	movq	128(%rsi), %rbx
56 56
 	movq	136(%rsi), %rdx
57 57
 	movq	144(%rsi), %rax
@@ -63,7 +63,7 @@ __swapcontext:
63 63
 	pushq	168(%rsi)
64 64
 
65 65
 	/* finally, set %rsi correctly since we do not need it anymore. */
66
-	movq	120(%rsi), %rsi
66
+	movq	112(%rsi), %rsi
67 67
 
68 68
 	/* we're all done here, return 0 */
69 69
 	xorl	%eax, %eax