source: trunk/hal/x86_64/core/hal_kentry.S @ 51

Last change on this file since 51 was 51, checked in by max@…, 7 years ago

Create the core/ sub-directory for x86_64.

File size: 3.2 KB
RevLine 
[25]1/*
[29]2 * hal_kentry.S - Entry points into the kernel (traps, interrupts, syscalls)
[25]3 *
[29]4 * Copyright (c) 2017 Maxime Villard
[25]5 *
6 * This file is part of ALMOS-MKH.
7 *
8 * ALMOS-MKH is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2.0 of the License.
11 *
12 * ALMOS-MKH is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
[29]18 * along with ALMOS-MKH.; if not, write to the Free Software Foundation,
[25]19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
[29]22#define x86_ASM
23#include <hal_boot.h>
24#include <hal_kentry.h>
[25]25
[29]26#define TRAPENTRY(a)    \
27        pushq $(a);     \
28        jmp alltraps;
[25]29
[29]30#define ZTRAPENTRY(a) \
31        pushq $0; \
32        TRAPENTRY(a)
[25]33
[29]34        .text
35        .globl  hal_trap_entry
36        .type   hal_trap_entry, @function
[25]37
[45]38        /*
39         * General exceptions.
40         */
[29]41ASM_ENTRY(x86_trap00)
42        ZTRAPENTRY(T_DIVIDE)
[25]43
[29]44ASM_ENTRY(x86_trap01)
45        ZTRAPENTRY(T_TRCTRAP)
[25]46
[29]47ASM_ENTRY(x86_trap02)
48        ZTRAPENTRY(T_NMI)
[25]49
[29]50ASM_ENTRY(x86_trap03)
51        ZTRAPENTRY(T_BPTFLT)
[25]52
[29]53ASM_ENTRY(x86_trap04)
54        ZTRAPENTRY(T_OFLOW)
[25]55
[29]56ASM_ENTRY(x86_trap05)
57        ZTRAPENTRY(T_BOUND)
[25]58
[29]59ASM_ENTRY(x86_trap06)
60        ZTRAPENTRY(T_PRIVINFLT)
[25]61
[29]62ASM_ENTRY(x86_trap07)
63        ZTRAPENTRY(T_DNA)
[25]64
[29]65ASM_ENTRY(x86_trap08)
66        TRAPENTRY(T_DOUBLEFLT)
[25]67
[29]68ASM_ENTRY(x86_trap09)
69        ZTRAPENTRY(T_FPOPFLT)
[25]70
[29]71ASM_ENTRY(x86_trap0a)
72        TRAPENTRY(T_TSSFLT)
[25]73
[29]74ASM_ENTRY(x86_trap0b)
75        ZTRAPENTRY(T_SEGNPFLT)
[25]76
[29]77ASM_ENTRY(x86_trap0c)
78        ZTRAPENTRY(T_STKFLT)
[25]79
[29]80ASM_ENTRY(x86_trap0d)
81        ZTRAPENTRY(T_PROTFLT)
[25]82
[29]83ASM_ENTRY(x86_trap0e)
84        TRAPENTRY(T_PAGEFLT)
[25]85
[29]86ASM_ENTRY(x86_trap0f)
87        ZTRAPENTRY(T_ASTFLT)
[25]88
[29]89ASM_ENTRY(x86_trap10)
90        ZTRAPENTRY(T_ARITHTRAP)
[25]91
[29]92ASM_ENTRY(x86_trap11)
93        TRAPENTRY(T_ALIGNFLT)
[25]94
[29]95ASM_ENTRY(x86_trap12)
96        ZTRAPENTRY(T_MCA)
[25]97
[29]98ASM_ENTRY(x86_trap13)
99        ZTRAPENTRY(T_XMM)
[25]100
[29]101ASM_ENTRY(x86_trap14)
102ASM_ENTRY(x86_trap15)
103ASM_ENTRY(x86_trap16)
104ASM_ENTRY(x86_trap17)
105ASM_ENTRY(x86_trap18)
106ASM_ENTRY(x86_trap19)
107ASM_ENTRY(x86_trap1a)
108ASM_ENTRY(x86_trap1b)
109ASM_ENTRY(x86_trap1c)
110ASM_ENTRY(x86_trap1d)
111ASM_ENTRY(x86_trap1e)
112ASM_ENTRY(x86_trap1f)
113        /* 20 - 31 reserved for future exp */
114        ZTRAPENTRY(T_RESERVED)
[25]115
[45]116        /*
117         * LAPIC interrupts.
118         */
119ASM_ENTRY(x86_spurious)
120        ZTRAPENTRY(T_ASTFLT)
121
122
123
[29]124/*
125 * Arguments pushed on the stack:
126 *  tf_trapno
127 *  tf_err: Dummy inserted if not defined
128 *  tf_rip
129 *  tf_cs
130 *  tf_rflags
131 *  tf_rsp
132 *  tf_ss
133 */
134alltraps:
135        movq    %rsp,%rdi
136        call    hal_trap_entry
137        /* NOTREACHED */
[25]138
[29]139        .data
140        .globl  x86_traps
[45]141        .globl  x86_intrs
[29]142        .type   x86_traps, @object
[45]143        .type   x86_intrs, @object
[25]144
[29]145        .align  64
146x86_traps:
147        .quad   x86_trap00, x86_trap01
148        .quad   x86_trap02, x86_trap03
149        .quad   x86_trap04, x86_trap05
150        .quad   x86_trap06, x86_trap07
151        .quad   x86_trap08, x86_trap09
152        .quad   x86_trap0a, x86_trap0b
153        .quad   x86_trap0c, x86_trap0d
154        .quad   x86_trap0e, x86_trap0f
155        .quad   x86_trap10, x86_trap11
156        .quad   x86_trap12, x86_trap13
157        .quad   x86_trap14, x86_trap15
158        .quad   x86_trap16, x86_trap17
159        .quad   x86_trap18, x86_trap19
160        .quad   x86_trap1a, x86_trap1b
161        .quad   x86_trap1c, x86_trap1d
162        .quad   x86_trap1e, x86_trap1f
163
[45]164x86_intrs:
165        .quad   x86_spurious
166
Note: See TracBrowser for help on using the repository browser.