]> 4ch.mooo.com Git - 16.git/blob - src/lib/doslib/hw/cpu/sseoff.c
added a bunch of things~ and midi stuff~
[16.git] / src / lib / doslib / hw / cpu / sseoff.c
1 /* sseoff.c
2  *
3  * Test program: Detecting SSE extensions, and switching them off
4  * (C) 2011-2012 Jonathan Campbell.
5  * Hackipedia DOS library.
6  *
7  * This code is licensed under the LGPL.
8  * <insert LGPL legal text here>
9  *
10  */
11
12 #include <stdio.h>
13 #include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
14 #include <stdlib.h>
15 #include <unistd.h>
16 #include <assert.h>
17 #include <fcntl.h>
18 #include <dos.h>
19
20 #include <hw/dos/dos.h>
21 #include <hw/cpu/cpu.h>
22 #include <hw/cpu/cpusse.h>
23
24 #ifdef TARGET_WINDOWS
25 # define WINFCON_STOCK_WIN_MAIN
26 # include <hw/dos/winfcon.h>
27 #endif
28
29 int main() {
30         cpu_probe();
31         probe_dos();
32         printf("Your CPU is basically a %s or higher\n",cpu_basic_level_to_string(cpu_basic_level));
33         if (cpu_v86_active) {
34                 printf(" - Your CPU is currently running me in virtual 8086 mode\n");
35         }
36
37         if (!cpu_check_sse_is_usable()) {
38                 printf("SSE not available to turn off.\n");
39                 printf("Reason: %s\n",cpu_sse_unusable_reason);
40                 printf("Detection method: %s\n",cpu_sse_usable_detection_method);
41                 printf("can turn off: %d\n",cpu_sse_usable_can_turn_off);
42                 printf("can turn on: %d\n",cpu_sse_usable_can_turn_on);
43                 return 1;
44         }
45
46         printf("SSE available, detection method: %s\n",cpu_sse_usable_detection_method);
47         printf("can turn off: %d\n",cpu_sse_usable_can_turn_off);
48         printf("can turn on: %d\n",cpu_sse_usable_can_turn_on);
49
50         if (!cpu_sse_usable_can_turn_off) {
51                 printf("I can't turn SSE off, giving up\n");
52                 return 1;
53         }
54
55         if (!cpu_sse_disable()) {
56                 printf("Failed to turn off SSE\n");
57                 return 1;
58         }
59
60         printf("SSE is now disabled.\n");
61         return 0;
62 }
63