1 /*
2  * Copyright (c) 2019 Intel Corporation
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #ifndef ZEPHYR_ARCH_X86_INCLUDE_KERNEL_ARCH_DATA_H_
7 #define ZEPHYR_ARCH_X86_INCLUDE_KERNEL_ARCH_DATA_H_
8 
9 /*
10  * Exception/interrupt vector definitions: vectors 20 to 31 are reserved
11  * for Intel; vectors 32 to 255 are user defined interrupt vectors.
12  */
13 
14 #define IV_DIVIDE_ERROR 0
15 #define IV_DEBUG 1
16 #define IV_NON_MASKABLE_INTERRUPT 2
17 #define IV_BREAKPOINT 3
18 #define IV_OVERFLOW 4
19 #define IV_BOUND_RANGE 5
20 #define IV_INVALID_OPCODE 6
21 #define IV_DEVICE_NOT_AVAILABLE 7
22 #define IV_DOUBLE_FAULT 8
23 #define IV_COPROC_SEGMENT_OVERRUN 9
24 #define IV_INVALID_TSS 10
25 #define IV_SEGMENT_NOT_PRESENT 11
26 #define IV_STACK_FAULT 12
27 #define IV_GENERAL_PROTECTION 13
28 #define IV_PAGE_FAULT 14
29 #define IV_RESERVED 15
30 #define IV_X87_FPU_FP_ERROR 16
31 #define IV_ALIGNMENT_CHECK 17
32 #define IV_MACHINE_CHECK 18
33 #define IV_SIMD_FP 19
34 #define IV_VIRT_EXCEPTION 20
35 #define IV_CTRL_PROTECTION_EXCEPTION 21
36 #define IV_SECURITY_EXCEPTION 30
37 
38 #define IV_IRQS 32		/* start of vectors available for IRQs */
39 #define IV_NR_VECTORS 256	/* total number of vectors */
40 
41 /*
42  * EFLAGS/RFLAGS definitions. (RFLAGS is just zero-extended EFLAGS.)
43  */
44 
45 #define EFLAGS_IF	BIT(9)	/* interrupts enabled */
46 #define EFLAGS_DF	BIT(10)	/* Direction flag */
47 
48 #define EFLAGS_INITIAL	(EFLAGS_IF)
49 #define EFLAGS_SYSCALL	(EFLAGS_IF | EFLAGS_DF)
50 /*
51  * Control register definitions.
52  */
53 
54 #define CR0_PG		BIT(31)		/* enable paging */
55 #define CR0_WP		BIT(16)		/* honor W bit even when supervisor */
56 
57 #define CR4_PSE		BIT(4)		/* Page size extension (4MB pages) */
58 #define CR4_PAE		BIT(5)		/* enable PAE */
59 #define CR4_OSFXSR	BIT(9)		/* enable SSE (OS FXSAVE/RSTOR) */
60 
61 #ifndef _ASMLANGUAGE
62 
63 /* x86 boot argument (see prep_c.c) */
64 struct x86_boot_arg {
65 	int boot_type;
66 	void *arg;
67 };
68 
69 typedef struct x86_boot_arg x86_boot_arg_t;
70 
71 #endif /* _ASMLANGUAGE  */
72 
73 #ifdef CONFIG_X86_64
74 #include <intel64/kernel_arch_data.h>
75 #else
76 #include <ia32/kernel_arch_data.h>
77 #endif
78 
79 #endif /* ZEPHYR_ARCH_X86_INCLUDE_KERNEL_ARCH_DATA_H_ */
80