Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 96 → Rev 97

/SPARTAN/trunk/include/context.h
29,9 → 29,14
#ifndef __CONTEXT_H__
#define __CONTEXT_H__
 
#include <arch/types.h>
#include <typedefs.h>
#include "fpu_context.h"
 
#ifndef context_set
#define context_set(c, _pc, stack, size) \
(c)->pc = (__address) (_pc); \
(c)->sp = ((__address) (stack)) + (size) - SP_DELTA;
#endif /* context_set */
 
extern int context_save(context_t *c);
extern void context_restore(context_t *c) __attribute__ ((noreturn));
/SPARTAN/trunk/src/main/main.c
27,7 → 27,7
*/
 
#include <arch/asm.h>
#include <arch/context.h>
#include <context.h>
#include <print.h>
#include <panic.h>
#include <config.h>
94,8 → 94,7
config.kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE + CONFIG_STACK_SIZE;
 
context_save(&ctx);
ctx.sp = config.base + config.kernel_size - SP_DELTA;
ctx.pc = FADDR(main_bsp_separated_stack);
context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE, CONFIG_STACK_SIZE);
context_restore(&ctx);
/* not reached */
}
192,8 → 191,7
* collide with another CPU coming up. To prevent this, we
* switch to this cpu's private stack prior to waking kmp up.
*/
CPU->saved_context.sp = (__address) &CPU->stack[CPU_STACK_SIZE-SP_DELTA];
CPU->saved_context.pc = FADDR(main_ap_separated_stack);
context_set(&CPU->saved_context, FADDR(main_ap_separated_stack), CPU->stack, CPU_STACK_SIZE);
context_restore(&CPU->saved_context);
/* not reached */
}
/SPARTAN/trunk/src/proc/scheduler.c
232,8 → 232,7
* scheduler_separated_stack().
*/
context_save(&CPU->saved_context);
CPU->saved_context.sp = (__address) &CPU->stack[CPU_STACK_SIZE-SP_DELTA];
CPU->saved_context.pc = FADDR(scheduler_separated_stack);
context_set(&CPU->saved_context, FADDR(scheduler_separated_stack), CPU->stack, CPU_STACK_SIZE);
context_restore(&CPU->saved_context);
/* not reached */
}
/SPARTAN/trunk/src/proc/thread.c
165,8 → 165,7
context_save(&t->saved_context);
t->saved_context.pc = FADDR(cushion);
t->saved_context.sp = (__address) &t->kstack[THREAD_STACK_SIZE-SP_DELTA];
context_set(&t->saved_context, FADDR(cushion), t->kstack, THREAD_STACK_SIZE);
 
pri = cpu_priority_high();
t->saved_context.pri = cpu_priority_read();
/SPARTAN/trunk/arch/ia64/include/context.h
37,6 → 37,15
*/
#define SP_DELTA 0
 
#ifdef context_set
#undef context_set
#endif
 
#define context_set(c, _pc, stack, size) \
(c)->pc = (__address) _pc; \
(c)->bsp = (__address) stack; \
(c)->sp = ((__address) stack) + (size) - SP_DELTA;
 
struct context {
 
/*
46,7 → 55,7
__u64 ar_unat_caller;
__u64 ar_unat_callee;
__u64 ar_rsc;
__u64 ar_bsp;
__u64 bsp; /* ar_bsp */
__u64 ar_rnat;
__u64 ar_lc;
__u64 ar_ec;