FreeNOS
ARMException.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include <MemoryBlock.h>
19#include "ARMException.h"
20#include "ARMCore.h"
21#include <Log.h>
22
24
26 : m_vecTable(base)
27{
29
30 // First enable low interrupt vector base to allow re-mapping
31 u32 v = sysctrl_read();
32 v &= ~(1 << 13);
34
35 // Remap to requested base address
36 vbar_set(base);
37}
38
Address handlerTable
Address vecTable[]
Result
Result codes.
Address m_vecTable
ARM exception vector jump table.
void Handler(struct CPUState state)
Function which is called when the CPU is interrupted.
Result install(ExceptionType vector, Handler handler)
Install an exception handler.
ARMException(Address base)
Constructor.
ExceptionType
ARM exception types.
static Size copy(void *dest, const void *src, Size count)
Copy memory from one place to another.
#define sysctrl_read()
Read System Control register.
Definition ARMCore.h:127
#define vbar_set(addr)
Change Vector Base Address (VBAR)
Definition ARMCore.h:121
#define sysctrl_write(val)
Write System Control register.
Definition ARMCore.h:133
#define ARM_EX_VECTAB_SIZE
Size of the ARM exception vector table in bytes.
unsigned int u32
Unsigned 32-bit number.
Definition Types.h:53
unsigned long Address
A memory address.
Definition Types.h:131