Subversion Repositories HelenOS-historic

Rev

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

Rev 81 Rev 97
Line 25... Line 25...
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
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
#include <arch/asm.h>
29
#include <arch/asm.h>
30
#include <arch/context.h>
30
#include <context.h>
31
#include <print.h>
31
#include <print.h>
32
#include <panic.h>
32
#include <panic.h>
33
#include <config.h>
33
#include <config.h>
34
#include <time/clock.h>
34
#include <time/clock.h>
35
#include <proc/scheduler.h>
35
#include <proc/scheduler.h>
Line 92... Line 92...
92
    config.base = hardcoded_load_address;
92
    config.base = hardcoded_load_address;
93
    config.memory_size = CONFIG_MEMORY_SIZE;
93
    config.memory_size = CONFIG_MEMORY_SIZE;
94
    config.kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE + CONFIG_STACK_SIZE;
94
    config.kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE + CONFIG_STACK_SIZE;
95
 
95
 
96
    context_save(&ctx);
96
    context_save(&ctx);
97
    ctx.sp = config.base + config.kernel_size - SP_DELTA;
97
    context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE, CONFIG_STACK_SIZE);
98
    ctx.pc = FADDR(main_bsp_separated_stack);
-
 
99
    context_restore(&ctx);
98
    context_restore(&ctx);
100
    /* not reached */
99
    /* not reached */
101
}
100
}
102
 
101
 
103
void main_bsp_separated_stack(void) {
102
void main_bsp_separated_stack(void) {
Line 190... Line 189...
190
    /*
189
    /*
191
     * If we woke kmp up before we left the kernel stack, we could
190
     * If we woke kmp up before we left the kernel stack, we could
192
     * collide with another CPU coming up. To prevent this, we
191
     * collide with another CPU coming up. To prevent this, we
193
     * switch to this cpu's private stack prior to waking kmp up.
192
     * switch to this cpu's private stack prior to waking kmp up.
194
     */
193
     */
195
    CPU->saved_context.sp = (__address) &CPU->stack[CPU_STACK_SIZE-SP_DELTA];
194
    context_set(&CPU->saved_context, FADDR(main_ap_separated_stack), CPU->stack, CPU_STACK_SIZE);
196
    CPU->saved_context.pc = FADDR(main_ap_separated_stack);
-
 
197
    context_restore(&CPU->saved_context);
195
    context_restore(&CPU->saved_context);
198
    /* not reached */
196
    /* not reached */
199
}
197
}
200
 
198
 
201
void main_ap_separated_stack(void)
199
void main_ap_separated_stack(void)