Subversion Repositories HelenOS-historic

Rev

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

Rev 1074 Rev 1077
Line 32... Line 32...
32
#include <arch.h>
32
#include <arch.h>
33
#include <arch/context.h>   /* SP_DELTA */
33
#include <arch/context.h>   /* SP_DELTA */
34
#include <arch/asm.h>
34
#include <arch/asm.h>
35
#include <arch/debugger.h>
35
#include <arch/debugger.h>
36
 
36
 
-
 
37
#include <print.h>
37
void before_thread_runs_arch(void)
38
void before_thread_runs_arch(void)
38
{
39
{
39
    CPU->arch.tss->rsp0 = (__address) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA];
40
    CPU->arch.tss->rsp0 = (__address) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA];
40
 
41
 
41
    /* Syscall support - write thread stack address to hidden part of gs */
42
    /* Syscall support - write thread stack address to hidden part of gs */
42
    swapgs();
43
    swapgs();
43
    write_msr(AMD_MSR_GS,
44
    write_msr(AMD_MSR_GS,
44
          (__u64)&THREAD->kstack);
45
          (__u64)&THREAD->kstack);
45
    swapgs();
46
    swapgs();
46
 
47
 
47
 
-
 
48
#ifdef CONFIG_DEBUG_AS_WATCHPOINT
48
#ifdef CONFIG_DEBUG_AS_WATCHPOINT
49
    /* Set watchpoint on AS to ensure that nobody sets it to zero */
49
    /* Set watchpoint on AS to ensure that nobody sets it to zero */
50
    static int old_slot = -1;
-
 
51
    if (old_slot >=0)
50
    if (CPU->id < BKPOINTS_MAX)
52
        breakpoint_del(old_slot);
-
 
53
    old_slot = breakpoint_add(&((the_t *) THREAD->kstack)->as,
51
        breakpoint_add(&((the_t *) THREAD->kstack)->as,
54
                  BKPOINT_WRITE | BKPOINT_CHECK_ZERO);
52
                   BKPOINT_WRITE | BKPOINT_CHECK_ZERO,
-
 
53
                   CPU->id);
55
#endif
54
#endif
56
}
55
}
57
 
56
 
58
void after_thread_ran_arch(void)
57
void after_thread_ran_arch(void)
59
{
58
{