/SPARTAN/trunk/arch/ia64/include/context.h |
---|
30,6 → 30,7 |
#define __ia64_CONTEXT_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <align.h> |
#define STACK_ITEM_SIZE 16 |
50,7 → 51,7 |
#define context_set(c, _pc, stack, size) \ |
(c)->pc = (__address) _pc; \ |
(c)->bsp = ((__address) stack) + ALIGN(sizeof(the_t), STACK_ALIGNMENT); \ |
(c)->sp = ((__address) stack) + ALIGN((size) - SP_DELTA, STACK_ALIGNMENT); |
(c)->sp = ((__address) stack) + ALIGN((size), STACK_ALIGNMENT) - SP_DELTA; |
/* |
* Only save registers that must be preserved across |
65,7 → 66,7 |
__u64 ar_unat_caller; |
__u64 ar_unat_callee; |
__u64 ar_rsc; |
__u64 bsp; /* ar_bsp */ |
__address bsp; /* ar_bsp */ |
__u64 ar_rnat; |
__u64 ar_lc; |
77,13 → 78,13 |
__u64 r5; |
__u64 r6; |
__u64 r7; |
__u64 sp; /* r12 */ |
__address sp; /* r12 */ |
__u64 r13; |
/* |
* Branch registers |
*/ |
__u64 pc; /* b0 */ |
__address pc; /* b0 */ |
__u64 b1; |
__u64 b2; |
__u64 b3; |
/SPARTAN/trunk/arch/ia64/src/context.S |
---|
28,10 → 28,10 |
.text |
.global context_save |
.global context_restore |
.global context_save_arch |
.global context_restore_arch |
context_save: |
context_save_arch: |
alloc loc0 = ar.pfs, 1, 8, 0, 0 |
mov loc1 = ar.unat ;; |
/* loc2 */ |
112,7 → 112,7 |
add r8 = r0, r0, 1 /* context_save returns 1 */ |
br.ret.sptk.many b0 |
context_restore: |
context_restore_arch: |
alloc loc0 = ar.pfs, 1, 8, 0, 0 ;; |
ld8 loc0 = [in0], 8 ;; /* load ar.pfs */ |
/SPARTAN/trunk/arch/ppc32/include/context.h |
---|
35,7 → 35,7 |
struct context { |
__u32 r0; |
__u32 sp; |
__address sp; |
__u32 r2; |
__u32 r3; |
__u32 r4; |
66,7 → 66,7 |
__u32 r29; |
__u32 r30; |
__u32 r31; |
__u32 pc; |
__address pc; |
ipl_t ipl; |
} __attribute__ ((packed)); |
/SPARTAN/trunk/arch/ppc32/src/context.S |
---|
30,10 → 30,10 |
.text |
.global context_save |
.global context_restore |
.global context_save_arch |
.global context_restore_arch |
context_save: |
context_save_arch: |
REGISTERS_STORE r3 |
mflr r3 |
43,7 → 43,7 |
li r3, 1 |
blr |
context_restore: |
context_restore_arch: |
REGISTERS_LOAD r3 |
lwz r3, 128(r3) |
/SPARTAN/trunk/arch/amd64/include/context.h |
---|
44,8 → 44,8 |
* during function call |
*/ |
struct context { |
__u64 sp; |
__u64 pc; |
__address sp; |
__address pc; |
__u64 rbx; |
__u64 rbp; |
/SPARTAN/trunk/arch/amd64/src/context.S |
---|
28,17 → 28,17 |
.text |
.global context_save |
.global context_restore |
.global context_save_arch |
.global context_restore_arch |
#include <arch/context_offset.h> |
## Save current CPU context |
# |
# Save CPU context to the kernel_context variable |
# Save CPU context to context_t variable |
# pointed by the 1st argument. Returns 1 in EAX. |
# |
context_save: |
context_save_arch: |
movq (%rsp), %rdx # the caller's return %eip |
# In %edi is passed 1st argument |
movq %rdx, OFFSET_PC(%rdi) |
58,10 → 58,10 |
## Restore current CPU context |
# |
# Restore CPU context from the kernel_context variable |
# Restore CPU context from context_t variable |
# pointed by the 1st argument. Returns 0 in EAX. |
# |
context_restore: |
context_restore_arch: |
movq OFFSET_R15(%rdi), %r15 |
movq OFFSET_R14(%rdi), %r14 |
movq OFFSET_R13(%rdi), %r13 |
/SPARTAN/trunk/arch/mips32/include/context.h |
---|
48,8 → 48,8 |
* function calls. |
*/ |
struct context { |
__u32 sp; |
__u32 pc; |
__address sp; |
__address pc; |
__u32 s0; |
__u32 s1; |
/SPARTAN/trunk/arch/mips32/src/context.S |
---|
36,8 → 36,8 |
.set noreorder |
.set nomacro |
.global context_save |
.global context_restore |
.global context_save_arch |
.global context_restore_arch |
.macro CONTEXT_STORE r |
sw $s0,OFFSET_S0(\r) |
72,7 → 72,7 |
.endm |
context_save: |
context_save_arch: |
CONTEXT_STORE $a0 |
# context_save returns 1 |
79,7 → 79,7 |
j $31 |
li $2, 1 |
context_restore: |
context_restore_arch: |
CONTEXT_LOAD $a0 |
# context_restore returns 0 |
/SPARTAN/trunk/arch/ia32/include/context.h |
---|
46,8 → 46,8 |
* function calls. |
*/ |
struct context { |
__u32 sp; |
__u32 pc; |
__address sp; |
__address pc; |
__u32 ebx; |
__u32 esi; |
__u32 edi; |
/SPARTAN/trunk/arch/ia32/src/context.s |
---|
28,16 → 28,16 |
.text |
.global context_save |
.global context_restore |
.global context_save_arch |
.global context_restore_arch |
## Save current CPU context |
# |
# Save CPU context to the kernel_context variable |
# Save CPU context to the context_t variable |
# pointed by the 1st argument. Returns 1 in EAX. |
# |
context_save: |
context_save_arch: |
movl 0(%esp),%eax # the caller's return %eip |
movl 4(%esp),%edx # address of the kernel_context variable to save context to |
53,12 → 53,12 |
ret |
## Restore current CPU context |
## Restore saved CPU context |
# |
# Restore CPU context from the kernel_context variable |
# Restore CPU context from context_t variable |
# pointed by the 1st argument. Returns 0 in EAX. |
# |
context_restore: |
context_restore_arch: |
movl 4(%esp),%eax # address of the kernel_context variable to restore context from |
movl 0(%eax),%esp # ctx->sp -> %esp |
movl 4(%eax),%edx # ctx->pc -> %edx |