Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
d0a57cf9
Commit
d0a57cf9
authored
May 05, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
May 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineboot: Use __cpuid from intrin.h.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
48fa25d4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
47 deletions
+12
-47
wineboot.c
programs/wineboot/wineboot.c
+12
-47
No files found.
programs/wineboot/wineboot.c
View file @
d0a57cf9
...
...
@@ -57,6 +57,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <intrin.h>
#include <sys/stat.h>
#include <unistd.h>
#include <windows.h>
...
...
@@ -195,44 +196,7 @@ static DWORD set_reg_value_dword( HKEY hkey, const WCHAR *name, DWORD value )
#if defined(__i386__) || defined(__x86_64__)
#if defined(_MSC_VER)
static
void
do_cpuid
(
unsigned
int
ax
,
unsigned
int
*
p
)
{
__cpuid
(
p
,
ax
);
}
#elif defined(__i386__)
extern
void
__cdecl
do_cpuid
(
unsigned
int
ax
,
unsigned
int
*
p
);
__ASM_GLOBAL_FUNC
(
do_cpuid
,
"pushl %esi
\n\t
"
"pushl %ebx
\n\t
"
"movl 12(%esp),%eax
\n\t
"
"movl 16(%esp),%esi
\n\t
"
"cpuid
\n\t
"
"movl %eax,(%esi)
\n\t
"
"movl %ebx,4(%esi)
\n\t
"
"movl %ecx,8(%esi)
\n\t
"
"movl %edx,12(%esi)
\n\t
"
"popl %ebx
\n\t
"
"popl %esi
\n\t
"
"ret"
)
#else
extern
void
__cdecl
do_cpuid
(
unsigned
int
ax
,
unsigned
int
*
p
);
__ASM_GLOBAL_FUNC
(
do_cpuid
,
"pushq %rsi
\n\t
"
"pushq %rbx
\n\t
"
"movq %rcx,%rax
\n\t
"
"movq %rdx,%rsi
\n\t
"
"cpuid
\n\t
"
"movl %eax,(%rsi)
\n\t
"
"movl %ebx,4(%rsi)
\n\t
"
"movl %ecx,8(%rsi)
\n\t
"
"movl %edx,12(%rsi)
\n\t
"
"popq %rbx
\n\t
"
"popq %rsi
\n\t
"
"ret"
)
#endif
static
void
regs_to_str
(
unsigned
int
*
regs
,
unsigned
int
len
,
WCHAR
*
buffer
)
static
void
regs_to_str
(
int
*
regs
,
unsigned
int
len
,
WCHAR
*
buffer
)
{
unsigned
int
i
;
unsigned
char
*
p
=
(
unsigned
char
*
)
regs
;
...
...
@@ -259,18 +223,19 @@ static void get_identifier( WCHAR *buf, size_t size, const WCHAR *arch )
{
static
const
WCHAR
fmtW
[]
=
{
'%'
,
's'
,
' '
,
'F'
,
'a'
,
'm'
,
'i'
,
'l'
,
'y'
,
' '
,
'%'
,
'u'
,
' '
,
'M'
,
'o'
,
'd'
,
'e'
,
'l'
,
' '
,
'%'
,
'u'
,
' '
,
'S'
,
't'
,
'e'
,
'p'
,
'p'
,
'i'
,
'n'
,
'g'
,
' '
,
'%'
,
'u'
,
0
};
unsigned
int
regs
[
4
]
=
{
0
,
0
,
0
,
0
},
family
,
model
,
stepping
;
unsigned
int
family
,
model
,
stepping
;
int
regs
[
4
]
=
{
0
,
0
,
0
,
0
};
do_cpuid
(
1
,
regs
);
__cpuid
(
regs
,
1
);
model
=
get_model
(
regs
[
0
],
&
stepping
,
&
family
);
swprintf
(
buf
,
size
,
fmtW
,
arch
,
family
,
model
,
stepping
);
}
static
void
get_vendorid
(
WCHAR
*
buf
)
{
unsigned
int
tmp
,
regs
[
4
]
=
{
0
,
0
,
0
,
0
};
int
tmp
,
regs
[
4
]
=
{
0
,
0
,
0
,
0
};
do_cpuid
(
0
,
regs
);
__cpuid
(
regs
,
0
);
tmp
=
regs
[
2
];
/* swap edx and ecx */
regs
[
2
]
=
regs
[
3
];
regs
[
3
]
=
tmp
;
...
...
@@ -280,17 +245,17 @@ static void get_vendorid( WCHAR *buf )
static
void
get_namestring
(
WCHAR
*
buf
)
{
unsigned
int
regs
[
4
]
=
{
0
,
0
,
0
,
0
};
int
regs
[
4
]
=
{
0
,
0
,
0
,
0
};
int
i
;
do_cpuid
(
0x80000000
,
regs
);
__cpuid
(
regs
,
0x80000000
);
if
(
regs
[
0
]
>=
0x80000004
)
{
do_cpuid
(
0x80000002
,
regs
);
__cpuid
(
regs
,
0x80000002
);
regs_to_str
(
regs
,
16
,
buf
);
do_cpuid
(
0x80000003
,
regs
);
__cpuid
(
regs
,
0x80000003
);
regs_to_str
(
regs
,
16
,
buf
+
16
);
do_cpuid
(
0x80000004
,
regs
);
__cpuid
(
regs
,
0x80000004
);
regs_to_str
(
regs
,
16
,
buf
+
32
);
}
for
(
i
=
lstrlenW
(
buf
)
-
1
;
i
>=
0
&&
buf
[
i
]
==
' '
;
i
--
)
buf
[
i
]
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment