14#ifndef ZEPHYR_INCLUDE_ARCH_X86_IA32_ARCH_H_
15#define ZEPHYR_INCLUDE_ARCH_X86_IA32_ARCH_H_
46#if defined(CONFIG_USERSPACE)
47#define GS_TLS_SEG (0x38 | 0x03)
48#elif defined(CONFIG_X86_STACK_PROTECTION)
49#define GS_TLS_SEG (0x28 | 0x03)
51#define GS_TLS_SEG (0x18 | 0x03)
58#define MK_ISR_NAME(x) __isr__##x
60#define Z_DYN_STUB_SIZE 4
61#define Z_DYN_STUB_OFFSET 0
62#define Z_DYN_STUB_LONG_JMP_EXTRA_SIZE 3
63#define Z_DYN_STUB_PER_BLOCK 32
120#define NANO_CPU_INT_REGISTER(r, n, p, v, d) \
121 static ISR_LIST __attribute__((section(".intList"))) \
122 __attribute__((used)) MK_ISR_NAME(r) = \
145#define _X86_IDT_TSS_REGISTER(tss_p, irq_p, priority_p, vec_p, dpl_p) \
146 static ISR_LIST __attribute__((section(".intList"))) \
147 __attribute__((used)) MK_ISR_NAME(vec_p) = \
151 .priority = (priority_p), \
171#define _VECTOR_ARG(irq_p) (-1)
173#ifdef CONFIG_LINKER_USE_PINNED_SECTION
174#define IRQSTUBS_TEXT_SECTION ".pinned_text.irqstubs"
176#define IRQSTUBS_TEXT_SECTION ".text.irqstubs"
197#define ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
199 __asm__ __volatile__( \
200 ".pushsection .intList\n\t" \
201 ".long %c[isr]_irq%c[irq]_stub\n\t"
\
202 ".long %c[irq]\n\t" \
203 ".long %c[priority]\n\t" \
204 ".long %c[vector]\n\t" \
208 ".pushsection " IRQSTUBS_TEXT_SECTION "\n\t" \
209 ".global %c[isr]_irq%c[irq]_stub\n\t" \
210 "%c[isr]_irq%c[irq]_stub:\n\t" \
211 "pushl %[isr_param]\n\t" \
213 "jmp _interrupt_enter\n\t" \
216 : [isr] "i" (isr_p), \
217 [isr_param] "i" (isr_param_p), \
218 [priority] "i" (priority_p), \
219 [vector] "i" _VECTOR_ARG(irq_p), \
220 [irq] "i" (irq_p)); \
221 z_irq_controller_irq_config(Z_IRQ_TO_INTERRUPT_VECTOR(irq_p), (irq_p), \
227#define ARCH_PCIE_IRQ_CONNECT(bdf_p, irq_p, priority_p, \
228 isr_p, isr_param_p, flags_p) \
229 ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p)
240#ifndef CONFIG_X86_KPTI
241#define ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \
243 NANO_CPU_INT_REGISTER(isr_p, irq_p, priority_p, -1, 0); \
244 z_irq_controller_irq_config(Z_IRQ_TO_INTERRUPT_VECTOR(irq_p), (irq_p), \
249static inline void arch_irq_direct_pm(
void)
253 z_pm_save_idle_exit();
257#define ARCH_ISR_DIRECT_PM() arch_irq_direct_pm()
259#define ARCH_ISR_DIRECT_PM() do { } while (false)
262#define ARCH_ISR_DIRECT_HEADER() arch_isr_direct_header()
263#define ARCH_ISR_DIRECT_FOOTER(swap) arch_isr_direct_footer(swap)
268#if defined(CONFIG_TRACING)
275#if defined(CONFIG_TRACING)
282 ++_kernel.cpus[0].nested;
294 z_irq_controller_eoi();
295#if defined(CONFIG_TRACING)
298 --_kernel.cpus[0].nested;
306 if (swap != 0 && _kernel.cpus[0].nested == 0 &&
307 _kernel.ready_q.cache != _current) {
323#define ARCH_ISR_DIRECT_DECLARE(name) \
324 static inline int name##_body(void); \
325 __attribute__ ((interrupt)) void name(void *stack_frame) \
327 ARG_UNUSED(stack_frame); \
328 int check_reschedule; \
329 ISR_DIRECT_HEADER(); \
330 check_reschedule = name##_body(); \
331 ISR_DIRECT_FOOTER(check_reschedule); \
333 static inline int name##_body(void)
371extern unsigned int z_x86_exception_vector;
373struct _x86_syscall_stack_frame {
387 __asm__
volatile (
"pushfl; cli; popl %0" :
"=g" (key) ::
"memory");
398#define NANO_SOFT_IRQ ((unsigned int) (-1))
400#ifdef CONFIG_X86_ENABLE_TSS
404#define ARCH_EXCEPT(reason_p) do { \
406 "push %[reason]\n\t" \
407 "int %[vector]\n\t" \
409 : [vector] "i" (Z_X86_OOPS_VECTOR), \
410 [reason] "i" (reason_p)); \
421#if defined(CONFIG_EAGER_FPU_SHARING) || defined(CONFIG_LAZY_FPU_SHARING)
423#define ARCH_DYNAMIC_OBJ_K_THREAD_ALIGNMENT 16
425#define ARCH_DYNAMIC_OBJ_K_THREAD_ALIGNMENT (sizeof(void *))
429#define ARCH_DYNAMIC_OBJ_K_THREAD_ALIGNMENT (sizeof(void *))
IA-32 specific gdbstub interface header.
x86 (IA32) specific syscall header
Per-arch thread definition.
#define ALWAYS_INLINE
Definition: common.h:129
void sys_trace_isr_enter(void)
Called when entering an ISR.
void sys_trace_isr_exit(void)
Called when exiting an ISR.
static ALWAYS_INLINE unsigned int arch_irq_lock(void)
Definition: arch.h:63
flags
Definition: parser.h:96
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
Exception Stack Frame.
Definition: arch.h:349
unsigned int eax
Definition: arch.h:363
unsigned int ecx
Definition: arch.h:364
unsigned int edi
Definition: arch.h:361
unsigned int ebp
Definition: arch.h:358
unsigned int ss
Definition: arch.h:351
unsigned int es
Definition: arch.h:354
unsigned int ds
Definition: arch.h:355
unsigned int gs
Definition: arch.h:352
unsigned int fs
Definition: arch.h:353
unsigned int cs
Definition: arch.h:367
unsigned int edx
Definition: arch.h:362
unsigned int esp
Definition: arch.h:357
unsigned int eflags
Definition: arch.h:368
unsigned int errorCode
Definition: arch.h:365
unsigned int eip
Definition: arch.h:366
unsigned int ebx
Definition: arch.h:359
unsigned int esi
Definition: arch.h:360
unsigned int tss
If nonzero, specifies a TSS segment selector.
Definition: arch.h:95
void * fnc
Address of ISR/stub.
Definition: arch.h:76
unsigned int dpl
Privilege level associated with ISR/stub.
Definition: arch.h:89
unsigned int irq
IRQ associated with the ISR/stub, or -1 if this is not associated with a real interrupt; in this case...
Definition: arch.h:81
unsigned int vec
Vector number associated with ISR/stub, or -1 to assign based on priority.
Definition: arch.h:87
unsigned int priority
Priority associated with the IRQ.
Definition: arch.h:83
Definition: segmentation.h:54
static void arch_isr_direct_footer(int swap)
Definition: arch.h:292
void arch_isr_direct_footer_swap(unsigned int key)
struct s_isrList ISR_LIST
static void arch_isr_direct_header(void)
Definition: arch.h:273