14#ifndef ZEPHYR_INCLUDE_ARCH_X86_IA32_ARCH_H_
15#define ZEPHYR_INCLUDE_ARCH_X86_IA32_ARCH_H_
47#if defined(CONFIG_USERSPACE)
48#define GS_TLS_SEG (0x38 | 0x03)
49#elif defined(CONFIG_X86_STACK_PROTECTION)
50#define GS_TLS_SEG (0x28 | 0x03)
52#define GS_TLS_SEG (0x18 | 0x03)
59#define MK_ISR_NAME(x) __isr__##x
61#define Z_DYN_STUB_SIZE 4
62#define Z_DYN_STUB_OFFSET 0
63#define Z_DYN_STUB_LONG_JMP_EXTRA_SIZE 3
64#define Z_DYN_STUB_PER_BLOCK 32
121#define NANO_CPU_INT_REGISTER(r, n, p, v, d) \
122 static ISR_LIST __attribute__((section(".intList"))) \
123 __attribute__((used)) MK_ISR_NAME(r) = \
146#define _X86_IDT_TSS_REGISTER(tss_p, irq_p, priority_p, vec_p, dpl_p) \
147 static ISR_LIST __attribute__((section(".intList"))) \
148 __attribute__((used)) MK_ISR_NAME(vec_p) = \
152 .priority = (priority_p), \
172#define _VECTOR_ARG(irq_p) (-1)
174#ifdef CONFIG_LINKER_USE_PINNED_SECTION
175#define IRQSTUBS_TEXT_SECTION ".pinned_text.irqstubs"
177#define IRQSTUBS_TEXT_SECTION ".text.irqstubs"
198#define ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
200 __asm__ __volatile__( \
201 ".pushsection .intList\n\t" \
202 ".long %c[isr]_irq%c[irq]_stub\n\t" \
203 ".long %c[irq]\n\t" \
204 ".long %c[priority]\n\t" \
205 ".long %c[vector]\n\t" \
209 ".pushsection " IRQSTUBS_TEXT_SECTION "\n\t" \
210 ".global %c[isr]_irq%c[irq]_stub\n\t" \
211 "%c[isr]_irq%c[irq]_stub:\n\t" \
212 "pushl %[isr_param]\n\t" \
214 "jmp _interrupt_enter\n\t" \
217 : [isr] "i" (isr_p), \
218 [isr_param] "i" (isr_param_p), \
219 [priority] "i" (priority_p), \
220 [vector] "i" _VECTOR_ARG(irq_p), \
221 [irq] "i" (irq_p)); \
222 z_irq_controller_irq_config(Z_IRQ_TO_INTERRUPT_VECTOR(irq_p), (irq_p), \
228#define ARCH_PCIE_IRQ_CONNECT(bdf_p, irq_p, priority_p, \
229 isr_p, isr_param_p, flags_p) \
230 ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p)
241#ifndef CONFIG_X86_KPTI
242#define ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \
244 NANO_CPU_INT_REGISTER(isr_p, irq_p, priority_p, -1, 0); \
245 z_irq_controller_irq_config(Z_IRQ_TO_INTERRUPT_VECTOR(irq_p), (irq_p), \
250static inline void arch_irq_direct_pm(
void)
258#define ARCH_ISR_DIRECT_PM() arch_irq_direct_pm()
260#define ARCH_ISR_DIRECT_PM() do { } while (false)
263#define ARCH_ISR_DIRECT_HEADER() arch_isr_direct_header()
264#define ARCH_ISR_DIRECT_FOOTER(swap) arch_isr_direct_footer(swap)
269#if defined(CONFIG_TRACING)
276#if defined(CONFIG_TRACING)
283 ++_kernel.cpus[0].nested;
295 z_irq_controller_eoi();
296#if defined(CONFIG_TRACING)
299 --_kernel.cpus[0].nested;
307 if (swap != 0 && _kernel.cpus[0].nested == 0 &&
308 _kernel.ready_q.cache != _current) {
324#define ARCH_ISR_DIRECT_DECLARE(name) \
325 static inline int name##_body(void); \
326 __attribute__ ((interrupt)) void name(void *stack_frame) \
328 ARG_UNUSED(stack_frame); \
329 int check_reschedule; \
330 ISR_DIRECT_HEADER(); \
331 check_reschedule = name##_body(); \
332 ISR_DIRECT_FOOTER(check_reschedule); \
334 static inline int name##_body(void)
341 __asm__
volatile (
"pushfl; cli; popl %0" :
"=g" (
key) ::
"memory");
352#define NANO_SOFT_IRQ ((unsigned int) (-1))
354#ifdef CONFIG_X86_ENABLE_TSS
358#define ARCH_EXCEPT(reason_p) do { \
360 "push %[reason]\n\t" \
361 "int %[vector]\n\t" \
363 : [vector] "i" (Z_X86_OOPS_VECTOR), \
364 [reason] "i" (reason_p)); \
375#if defined(CONFIG_EAGER_FPU_SHARING) || defined(CONFIG_LAZY_FPU_SHARING)
377#define ARCH_DYNAMIC_OBJ_K_THREAD_ALIGNMENT 16
379#define ARCH_DYNAMIC_OBJ_K_THREAD_ALIGNMENT (sizeof(void *))
383#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 pm_system_resume(void)
Notify exit from kernel sleep.
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
static k_spinlock_key_t key
Definition spinlock_error_case.c:15
unsigned int tss
If nonzero, specifies a TSS segment selector.
Definition arch.h:96
void * fnc
Address of ISR/stub.
Definition arch.h:77
unsigned int dpl
Privilege level associated with ISR/stub.
Definition arch.h:90
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:82
unsigned int vec
Vector number associated with ISR/stub, or -1 to assign based on priority.
Definition arch.h:88
unsigned int priority
Priority associated with the IRQ.
Definition arch.h:84
Definition segmentation.h:54
static void arch_isr_direct_footer(int swap)
Definition arch.h:293
void arch_isr_direct_footer_swap(unsigned int key)
struct s_isrList ISR_LIST
static void arch_isr_direct_header(void)
Definition arch.h:274