Changeset 4b2c872d in mainline
- Timestamp:
- 2005-10-18T09:33:02Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8005218
- Parents:
- 22f7769
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/include/context.h
r22f7769 r4b2c872d 45 45 */ 46 46 struct context { 47 __ u64sp;48 __ u64pc;47 __address sp; 48 __address pc; 49 49 50 50 __u64 rbx; -
arch/amd64/src/context.S
r22f7769 r4b2c872d 29 29 .text 30 30 31 .global context_save 32 .global context_restore 31 .global context_save_arch 32 .global context_restore_arch 33 33 34 34 #include <arch/context_offset.h> … … 36 36 ## Save current CPU context 37 37 # 38 # Save CPU context to the kernel_context variable38 # Save CPU context to context_t variable 39 39 # pointed by the 1st argument. Returns 1 in EAX. 40 40 # 41 context_save :41 context_save_arch: 42 42 movq (%rsp), %rdx # the caller's return %eip 43 43 # In %edi is passed 1st argument … … 59 59 ## Restore current CPU context 60 60 # 61 # Restore CPU context from the kernel_context variable61 # Restore CPU context from context_t variable 62 62 # pointed by the 1st argument. Returns 0 in EAX. 63 63 # 64 context_restore :64 context_restore_arch: 65 65 movq OFFSET_R15(%rdi), %r15 66 66 movq OFFSET_R14(%rdi), %r14 -
arch/ia32/include/context.h
r22f7769 r4b2c872d 47 47 */ 48 48 struct context { 49 __ u32sp;50 __ u32pc;49 __address sp; 50 __address pc; 51 51 __u32 ebx; 52 52 __u32 esi; -
arch/ia32/src/context.s
r22f7769 r4b2c872d 29 29 .text 30 30 31 .global context_save 32 .global context_restore 31 .global context_save_arch 32 .global context_restore_arch 33 33 34 34 35 35 ## Save current CPU context 36 36 # 37 # Save CPU context to the kernel_context variable37 # Save CPU context to the context_t variable 38 38 # pointed by the 1st argument. Returns 1 in EAX. 39 39 # 40 context_save :40 context_save_arch: 41 41 movl 0(%esp),%eax # the caller's return %eip 42 42 movl 4(%esp),%edx # address of the kernel_context variable to save context to … … 54 54 55 55 56 ## Restore currentCPU context56 ## Restore saved CPU context 57 57 # 58 # Restore CPU context from the kernel_context variable58 # Restore CPU context from context_t variable 59 59 # pointed by the 1st argument. Returns 0 in EAX. 60 60 # 61 context_restore :61 context_restore_arch: 62 62 movl 4(%esp),%eax # address of the kernel_context variable to restore context from 63 63 movl 0(%eax),%esp # ctx->sp -> %esp -
arch/ia64/include/context.h
r22f7769 r4b2c872d 31 31 32 32 #include <arch/types.h> 33 #include <typedefs.h> 33 34 #include <align.h> 34 35 … … 51 52 (c)->pc = (__address) _pc; \ 52 53 (c)->bsp = ((__address) stack) + ALIGN(sizeof(the_t), STACK_ALIGNMENT); \ 53 (c)->sp = ((__address) stack) + ALIGN((size) - SP_DELTA, STACK_ALIGNMENT);54 (c)->sp = ((__address) stack) + ALIGN((size), STACK_ALIGNMENT) - SP_DELTA; 54 55 55 56 /* … … 66 67 __u64 ar_unat_callee; 67 68 __u64 ar_rsc; 68 __ u64 bsp;/* ar_bsp */69 __address bsp; /* ar_bsp */ 69 70 __u64 ar_rnat; 70 71 __u64 ar_lc; … … 78 79 __u64 r6; 79 80 __u64 r7; 80 __ u64sp; /* r12 */81 __address sp; /* r12 */ 81 82 __u64 r13; 82 83 … … 84 85 * Branch registers 85 86 */ 86 __ u64pc; /* b0 */87 __address pc; /* b0 */ 87 88 __u64 b1; 88 89 __u64 b2; -
arch/ia64/src/context.S
r22f7769 r4b2c872d 29 29 .text 30 30 31 .global context_save 32 .global context_restore 31 .global context_save_arch 32 .global context_restore_arch 33 33 34 context_save :34 context_save_arch: 35 35 alloc loc0 = ar.pfs, 1, 8, 0, 0 36 36 mov loc1 = ar.unat ;; … … 113 113 br.ret.sptk.many b0 114 114 115 context_restore :115 context_restore_arch: 116 116 alloc loc0 = ar.pfs, 1, 8, 0, 0 ;; 117 117 -
arch/mips32/include/context.h
r22f7769 r4b2c872d 49 49 */ 50 50 struct context { 51 __ u32sp;52 __ u32pc;51 __address sp; 52 __address pc; 53 53 54 54 __u32 s0; -
arch/mips32/src/context.S
r22f7769 r4b2c872d 37 37 .set nomacro 38 38 39 .global context_save 40 .global context_restore 39 .global context_save_arch 40 .global context_restore_arch 41 41 42 42 .macro CONTEXT_STORE r … … 73 73 74 74 75 context_save :75 context_save_arch: 76 76 CONTEXT_STORE $a0 77 77 … … 80 80 li $2, 1 81 81 82 context_restore :82 context_restore_arch: 83 83 CONTEXT_LOAD $a0 84 84 -
arch/ppc32/include/context.h
r22f7769 r4b2c872d 36 36 struct context { 37 37 __u32 r0; 38 __ u32sp;38 __address sp; 39 39 __u32 r2; 40 40 __u32 r3; … … 67 67 __u32 r30; 68 68 __u32 r31; 69 __ u32pc;69 __address pc; 70 70 ipl_t ipl; 71 71 } __attribute__ ((packed)); -
arch/ppc32/src/context.S
r22f7769 r4b2c872d 31 31 .text 32 32 33 .global context_save 34 .global context_restore 33 .global context_save_arch 34 .global context_restore_arch 35 35 36 context_save :36 context_save_arch: 37 37 REGISTERS_STORE r3 38 38 … … 44 44 blr 45 45 46 context_restore :46 context_restore_arch: 47 47 REGISTERS_LOAD r3 48 48 -
include/context.h
r22f7769 r4b2c872d 32 32 #include <arch/types.h> 33 33 #include <typedefs.h> 34 #include <arch/context.h> 35 34 36 35 37 #ifndef context_set … … 39 41 #endif /* context_set */ 40 42 41 extern int context_save(context_t *c); 42 extern void context_restore(context_t *c) __attribute__ ((noreturn)); 43 extern int context_save_arch(context_t *c); 44 extern void context_restore_arch(context_t *c) __attribute__ ((noreturn)); 45 46 /** Save register context. 47 * 48 * Save current register context (including stack pointers) 49 * to context structure. 50 * 51 * Note that call to context_restore() will return at the same 52 * address as the corresponding call to context_save(). 53 * 54 * @param c Context structure. 55 * 56 * @return context_save() returns 1, context_restore() returns 0. 57 */ 58 static inline int context_save(context_t *c) 59 { 60 return context_save_arch(c); 61 } 62 63 /** Restore register context. 64 * 65 * Restore previously saved register context (including stack pointers) 66 * from context structure. 67 * 68 * Note that this function does not normally return. 69 * Instead, it returns at the same address as the 70 * corresponding call to context_save(), the only 71 * difference being return value. 72 * 73 * Note that content of any local variable defined by 74 * the caller of context_save() is undefined after 75 * context_restore(). 76 * 77 * @param c Context structure. 78 */ 79 static inline void context_restore(context_t *c) 80 { 81 context_restore_arch(c); 82 } 43 83 44 84 #endif -
src/main/main.c
r22f7769 r4b2c872d 247 247 * switch to this cpu's private stack prior to waking kmp up. 248 248 */ 249 context_set(&CPU->saved_context, FADDR(main_ap_separated_stack), CPU->stack, CPU_STACK_SIZE);249 context_set(&CPU->saved_context, FADDR(main_ap_separated_stack), (__address) CPU->stack, CPU_STACK_SIZE); 250 250 context_restore(&CPU->saved_context); 251 251 /* not reached */ -
src/proc/scheduler.c
r22f7769 r4b2c872d 314 314 */ 315 315 context_save(&CPU->saved_context); 316 context_set(&CPU->saved_context, FADDR(scheduler_separated_stack), CPU->stack, CPU_STACK_SIZE);316 context_set(&CPU->saved_context, FADDR(scheduler_separated_stack), (__address) CPU->stack, CPU_STACK_SIZE); 317 317 context_restore(&CPU->saved_context); 318 318 /* not reached */ -
src/proc/thread.c
r22f7769 r4b2c872d 196 196 197 197 context_save(&t->saved_context); 198 context_set(&t->saved_context, FADDR(cushion), t->kstack, THREAD_STACK_SIZE);198 context_set(&t->saved_context, FADDR(cushion), (__address) t->kstack, THREAD_STACK_SIZE); 199 199 200 200 the_initialize((the_t *) t->kstack); -
src/synch/waitq.c
r22f7769 r4b2c872d 31 31 #include <synch/spinlock.h> 32 32 #include <proc/thread.h> 33 #include <proc/scheduler.h> 33 34 #include <arch/asm.h> 34 35 #include <arch/types.h> -
tools/amd64/gencontext.c
r22f7769 r4b2c872d 4 4 typedef long long __u64; 5 5 typedef __u64 ipl_t; 6 typedef __u64 __address; 6 7 7 8 #define __amd64_TYPES_H__ -
tools/mips32/gencontext.c
r22f7769 r4b2c872d 1 1 #include <stdio.h> 2 3 2 4 3 typedef unsigned int __u32; 5 4 typedef __u32 ipl_t; 5 typedef __u32 __address; 6 6 7 7 #define __mips32_TYPES_H__
Note:
See TracChangeset
for help on using the changeset viewer.