Subversion Repositories HelenOS

Rev

Rev 2776 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2776 Rev 2778
Line 41... Line 41...
41
#
41
#
42
context_save:
42
context_save:
43
	movl 0(%esp),%eax	# the caller's return %eip
43
	movl 0(%esp),%eax	# the caller's return %eip
44
	movl 4(%esp),%edx	# address of the context variable to save context to
44
	movl 4(%esp),%edx	# address of the context variable to save context to
45
 
45
 
46
		# save registers to given structure
46
		# save registers to the context structure
47
	CONTEXT_SAVE_ARCH_CORE %edx %eax
47
	CONTEXT_SAVE_ARCH_CORE %edx %eax
48
 
48
 
49
	# Save TLS
49
	# Save TLS
50
	movl %gs:0, %eax
50
	movl %gs:0, %eax
51
	movl %eax, OFFSET_TLS(%edx)     # tls -> ctx->tls
51
	movl %eax, OFFSET_TLS(%edx)     # tls -> ctx->tls
Line 61... Line 61...
61
# pointed by the 1st argument. Returns 0 in EAX.
61
# pointed by the 1st argument. Returns 0 in EAX.
62
#
62
#
63
context_restore:
63
context_restore:
64
	movl 4(%esp),%eax	# address of the context variable to restore context from
64
	movl 4(%esp),%eax	# address of the context variable to restore context from
65
 
65
 
66
		# restore registers from jmp_buf
66
		# restore registers from the context structure
67
	CONTEXT_RESTORE_ARCH_CORE %eax %edx
67
	CONTEXT_RESTORE_ARCH_CORE %eax %edx
68
 
68
 
69
	movl %edx,0(%esp)	# ctx->pc -> saver's return %eip
69
	movl %edx,0(%esp)	# ctx->pc -> saver's return %eip
70
 
70
 
71
	# Set thread local storage
71
	# Set thread local storage