source: mainline/kernel/arch/arm64/include/arch/exception.h@ 84176f3

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 84176f3 was 84176f3, checked in by Jakub Jermář <jakub@…>, 7 years ago

arm64: Add support for the architecture

This changeset adds basic support to run HelenOS on AArch64, targeting
the QEMU virt platform.

Boot:

  • Boot relies on the EDK II firmware, GRUB2 for EFI and the HelenOS bootloader (UEFI application). EDK II loads GRUB2 from a CD, GRUB2 loads the HelenOS bootloader (via UEFI) which loads OS components.
  • UEFI applications use the PE/COFF format and must be relocatable. The first problem is solved by manually having the PE/COFF headers and tables written in assembler. The relocatable requirement is addressed by compiling the code with -fpic and having the bootloader relocate itself at its startup.

Kernel:

  • Kernel code for AArch64 consists mostly of stubbing out various architecture-specific hooks: virtual memory management, interrupt and exception handling, context switching (including FPU lazy switching), support for virtual timer, atomic sequences and barriers, cache and TLB maintenance, thread and process initialization.
  • The patch adds a kernel driver for GICv2 (interrupt controller).
  • The PL011 kernel driver is extended to allow userspace to take ownership of the console.
  • The current code is not able to dynamically obtain information about available devices on the underlying machine. The port instead implements a machine-func interface similar to the one implemented by arm32. It defines a machine for the QEMU AArch64 virt platform. The configuration (device addresses and IRQ numbers) is then baked into the machine definition.

User space:

  • Uspace code for AArch64 similarly mostly implements architecture-specific hooks: context saving/restoring, syscall support, TLS support.

The patchset allows to boot the system but user interaction with the OS
is not yet possible.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 * Copyright (c) 2016 Petr Pavlu
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup kernel_arm64
31 * @{
32 */
33/** @file
34 * @brief Exception declarations.
35 */
36
37#ifndef KERN_arm64_EXCEPTION_H_
38#define KERN_arm64_EXCEPTION_H_
39
40/* Exception numbers. */
41
42/** Current Exception level with SP_EL0, Synchronous. */
43#define EXC_CURRENT_EL_SP_SEL0_SYNCH 0
44/** Current Exception level with SP_EL0, IRQ or vIRQ. */
45#define EXC_CURRENT_EL_SP_SEL0_IRQ 1
46/** Current Exception level with SP_EL0, FIQ or vFIQ. */
47#define EXC_CURRENT_EL_SP_SEL0_FIQ 2
48/** Current Exception level with SP_EL0, SError or vSError. */
49#define EXC_CURRENT_EL_SP_SEL0_SERROR 3
50/** Current Exception level with SP_ELx, x > 0, Synchronous. */
51#define EXC_CURRENT_EL_SP_SELX_SYNCH 4
52/** Current Exception level with SP_ELx, x > 0, IRQ or vIRQ. */
53#define EXC_CURRENT_EL_SP_SELX_IRQ 5
54/** Current Exception level with SP_ELx, x > 0, FIQ or vFIQ. */
55#define EXC_CURRENT_EL_SP_SELX_FIQ 6
56/** Current Exception level with SP_ELx, x > 0, SError or vSError. */
57#define EXC_CURRENT_EL_SP_SELX_SERROR 7
58/** Lower Exception level, where the implemented level immediately lower than
59 * the target level is using AArch64, Synchronous.
60 */
61#define EXC_LOWER_EL_AARCH64_SYNCH 8
62/** Lower Exception level, where the implemented level immediately lower than
63 * the target level is using AArch64, IRQ or vIRQ.
64 */
65#define EXC_LOWER_EL_AARCH64_IRQ 9
66/** Lower Exception level, where the implemented level immediately lower than
67 * the target level is using AArch64, FIQ or vFIQ.
68 */
69#define EXC_LOWER_EL_AARCH64_FIQ 10
70/** Lower Exception level, where the implemented level immediately lower than
71 * the target level is using AArch64, SError or vSError.
72 */
73#define EXC_LOWER_EL_AARCH64_SERROR 11
74/** Lower Exception level, where the implemented level immediately lower than
75 * the target level is using AArch32, Synchronous.
76 */
77#define EXC_LOWER_EL_AARCH32_SYNCH 12
78/** Lower Exception level, where the implemented level immediately lower than
79 * the target level is using AArch32, IRQ or vIRQ.
80 */
81#define EXC_LOWER_EL_AARCH32_IRQ 13
82/** Lower Exception level, where the implemented level immediately lower than
83 * the target level is using AArch32, FIQ or vFIQ.
84 */
85#define EXC_LOWER_EL_AARCH32_FIQ 14
86/** Lower Exception level, where the implemented level immediately lower than
87 * the target level is using AArch32, SError or vSError.
88 */
89#define EXC_LOWER_EL_AARCH32_SERROR 15
90
91#ifndef __ASSEMBLER__
92extern void exception_init(void);
93#endif /* __ASSEMBLER__ */
94
95#endif
96
97/** @}
98 */
Note: See TracBrowser for help on using the repository browser.