Rev 2479 | Rev 2613 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2479 | Rev 2482 | ||
---|---|---|---|
Line 37... | Line 37... | ||
37 | # Save CPU context to the context_t variable |
37 | # Save CPU context to the context_t variable |
38 | # pointed by the 1st argument. Returns 1 in EAX. |
38 | # pointed by the 1st argument. Returns 1 in EAX. |
39 | # |
39 | # |
40 | context_save: |
40 | context_save: |
41 | movl 0(%esp),%eax # the caller's return %eip |
41 | movl 0(%esp),%eax # the caller's return %eip |
42 | movl 4(%esp),%edx # address of the kernel_context variable to save context to |
42 | movl 4(%esp),%edx # address of the context variable to save context to |
43 | 43 | ||
44 | movl %esp,0(%edx) # %esp -> ctx->sp |
44 | movl %esp,0(%edx) # %esp -> ctx->sp |
45 | movl %eax,4(%edx) # %eip -> ctx->pc |
45 | movl %eax,4(%edx) # %eip -> ctx->pc |
46 | movl %ebx,8(%edx) # %ebx -> ctx->ebx |
46 | movl %ebx,8(%edx) # %ebx -> ctx->ebx |
47 | movl %esi,12(%edx) # %esi -> ctx->esi |
47 | movl %esi,12(%edx) # %esi -> ctx->esi |
Line 61... | Line 61... | ||
61 | # |
61 | # |
62 | # Restore CPU context from context_t variable |
62 | # Restore CPU context from context_t variable |
63 | # pointed by the 1st argument. Returns 0 in EAX. |
63 | # pointed by the 1st argument. Returns 0 in EAX. |
64 | # |
64 | # |
65 | context_restore: |
65 | context_restore: |
66 | movl 4(%esp),%eax # address of the kernel_context variable to restore context from |
66 | movl 4(%esp),%eax # address of the context variable to restore context from |
67 | movl 0(%eax),%esp # ctx->sp -> %esp |
67 | movl 0(%eax),%esp # ctx->sp -> %esp |
68 | movl 4(%eax),%edx # ctx->pc -> %edx |
68 | movl 4(%eax),%edx # ctx->pc -> %edx |
69 | movl 8(%eax),%ebx # ctx->ebx -> %ebx |
69 | movl 8(%eax),%ebx # ctx->ebx -> %ebx |
70 | movl 12(%eax),%esi # ctx->esi -> %esi |
70 | movl 12(%eax),%esi # ctx->esi -> %esi |
71 | movl 16(%eax),%edi # ctx->edi -> %edi |
71 | movl 16(%eax),%edi # ctx->edi -> %edi |