Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ; -------- Fast System Call init ----------
  2. ; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
  3.            bt [cpu_caps], CAPS_SEP
  4.            jnc .SEnP   ; SysEnter not Present
  5.            xor edx, edx
  6.            mov ecx, MSR_SYSENTER_CS
  7.            mov eax, os_code
  8.            wrmsr
  9.            mov ecx, MSR_SYSENTER_ESP
  10. ;           mov eax, sysenter_stack ; Check it
  11.            xor     eax, eax
  12.            wrmsr
  13.            mov ecx, MSR_SYSENTER_EIP
  14.            mov eax, sysenter_entry
  15.            wrmsr
  16. .SEnP:
  17. ; AMD SYSCALL/SYSRET
  18.            cmp byte[cpu_vendor], 'A'
  19.            jne .noSYSCALL
  20.            mov eax, 0x80000001
  21.            cpuid
  22.            test edx, 0x800  ; bit_11 - SYSCALL/SYSRET support
  23.            jz .noSYSCALL
  24.            mov ecx, MSR_AMD_EFER
  25.            rdmsr
  26.            or eax, 1   ; bit_0 - System Call Extension (SCE)
  27.            wrmsr
  28.  
  29.         ; !!!! It`s dirty hack, fix it !!!
  30.         ; Bits of EDX :
  31.         ; Bit 31–16 During the SYSRET instruction, this field is copied into the CS register
  32.         ;  and the contents of this field, plus 8, are copied into the SS register.
  33.         ; Bit 15–0 During the SYSCALL instruction, this field is copied into the CS register
  34.         ;  and the contents of this field, plus 8, are copied into the SS register.
  35.  
  36.         ; mov   edx, (os_code + 16) * 65536 + os_code
  37.            mov edx, 0x1B0013
  38.  
  39.            mov eax, syscall_entry
  40.            mov ecx, MSR_AMD_STAR
  41.            wrmsr
  42. .noSYSCALL:
  43. ; -----------------------------------------