Subversion Repositories HelenOS

Rev

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

Rev 318 Rev 414
Line 26... Line 26...
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#
27
#
28
 
28
 
29
.text
29
.text
30
 
30
 
31
.global context_save
31
.global context_save_arch
32
.global context_restore
32
.global context_restore_arch
33
 
33
 
34
#include <arch/context_offset.h>
34
#include <arch/context_offset.h>
35
 
35
 
36
## Save current CPU context
36
## Save current CPU context
37
#
37
#
38
# Save CPU context to the kernel_context variable
38
# Save CPU context to context_t variable
39
# pointed by the 1st argument. Returns 1 in EAX.
39
# pointed by the 1st argument. Returns 1 in EAX.
40
#
40
#
41
context_save:
41
context_save_arch:
42
	movq (%rsp), %rdx     # the caller's return %eip
42
	movq (%rsp), %rdx     # the caller's return %eip
43
	# In %edi is passed 1st argument
43
	# In %edi is passed 1st argument
44
	movq %rdx, OFFSET_PC(%rdi)
44
	movq %rdx, OFFSET_PC(%rdi)
45
	movq %rsp, OFFSET_SP(%rdi)
45
	movq %rsp, OFFSET_SP(%rdi)
46
	
46
	
Line 56... Line 56...
56
	ret
56
	ret
57
 
57
 
58
 
58
 
59
## Restore current CPU context
59
## Restore current CPU context
60
#
60
#
61
# Restore CPU context from the kernel_context variable
61
# Restore CPU context from context_t variable
62
# pointed by the 1st argument. Returns 0 in EAX.
62
# pointed by the 1st argument. Returns 0 in EAX.
63
#
63
#
64
context_restore:	
64
context_restore_arch:	
65
	movq OFFSET_R15(%rdi), %r15
65
	movq OFFSET_R15(%rdi), %r15
66
	movq OFFSET_R14(%rdi), %r14
66
	movq OFFSET_R14(%rdi), %r14
67
	movq OFFSET_R13(%rdi), %r13
67
	movq OFFSET_R13(%rdi), %r13
68
	movq OFFSET_R12(%rdi), %r12
68
	movq OFFSET_R12(%rdi), %r12
69
	movq OFFSET_RBP(%rdi), %rbp
69
	movq OFFSET_RBP(%rdi), %rbp