Subversion Repositories HelenOS

Rev

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

Rev 2071 Rev 2606
Line 50... Line 50...
50
    /* Enable SYSCALL/SYSRET */
50
    /* Enable SYSCALL/SYSRET */
51
    set_efer_flag(AMD_SCE_FLAG);
51
    set_efer_flag(AMD_SCE_FLAG);
52
 
52
 
53
    /* Setup syscall entry address */
53
    /* Setup syscall entry address */
54
   
54
   
55
    /* This is _mess_ - the 64-bit CS is argument+16,
55
    /* This is _mess_ - the 64-bit CS is argument + 16,
56
     * the SS is argument+8. The order is:
56
     * the SS is argument + 8. The order is:
57
     * +0(KDATA_DES), +8(UDATA_DES), +16(UTEXT_DES)
57
     * +0(KDATA_DES), +8(UDATA_DES), +16(UTEXT_DES)
58
     */
58
     */
59
    write_msr(AMD_MSR_STAR,
59
    write_msr(AMD_MSR_STAR,
60
          ((uint64_t)(gdtselector(KDATA_DES) | PL_USER)<<48) \
60
        ((uint64_t)(gdtselector(KDATA_DES) | PL_USER) << 48) |
61
          | ((uint64_t)(gdtselector(KTEXT_DES) | PL_KERNEL)<<32));
61
        ((uint64_t)(gdtselector(KTEXT_DES) | PL_KERNEL) << 32));
62
    write_msr(AMD_MSR_LSTAR, (uint64_t)syscall_entry);
62
    write_msr(AMD_MSR_LSTAR, (uint64_t)syscall_entry);
63
    /* Mask RFLAGS on syscall
63
    /* Mask RFLAGS on syscall
64
     * - disable interrupts, until we exchange the stack register
64
     * - disable interrupts, until we exchange the stack register
65
     *   (mask the IE bit)
65
     *   (mask the IE bit)
66
     */
66
     */