Subversion Repositories HelenOS-historic

Rev

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

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