Changes in / [50989793:d7365604] in mainline


Ignore:
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/cpu/cpu.c

    r50989793 rd7365604  
    130130        CPU->arch.vendor = VendorUnknown;
    131131        if (has_cpuid()) {
    132                 cpuid(0, &info);
     132                cpuid(INTEL_CPUID_LEVEL, &info);
    133133
    134134                /*
     
    150150                }
    151151                               
    152                 cpuid(1, &info);
     152                cpuid(INTEL_CPUID_STANDARD, &info);
    153153                CPU->arch.family = (info.cpuid_eax >> 8) & 0xf;
    154154                CPU->arch.model = (info.cpuid_eax >> 4) & 0xf;
  • kernel/arch/ia32/include/cpu.h

    r50989793 rd7365604  
    5050#include <arch/pm.h>
    5151#include <arch/asm.h>
     52#include <arch/cpuid.h>
    5253
    5354typedef struct {
     
    5657        unsigned int model;
    5758        unsigned int stepping;
     59        cpuid_feature_info fi;
     60
    5861        tss_t *tss;
    5962       
  • kernel/arch/ia32/include/cpuid.h

    r50989793 rd7365604  
    6363
    6464struct __cpuid_feature_info {
    65         unsigned                        : 23;
     65        unsigned      : 11;
     66        unsigned sep  :  1;
     67        unsigned      : 11;
    6668        unsigned mmx  :  1;
    6769        unsigned fxsr :  1;
  • kernel/arch/ia32/src/boot/boot.S

    r50989793 rd7365604  
    8585        pse_supported:
    8686       
    87         bt $(INTEL_SEP), %edx
    88         jc sep_supported
    89        
    90                 movl $sep_msg, %esi
    91                 jmp error_halt
    92        
    93         sep_supported:
    94 
    9587#include "vesa_prot.inc"
    9688
     
    225217        .asciz "Page Size Extension not supported. System halted."
    226218
    227 sep_msg:
    228         .asciz "SYSENTER/SYSEXIT not supported. System halted."
  • kernel/arch/ia32/src/cpu/cpu.c

    r50989793 rd7365604  
    9292void cpu_arch_init(void)
    9393{
    94         cpuid_feature_info fi;
    9594        cpuid_extended_feature_info efi;
    9695        cpu_info_t info;
     
    102101        CPU->fpu_owner = NULL;
    103102       
    104         cpuid(1, &info);
     103        cpuid(INTEL_CPUID_STANDARD, &info);
    105104       
    106         fi.word = info.cpuid_edx;
     105        CPU->arch.fi.word = info.cpuid_edx;
    107106        efi.word = info.cpuid_ecx;
    108107       
    109         if (fi.bits.fxsr)
     108        if (CPU->arch.fi.bits.fxsr)
    110109                fpu_fxsr();
    111110        else
    112111                fpu_fsr();
    113112       
    114         if (fi.bits.sse) {
     113        if (CPU->arch.fi.bits.sse) {
    115114                asm volatile (
    116115                        "mov %%cr4, %[help]\n"
     
    122121        }
    123122       
    124         /* Setup fast SYSENTER/SYSEXIT syscalls */
    125         syscall_setup_cpu();
     123        if (CPU->arch.fi.bits.sep) {
     124                /* Setup fast SYSENTER/SYSEXIT syscalls */
     125                syscall_setup_cpu();
     126        }
    126127}
    127128
     
    132133        CPU->arch.vendor = VendorUnknown;
    133134        if (has_cpuid()) {
    134                 cpuid(0, &info);
     135                cpuid(INTEL_CPUID_LEVEL, &info);
    135136
    136137                /*
     
    150151                        CPU->arch.vendor = VendorIntel;
    151152               
    152                 cpuid(1, &info);
     153                cpuid(INTEL_CPUID_STANDARD, &info);
    153154                CPU->arch.family = (info.cpuid_eax >> 8) & 0x0f;
    154155                CPU->arch.model = (info.cpuid_eax >> 4) & 0x0f;
  • kernel/arch/ia32/src/proc/scheduler.c

    r50989793 rd7365604  
    6161            SP_DELTA];
    6262       
    63         /* Set kernel stack for CP3 -> CPL0 switch via SYSENTER */
    64         write_msr(IA32_MSR_SYSENTER_ESP, kstk);
     63        if (CPU->arch.fi.bits.sep) {
     64                /* Set kernel stack for CP3 -> CPL0 switch via SYSENTER */
     65                write_msr(IA32_MSR_SYSENTER_ESP, kstk);
     66        }
    6567       
    6668        /* Set kernel stack for CPL3 -> CPL0 switch via interrupt */
  • kernel/arch/ia32/src/userspace.c

    r50989793 rd7365604  
    7070                "movl %[uarg], %%eax\n"
    7171               
    72                 /* %ebx is defined to hold pcb_ptr - set it to 0 */
    73                 "xorl %%ebx, %%ebx\n"
     72                /* %edi is defined to hold pcb_ptr - set it to 0 */
     73                "xorl %%edi, %%edi\n"
    7474               
    7575                "iret\n"
  • uspace/lib/libc/arch/ia32/include/syscall.h

    r50989793 rd7365604  
    4040#include <kernel/syscall/syscall.h>
    4141
    42 #define __syscall0      __syscall_sysenter
    43 #define __syscall1      __syscall_sysenter
    44 #define __syscall2      __syscall_sysenter
    45 #define __syscall3      __syscall_sysenter
    46 #define __syscall4      __syscall_sysenter
    47 #define __syscall5      __syscall_int
    48 #define __syscall6      __syscall_int
     42#define __syscall0      __syscall_fast_func
     43#define __syscall1      __syscall_fast_func
     44#define __syscall2      __syscall_fast_func
     45#define __syscall3      __syscall_fast_func
     46#define __syscall4      __syscall_fast_func
     47#define __syscall5      __syscall_slow
     48#define __syscall6      __syscall_slow
    4949
    5050extern sysarg_t
    51 __syscall_sysenter(const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t,
    52     const sysarg_t, const sysarg_t, const syscall_t);
     51(* __syscall_fast_func)(const sysarg_t, const sysarg_t, const sysarg_t,
     52    const sysarg_t, const sysarg_t, const sysarg_t, const syscall_t);
    5353
    5454extern sysarg_t
    55 __syscall_int(const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t,
    56      const sysarg_t, const sysarg_t, const syscall_t);
     55__syscall_slow(const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t,
     56    const sysarg_t, const sysarg_t, const syscall_t);
    5757
    5858#endif
  • uspace/lib/libc/arch/ia32/src/entry.s

    r50989793 rd7365604  
    2727#
    2828
     29INTEL_CPUID_STANDARD = 1
     30INTEL_SEP = 11
     31
    2932.section .init, "ax"
    3033
     
    3538## User-space task entry point
    3639#
    37 # %ebx contains the PCB pointer
     40# %edi contains the PCB pointer
    3841#
    3942__entry:
     
    4447        # Do not set %gs, it contains descriptor that can see TLS
    4548
     49        # Detect the mechanism used for making syscalls
     50        movl $(INTEL_CPUID_STANDARD), %eax
     51        cpuid
     52        bt $(INTEL_SEP), %edx
     53        jnc 0f
     54        leal __syscall_fast_func, %eax
     55        movl $__syscall_fast, (%eax)
     560:
     57
    4658        # Pass the PCB pointer to __main as the first argument
    47         pushl %ebx
     59        pushl %edi
    4860        call __main
    4961
  • uspace/lib/libc/arch/ia32/src/syscall.S

    r50989793 rd7365604  
    2727#
    2828
     29.data
     30
     31.global __syscall_fast_func
     32__syscall_fast_func:
     33        .long __syscall_slow
     34
    2935.text
    3036
     
    3541 * could benefit from this and not save unused registers on the stack.
    3642 */
    37 .global __syscall_int
    38 __syscall_int:
     43.global __syscall_slow
     44__syscall_slow:
    3945        pushl %ebx
    4046        pushl %esi
     
    6470 * segment, otherwise the SYSENTER wouldn't work in the first place).
    6571 */
    66 .global __syscall_sysenter
    67 __syscall_sysenter:
     72.global __syscall_fast
     73__syscall_fast:
    6874        pushl %ebx
    6975        pushl %esi
  • uspace/srv/loader/arch/ia32/ia32.s

    r50989793 rd7365604  
    4040        movl 0x8(%ebp), %eax
    4141
    42         # %ebx := pcb
    43         # pcb is passed to the entry point int %ebx
    44         mov 0xc(%ebp), %ebx
     42        # %edi := pcb
     43        # pcb is passed to the entry point in %edi
     44        mov 0xc(%ebp), %edi
    4545
    4646        # Save a tiny bit of stack space
Note: See TracChangeset for help on using the changeset viewer.