Rev 52 | Rev 103 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 52 | Rev 65 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | .global fpu_context_save |
33 | .global fpu_context_save |
34 | .global fpu_context_restore |
34 | .global fpu_context_restore |
35 | .global fpu_lazy_context_save |
35 | .global fpu_lazy_context_save |
36 | .global fpu_lazy_context_restore |
36 | .global fpu_lazy_context_restore |
37 | 37 | ||
- | 38 | ||
- | 39 | ## Save current CPU context |
|
- | 40 | # |
|
- | 41 | # Save CPU context to the kernel_context variable |
|
- | 42 | # pointed by the 1st argument. Returns 1 in EAX. |
|
38 | # |
43 | # |
39 | # save context of this CPU |
- | |
40 | context_save: |
44 | context_save: |
41 | push %ebx |
45 | push %ebx |
42 | 46 | ||
43 | movl 4(%esp),%eax # the caller's return %eip |
47 | movl 4(%esp),%eax # the caller's return %eip |
44 | movl 8(%esp),%ebx # address of the kernel_context variable to save context to |
48 | movl 8(%esp),%ebx # address of the kernel_context variable to save context to |
Line 56... | Line 60... | ||
56 | movl %ebp,28(%eax) |
60 | movl %ebp,28(%eax) |
57 | 61 | ||
58 | xorl %eax,%eax # context_save returns 1 |
62 | xorl %eax,%eax # context_save returns 1 |
59 | incl %eax |
63 | incl %eax |
60 | ret |
64 | ret |
- | 65 | ||
61 | 66 | ||
- | 67 | ## Restore current CPU context |
|
62 | # |
68 | # |
63 | # restore saved context on this CPU |
69 | # Restore CPU context from the kernel_context variable |
- | 70 | # pointed by the 1st argument. Returns 0 in EAX. |
|
- | 71 | # |
|
64 | context_restore: |
72 | context_restore: |
65 | movl 4(%esp),%eax # address of the kernel_context variable to restore context from |
73 | movl 4(%esp),%eax # address of the kernel_context variable to restore context from |
66 | movl (%eax),%esp # ctx->sp -> %esp |
74 | movl (%eax),%esp # ctx->sp -> %esp |
67 | addl $4,%esp # this is for the pop we don't do |
75 | addl $4,%esp # this is for the pop we don't do |
68 | 76 | ||
Line 75... | Line 83... | ||
75 | 83 | ||
76 | movl 4(%eax),%eax |
84 | movl 4(%eax),%eax |
77 | movl %eax,(%esp) # ctx->pc -> saver's return %eip |
85 | movl %eax,(%esp) # ctx->pc -> saver's return %eip |
78 | xorl %eax,%eax # context_restore returns 0 |
86 | xorl %eax,%eax # context_restore returns 0 |
79 | ret |
87 | ret |
80 | - | ||
81 | - |