add the BOOTTLS for i386-pc also
[AROS.git] / arch / i386-pc / kernel / kernel_intern.h
blob1d65d1c48ba3d04ce875b966784c7d4e0587c55c
1 #ifndef KERNEL_INTERN_H_
2 #define KERNEL_INTERN_H_
3 /*
4 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
5 $Id$
7 Desc: 32bit x86 kernel_intern.h
8 Lang: english
9 */
11 #include <asm/cpu.h>
12 #include <hardware/vbe.h>
14 #include <inttypes.h>
16 typedef struct int_gate_32bit apicidt_t;
18 #include "apic.h"
20 #define STACK_SIZE 8192
21 #define PAGE_SIZE 0x1000
22 #define PAGE_MASK 0x0FFF
24 #define DEF_IRQRETFUNC core_DefaultIRET
27 * Boot-time private data.
28 * This structure is write-protected in user mode and survives warm restarts.
30 struct KernBootPrivate
32 IPTR _APICBase; /* Bootstrap APIC base address */
33 UWORD kbp_APIC_BSPID; /* Bootstrap APIC logical ID */
34 APTR BOOTTLS,
35 BOOTGDT,
36 BOOTIDT;
37 void *TSS;
38 struct CPUMMUConfig MMU;
41 extern struct KernBootPrivate *__KernBootPrivate;
43 /* Platform-specific part of KernelBase */
44 struct PlatformData
46 struct List kb_SysCallHandlers;
47 APTR kb_APIC_TrampolineBase;
48 struct ACPIData *kb_ACPI;
49 struct APICData *kb_APIC;
50 struct IOAPICData *kb_IOAPIC;
53 #define IDT_SIZE sizeof(apicidt_t) * 256
54 #define GDT_SIZE sizeof(long long) * 8
55 #define TLS_SIZE sizeof(struct tss)
56 #define TLS_ALIGN 64
58 #define __save_flags(x) __asm__ __volatile__("pushf ; pop %0":"=g" (x): /* no input */)
59 #define __restore_flags(x) __asm__ __volatile__("push %0 ; popf": /* no output */ :"g" (x):"memory", "cc")
61 #define krnLeaveSupervisorRing(_flags) \
62 asm("movl %[user_ds],%%eax\n\t" \
63 "mov %%eax,%%ds\n\t" \
64 "mov %%eax,%%es\n\t" \
65 "movl %%esp,%%ebx\n\t" \
66 "pushl %%eax\n\t" \
67 "pushl %%ebx\n\t" \
68 "pushl %[iflags]\n\t" \
69 "pushl %[cs]\n\t" \
70 "pushl $1f\n\t" \
71 "iret\n" \
72 "1:" \
73 : : [user_ds] "r" (USER_DS), [cs] "i" (USER_CS), \
74 [iflags] "i" (_flags) \
75 :"eax","ebx")
77 #define FLAGS_INTENABLED 0x3002
79 void vesahack_Init(char *cmdline, struct vbe_mode *vmode);
80 void core_Unused_Int(void);
82 /** CPU Functions **/
83 #if (0)
84 void core_SetupGDT(struct KernBootPrivate *, apicid_t, APTR, APTR, APTR);
85 void core_SetupMMU(struct KernBootPrivate *, IPTR memtop);
86 #endif
88 void core_CPUSetup(apicid_t, APTR, IPTR);
90 void ictl_Initialize(struct KernelBase *KernelBase);
93 /* HW IRQ Related Functions */
94 struct ExceptionContext;
95 extern const void *IntrDefaultGates[256];
97 void core_LeaveInterrupt(struct ExceptionContext *);
98 void core_Supervisor(struct ExceptionContext *);
100 void PlatformPostInit(void);
102 #endif /* KERNEL_INTERN_H_ */