revert between 56095 -> 55830 in arch
[AROS.git] / arch / i386-pc / kernel / kernel_intern.h
blob91408f17812e1caafaf04e84cc55b6ff4a103107
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 <inttypes.h>
13 #include <aros/kernel.h>
14 #include <utility/tagitem.h>
15 #include <asm/cpu.h>
16 #include <hardware/vbe.h>
18 typedef struct int_gate_32bit apicidt_t;
20 #include "apic.h"
22 #define STACK_SIZE 8192
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 #define IDT_SIZE sizeof(apicidt_t) * 256
44 #define GDT_SIZE sizeof(long long) * 8
45 #define TLS_SIZE sizeof(struct tss)
46 #define TLS_ALIGN 64
48 #define __save_flags(x) __asm__ __volatile__("pushf ; pop %0":"=g" (x): /* no input */)
49 #define __restore_flags(x) __asm__ __volatile__("push %0 ; popf": /* no output */ :"g" (x):"memory", "cc")
51 #define krnLeaveSupervisorRing(_flags) \
52 asm("movl %[user_ds],%%eax\n\t" \
53 "mov %%eax,%%ds\n\t" \
54 "mov %%eax,%%es\n\t" \
55 "movl %%esp,%%ebx\n\t" \
56 "pushl %%eax\n\t" \
57 "pushl %%ebx\n\t" \
58 "pushl %[iflags]\n\t" \
59 "pushl %[cs]\n\t" \
60 "pushl $1f\n\t" \
61 "iret\n" \
62 "1:" \
63 : : [user_ds] "r" (USER_DS), [cs] "i" (USER_CS), \
64 [iflags] "i" (_flags) \
65 :"eax","ebx")
67 #define FLAGS_INTENABLED 0x3002
69 void vesahack_Init(char *cmdline, struct vbe_mode *vmode);
70 void core_Unused_Int(void);
72 /** CPU Functions **/
73 #if (0)
74 void core_SetupGDT(struct KernBootPrivate *, apicid_t, APTR, APTR, APTR);
75 void core_SetupMMU(struct KernBootPrivate *, IPTR memtop);
76 #endif
78 void core_CPUSetup(apicid_t, APTR, IPTR);
80 void ictl_Initialize(struct KernelBase *KernelBase);
83 /* HW IRQ Related Functions */
84 struct ExceptionContext;
85 extern const void *IntrDefaultGates[256];
87 void core_LeaveInterrupt(struct ExceptionContext *);
88 void core_Supervisor(struct ExceptionContext *);
90 void PlatformPostInit(void);
92 #endif /* KERNEL_INTERN_H_ */