SyterKit
0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
include
arch
arm32
jmp.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0+ */
2
3
#ifndef _JMP_H_
4
#define _JMP_H_
5
6
/*
7
* The code reads the value from the ACTLR register,
8
* sets the 6th bit of the register, and then writes the modified
9
* value back to the ACTLR register using coprocessor
10
* 15 (CP15) and its control register (CR).
11
*/
12
static
inline
void
enable_kernel_smp
(
void
) {
13
// Read ACTLR from coprocessor 15 (CP15), register c1
14
asm
volatile
(
"MRC p15, 0, r0, c1, c0, 1"
);
15
// Perform bitwise OR operation on register r0 with 0x040,
16
// setting bit 6 This is to set the 6th bit of the ACTLR register
17
asm
volatile
(
"ORR r0, r0, #0x040"
);
18
// Write the value in register r0 to coprocessor 15 (CP15),
19
// register c1 Writing back the modified value to the ACTLR register
20
asm
volatile
(
"MCR p15, 0, r0, c1, c0, 1"
);
21
}
22
23
static
inline
void
syterkit_jmp
(
uint32_t
addr) {
24
// Move the constant value 0 into register r2
25
asm
volatile
(
"mov r2, #0"
);
26
27
// Execute privileged instruction using coprocessor 15 (CP15),
28
// writing the value of register r2 to the Data ram latency
29
// control bit of the Cache Size Selection Register (CSSR)
30
// This sets the Data ram latency control bit of CSSR to 0
31
asm
volatile
(
"mcr p15, 0, r2, c7, c5, 6"
);
32
33
// Branch to the address stored in register r0,
34
// performing an unconditional jump to that location
35
asm
volatile
(
"bx r0"
);
36
}
37
38
static
inline
void
jmp_to_fel
() {
39
syterkit_jmp
(0x20);
40
}
41
42
static
inline
void
syterkit_jmp_kernel
(
uint32_t
addr,
uint32_t
fdt) {
43
void (*kernel_entry)(
int
zero,
int
arch,
unsigned
int
params);
44
kernel_entry = (void (*)(int, int,
unsigned
int)) addr;
45
kernel_entry(0, ~0, (
unsigned
int
) fdt);
46
}
47
48
49
#endif
// _JMP_H_
uint32_t
u32_t uint32_t
Definition
stdint.h:13
jmp_to_fel
static void jmp_to_fel()
Definition
jmp.h:38
syterkit_jmp
static void syterkit_jmp(uint32_t addr)
Definition
jmp.h:23
enable_kernel_smp
static void enable_kernel_smp(void)
Definition
jmp.h:12
syterkit_jmp_kernel
static void syterkit_jmp_kernel(uint32_t addr, uint32_t fdt)
Definition
jmp.h:42
Generated by
1.9.8