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_HW_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
123#define NANO_CPU_INT_REGISTER(r, n, p, v, d) \
124 static ISR_LIST __attribute__((section(".intList"))) \
125 __attribute__((used)) MK_ISR_NAME(r) = \
148#define _X86_IDT_TSS_REGISTER(tss_p, irq_p, priority_p, vec_p, dpl_p) \
149 static ISR_LIST __attribute__((section(".intList"))) \
150 __attribute__((used)) MK_ISR_NAME(r) = \
154 .priority = (priority_p), \
174#define _VECTOR_ARG(irq_p) (-1)
176#ifdef CONFIG_LINKER_USE_PINNED_SECTION
177#define IRQSTUBS_TEXT_SECTION ".pinned_text.irqstubs"
179#define IRQSTUBS_TEXT_SECTION ".text.irqstubs"
200#define ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
202 __asm__ __volatile__( \
203 ".pushsection .intList\n\t" \
204 ".long %c[isr]_irq%c[irq]_stub\n\t"
\
205 ".long %c[irq]\n\t" \
206 ".long %c[priority]\n\t" \
207 ".long %c[vector]\n\t" \
211 ".pushsection " IRQSTUBS_TEXT_SECTION "\n\t" \
212 ".global %c[isr]_irq%c[irq]_stub\n\t" \
213 "%c[isr]_irq%c[irq]_stub:\n\t" \
214 "pushl %[isr_param]\n\t" \
216 "jmp _interrupt_enter\n\t" \
219 : [isr] "i" (isr_p), \
220 [isr_param] "i" (isr_param_p), \
221 [priority] "i" (priority_p), \
222 [vector] "i" _VECTOR_ARG(irq_p), \
223 [irq] "i" (irq_p)); \
224 z_irq_controller_irq_config(Z_IRQ_TO_INTERRUPT_VECTOR(irq_p), (irq_p), \
235#ifndef CONFIG_X86_KPTI
236#define ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \
238 NANO_CPU_INT_REGISTER(isr_p, irq_p, priority_p, -1, 0); \
239 z_irq_controller_irq_config(Z_IRQ_TO_INTERRUPT_VECTOR(irq_p), (irq_p), \
244static inline void arch_irq_direct_pm(
void)
247 int32_t idle_val = _kernel.idle;
250 z_pm_save_idle_exit(idle_val);
254#define ARCH_ISR_DIRECT_PM() arch_irq_direct_pm()
256#define ARCH_ISR_DIRECT_PM() do { } while (false)
259#define ARCH_ISR_DIRECT_HEADER() arch_isr_direct_header()
260#define ARCH_ISR_DIRECT_FOOTER(swap) arch_isr_direct_footer(swap)
265#if defined(CONFIG_TRACING)
272#if defined(CONFIG_TRACING)
279 ++_kernel.cpus[0].nested;
291 z_irq_controller_eoi();
292#if defined(CONFIG_TRACING)
295 --_kernel.cpus[0].nested;
303 if (swap != 0 && _kernel.cpus[0].nested == 0 &&
304 _kernel.ready_q.cache != _current) {
320#define ARCH_ISR_DIRECT_DECLARE(name) \
321 static inline int name##_body(void); \
322 __attribute__ ((interrupt)) void name(void *stack_frame) \
324 ARG_UNUSED(stack_frame); \
325 int check_reschedule; \
326 ISR_DIRECT_HEADER(); \
327 check_reschedule = name##_body(); \
328 ISR_DIRECT_FOOTER(check_reschedule); \
330 static inline int name##_body(void)
368extern unsigned int z_x86_exception_vector;
370struct _x86_syscall_stack_frame {
384 __asm__
volatile (
"pushfl; cli; popl %0" :
"=g" (
key) ::
"memory");
395#define NANO_SOFT_IRQ ((unsigned int) (-1))
409#ifdef CONFIG_X86_ENABLE_TSS
413#define ARCH_EXCEPT(reason_p) do { \
415 "push %[reason]\n\t" \
416 "int %[vector]\n\t" \
418 : [vector] "i" (Z_X86_OOPS_VECTOR), \
419 [reason] "i" (reason_p)); \
430#if defined(CONFIG_EAGER_FPU_SHARING) || defined(CONFIG_LAZY_FPU_SHARING)
432#define ARCH_DYMANIC_OBJ_K_THREAD_ALIGNMENT 16
434#define ARCH_DYMANIC_OBJ_K_THREAD_ALIGNMENT (sizeof(void *))
438#define ARCH_DYMANIC_OBJ_K_THREAD_ALIGNMENT (sizeof(void *))
IA-32 specific gdbstub interface header.
x86 (IA32) specific sycall header
Per-arch thread definition.
#define ALWAYS_INLINE
Definition: common.h:116
void sys_trace_isr_enter(void)
Called when entering an ISR.
void sys_trace_isr_exit(void)
Called when exiting an ISR.
flags
Definition: http_parser.h:131
static k_spinlock_key_t key
Definition: spinlock_error_case.c:14
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__INT32_TYPE__ int32_t
Definition: stdint.h:44
Exception Stack Frame.
Definition: arch.h:346
unsigned int eax
Definition: arch.h:360
unsigned int ecx
Definition: arch.h:361
unsigned int edi
Definition: arch.h:358
unsigned int ebp
Definition: arch.h:355
unsigned int ss
Definition: arch.h:348
unsigned int es
Definition: arch.h:351
unsigned int ds
Definition: arch.h:352
unsigned int gs
Definition: arch.h:349
unsigned int fs
Definition: arch.h:350
unsigned int cs
Definition: arch.h:364
unsigned int edx
Definition: arch.h:359
unsigned int esp
Definition: arch.h:354
unsigned int eflags
Definition: arch.h:365
unsigned int errorCode
Definition: arch.h:362
unsigned int eip
Definition: arch.h:363
unsigned int ebx
Definition: arch.h:356
unsigned int esi
Definition: arch.h:357
unsigned int tss
Definition: arch.h:95
void * fnc
Definition: arch.h:76
unsigned int dpl
Definition: arch.h:89
unsigned int irq
Definition: arch.h:81
unsigned int vec
Definition: arch.h:87
unsigned int priority
Definition: arch.h:83
Definition: segmentation.h:54
static void arch_isr_direct_footer(int swap)
Definition: arch.h:289
static ALWAYS_INLINE unsigned int arch_irq_lock(void)
Definition: arch.h:380
void arch_isr_direct_footer_swap(unsigned int key)
struct s_isrList ISR_LIST
static void arch_isr_direct_header(void)
Definition: arch.h:270