Subversion Repositories HelenOS

Rev

Rev 2071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2071 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_arch:
40
context_save_arch:
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 57... Line 57...
57
#
57
#
58
# Restore CPU context from context_t variable
58
# Restore CPU context from context_t variable
59
# pointed by the 1st argument. Returns 0 in EAX.
59
# pointed by the 1st argument. Returns 0 in EAX.
60
#
60
#
61
context_restore_arch:
61
context_restore_arch:
62
	movl 4(%esp),%eax	# address of the kernel_context variable to restore context from
62
	movl 4(%esp),%eax	# address of the context variable to restore context from
63
	movl 0(%eax),%esp	# ctx->sp -> %esp
63
	movl 0(%eax),%esp	# ctx->sp -> %esp
64
	movl 4(%eax),%edx	# ctx->pc -> %edx
64
	movl 4(%eax),%edx	# ctx->pc -> %edx
65
	movl 8(%eax),%ebx	# ctx->ebx -> %ebx
65
	movl 8(%eax),%ebx	# ctx->ebx -> %ebx
66
	movl 12(%eax),%esi	# ctx->esi -> %esi
66
	movl 12(%eax),%esi	# ctx->esi -> %esi
67
	movl 16(%eax),%edi	# ctx->edi -> %edi
67
	movl 16(%eax),%edi	# ctx->edi -> %edi