;**************************************************************************
;* Copyright (C) 2007 Loren Merritt <lorenm@u.washington.edu>
;*
;* This program is free software; you can redistribute it and/or modify
;* it under the terms of the GNU General Public License as published by
;* the Free Software Foundation; either version 2 of the License, or
;* (at your option) any later version.
;*
;* This program is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;* GNU General Public License for more details.
;*
;* You should have received a copy of the GNU General Public License
;* along with this program; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
;**************************************************************************

%include "amd64inc.asm"

section .text align=16

; int xlsc_cpuid_test( void )
cglobal xlsc_cpuid_test
    pushf
    pop    rax
    mov    ecx, eax
    xor    eax, 0x200000
    push   rax
    popf
    pushf
    pop    rax
    xor    eax, ecx
    ret

; void xlsc_cpuid( uint32_t op, uint32_t *regs )
cglobal xlsc_cpuid
    push   rbx
    mov    eax, parm1d
    cpuid
    mov    [parm2q+0], eax
    mov    [parm2q+4], ebx
    mov    [parm2q+8], ecx
    mov    [parm2q+12], edx
    pop    rbx
    ret

