Debian Codegraph @

check/public-tests/instructions_w_t.c

raw
1 /*
2 * FCML - Free Code Manipulation Library.
3 * Copyright (C) 2010-2020 Slawomir Wojtasiak
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #include <fcml_assembler.h>
21 #include "instructions_w_t.h"
22 #include "instructions_base_t.h"
23
24 fcml_bool fcml_tf_instructions_w_suite_init(void) {
25 return FCML_TRUE;
26 }
27
28 fcml_bool fcml_tf_instructions_w_suite_cleanup(void) {
29 return FCML_TRUE;
30 }
31
32 void fcml_tf_instruction_WAIT(void) {
33
34 FCML_I3264( "wait", 0x9B );
35
36 FCML_A64( "wait", 0x9b );
37 FCML_A64_A( "fwait", 0x9b );
38 }
39
40 void fcml_tf_instruction_WBINVD(void) {
41
42 FCML_I3264( "wbinvd", 0x0F, 0x09 );
43
44 FCML_A3264( "wbinvd", 0x0f, 0x09 );
45 }
46
47 void fcml_tf_instruction_WRFSBASE(void) {
48
49 FCML_I64( "wrfsbase eax", 0xF3, 0x0F, 0xAE, 0xD0 );
50 FCML_I64( "wrfsbase eax", 0x66, 0xF3, 0x0F, 0xAE, 0xD0 );
51 FCML_I64( "wrfsbase rax", 0xF3, 0x48, 0x0F, 0xAE, 0xD0 );
52
53 FCML_I64( "wrgsbase eax", 0xF3, 0x0F, 0xAE, 0xD8 );
54 FCML_I64( "wrgsbase eax", 0x66, 0xF3, 0x0F, 0xAE, 0xD8 );
55 FCML_I64( "wrgsbase rax", 0xF3, 0x48, 0x0F, 0xAE, 0xD8 );
56
57 FCML_A64( "wrfsbase %eax", 0xf3, 0x0f, 0xae, 0xd0 );
58 FCML_A64( "wrfsbase %rax", 0xf3, 0x48, 0x0f, 0xae, 0xd0 );
59 FCML_A64( "wrgsbase %eax", 0xf3, 0x0f, 0xae, 0xd8 );
60 FCML_A64( "wrgsbase %rax", 0xf3, 0x48, 0x0f, 0xae, 0xd8 );
61 }
62
63 void fcml_tf_instruction_WRMSR(void) {
64
65 FCML_I32( "wrmsr", 0x0F, 0x30 );
66 FCML_I64( "wrmsr", 0x0F, 0x30 );
67
68 FCML_A64( "wrmsr", 0x0f, 0x30 );
69 FCML_A64( "wrmsr", 0x0f, 0x30 );
70 }
71
72 fcml_stf_test_case fctl_ti_instructions_w[] = {
73 { "fcml_tf_instruction_WAIT", fcml_tf_instruction_WAIT },
74 { "fcml_tf_instruction_WBINVD", fcml_tf_instruction_WBINVD },
75 { "fcml_tf_instruction_WRFSBASE", fcml_tf_instruction_WRFSBASE },
76 { "fcml_tf_instruction_WRMSR", fcml_tf_instruction_WRMSR },
77 FCML_STF_NULL_TEST
78 };
79
80 fcml_stf_test_suite fctl_si_instructions_w = {
81 "suite-fctl_ti_instructions_w", fcml_tf_instructions_w_suite_init, fcml_tf_instructions_w_suite_cleanup, fctl_ti_instructions_w
82 };
83