aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--HISTORY.md4
-rw-r--r--Makefile30
-rw-r--r--docs/Latex/main.tex0
-rw-r--r--docs/interrupts.pngbin0 -> 38473 bytes
-rwxr-xr-xreadfromrpi.sh4
-rw-r--r--src/PL0/PL0_test.c (renamed from PL0_test.c)0
-rw-r--r--src/PL0/PL0_test.ld (renamed from PL0_test.ld)0
-rw-r--r--src/PL0/PL0_utils.c (renamed from PL0_utils.c)2
-rw-r--r--src/PL0/PL0_utils.h (renamed from PL0_utils.h)2
-rw-r--r--src/atags/atags.c (renamed from atags.c)2
-rw-r--r--src/atags/atags.h (renamed from atags.h)0
-rw-r--r--src/boot/kernel_stage1.S (renamed from kernel_stage1.S)4
-rw-r--r--src/boot/kernel_stage1.ld (renamed from kernel_stage1.ld)0
-rw-r--r--src/boot/kernel_stage2.ld (renamed from kernel_stage2.ld)0
-rw-r--r--src/boot/loader_stage1.S (renamed from loader_stage1.S)2
-rw-r--r--src/boot/loader_stage1_linker.ld (renamed from loader_stage1_linker.ld)0
-rw-r--r--src/boot/loader_stage2.c (renamed from loader_stage2.c)6
-rw-r--r--src/boot/loader_stage2_linker.ld (renamed from loader_stage2_linker.ld)0
-rw-r--r--src/boot/psr.h (renamed from psr.h)2
-rw-r--r--src/boot/setup.c (renamed from setup.c)75
-rw-r--r--src/clock/armclock.h (renamed from armclock.h)4
-rw-r--r--src/clock/bcmclock.h (renamed from bcmclock.h)4
-rw-r--r--src/demo/demo_functionality.c (renamed from demo_functionality.c)18
-rw-r--r--src/demo/demo_functionality.h (renamed from demo_functionality.h)0
-rw-r--r--src/global.h (renamed from global.h)15
-rw-r--r--src/interrupts/interrupt_vector.S (renamed from interrupt_vector.S)6
-rw-r--r--src/interrupts/interrupts.c (renamed from interrupts.c)43
-rw-r--r--src/interrupts/interrupts.h47
-rw-r--r--src/memory/cp_regs.h (renamed from cp_regs.h)0
-rw-r--r--src/memory/makefs.c (renamed from makefs.c)0
-rw-r--r--src/memory/memory.h (renamed from memory.h)0
-rw-r--r--src/memory/paging.c (renamed from paging.c)4
-rw-r--r--src/memory/paging.h (renamed from paging.h)0
-rw-r--r--src/memory/ramfs.c (renamed from ramfs.c)0
-rw-r--r--src/memory/ramfs.h (renamed from ramfs.h)0
-rw-r--r--src/memory/translation_table_descriptors.h (renamed from translation_table_descriptors.h)0
-rw-r--r--src/scheduler.c (renamed from scheduler.c)10
-rw-r--r--src/scheduler.h (renamed from scheduler.h)2
-rw-r--r--src/utils/io.c (renamed from io.c)0
-rw-r--r--src/utils/io.h (renamed from io.h)0
-rw-r--r--src/utils/pipe_image.c (renamed from pipe_image.c)2
-rw-r--r--src/utils/strings.c (renamed from strings.c)0
-rw-r--r--src/utils/strings.h (renamed from strings.h)0
-rw-r--r--src/utils/svc.S (renamed from svc.S)0
-rw-r--r--src/utils/svc_interface.h (renamed from svc_interface.h)0
-rw-r--r--src/utils/uart.c (renamed from uart.c)4
-rw-r--r--src/utils/uart.h (renamed from uart.h)3
48 files changed, 187 insertions, 110 deletions
diff --git a/.gitignore b/.gitignore
index 480597b..53f9ed5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+.gitignore
+.idea
*.o
*.elf
*.img
diff --git a/HISTORY.md b/HISTORY.md
index e63397d..21dee9f 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -51,4 +51,6 @@ used to do - echoing everything on uart. The privileged code would mark a memory
This was also an opportunity for us to check that the memory mapping truly works. We mapped virtual addresses 0xAAA00000 - 0xAAAFFFFF to physical addresses just after our kernel image and translation table (probably 0x00100000 - 0x001FFFFF given the small size of our kernel). The virtual address range 0xAAA00000 - 0xAAAFFFFF was also marked available for use by PL0 code. We then made kernel write the blob at 0x00100000 knowing it will also appear at virtual 0xAAA00000. Then, successfully running the unprivileged code from that address confirmed, that the mapping really works.
-There were 2 important things forgetting about which would stop us from succeeding in this step. The first one was the stack. Kernel used to use the memory just below itself (physical 0x8000) as the stack and since these addresses would not be available for PL0 code, a new stack had to be chosen - we set it somewhere on the high part of our unprivileged memory. The second important thing was marking the section in which the memory-mapped uart registers reside as accessible form PL0. This is because we were going to have unprivileged code write to uart by itself (and use the same uart code kernel uses...). Once we had interrupts programmed, this demo was to be improved to actually call the privileged code for writing and reading. \ No newline at end of file
+There were 2 important things forgetting about which would stop us from succeeding in this step. The first one was the stack. Kernel used to use the memory just below itself (physical 0x8000) as the stack and since these addresses would not be available for PL0 code, a new stack had to be chosen - we set it somewhere on the high part of our unprivileged memory. The second important thing was marking the section in which the memory-mapped uart registers reside as accessible form PL0. This is because we were going to have unprivileged code write to uart by itself (and use the same uart code kernel uses...). Once we had interrupts programmed, this demo was to be improved to actually call the privileged code for writing and reading.
+
+At that point we rearranged files, as it was becoming pretty unreadable having over 50 files cluttered in one directory so now we could start writing proper docs and modularize project. \ No newline at end of file
diff --git a/Makefile b/Makefile
index 1dc3d51..ed090a3 100644
--- a/Makefile
+++ b/Makefile
@@ -13,44 +13,42 @@ RAMFS_FILES=PL_0_test.img
all : kernel.img
+src = src:$(wildcard src/*)
+VPATH=$(src)
+
%.o : %.c
arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@
%.img : %.elf
arm-none-eabi-objcopy $^ -O binary $@
-%.o : %.S
+%.o: %.S
arm-none-eabi-as -mcpu=cortex-a7 $^ -o $@
%_embeddable.o : %.img
arm-none-eabi-objcopy -I binary -O elf32-littlearm -B arm $^ $@
-PL_0_test.elf : PL0_test.ld $(PL_0_TEST_OBJECTS)
+PL_0_test.elf : src/PL0/PL0_test.ld $(PL_0_TEST_OBJECTS)
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) $(PL_0_TEST_OBJECTS)
-kernel_stage1.o : kernel_stage1.S kernel_stage2.img
+kernel_stage1.o : src/boot/kernel_stage1.S kernel_stage2.img
arm-none-eabi-as -mcpu=cortex-a7 $< -o $@
-kernel.elf : kernel_stage1.ld kernel_stage1.o
+kernel.elf : src/boot/kernel_stage1.ld kernel_stage1.o
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) kernel_stage1.o
-kernel_stage2.elf : kernel_stage2.ld $(KERNEL_STAGE2_OBJECTS)
+kernel_stage2.elf : src/boot/kernel_stage2.ld $(KERNEL_STAGE2_OBJECTS)
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) $(KERNEL_STAGE2_OBJECTS)
-loader_stage2.elf : loader_stage2_linker.ld $(LOADER_STAGE2_OBJECTS)
+loader_stage2.elf : src/boot/loader_stage2_linker.ld $(LOADER_STAGE2_OBJECTS)
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) $(LOADER_STAGE2_OBJECTS)
-loader_stage1.o : loader_stage1.S loader_stage2.img
+loader_stage1.o : src/boot/loader_stage1.S loader_stage2.img
arm-none-eabi-as -mcpu=cortex-a7 $< -o $@
-loader.elf : loader_stage1_linker.ld loader_stage1.o
+loader.elf : src/boot/loader_stage1_linker.ld loader_stage1.o
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) loader_stage1.o
-loader.img : loader.elf
- arm-none-eabi-objcopy $^ -O binary $@
-# check if the resulting image is not too big
- test -n "$$(find $@ -size -16384c)" || exit -1
-
qemu-elf : kernel.elf
qemu-system-arm -m 256 -M raspi2 -serial stdio -kernel $^
@@ -64,16 +62,16 @@ run-on-rpi : kernel.img pipe_image
./pipe_image --stdout | sudo socat FILE:/dev/ttyUSB0,b115200,raw -
screen /dev/ttyUSB0 115200,cs8,-parenb,-cstopb,-hupcl
-pipe_image : pipe_image.c lib/rs232/rs232.c
+pipe_image : src/utils/pipe_image.c lib/rs232/rs232.c
gcc -Wall -std=gnu99 -O3 $^ -o $@
-makefs : makefs.c
+makefs : src/memory/makefs.c
gcc -Wall -std=gnu99 -O3 $^ -o $@
ramfs.img : makefs $(RAMFS_FILES)
./makefs $(RAMFS_FILES) > $@
clean :
- -rm *.img *.elf *.o pipe_image makefs
+ -rm -f *.img *.elf *.o pipe_image makefs
.PHONY: all qemu-elf qemu-bin clean
diff --git a/docs/Latex/main.tex b/docs/Latex/main.tex
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/docs/Latex/main.tex
diff --git a/docs/interrupts.png b/docs/interrupts.png
new file mode 100644
index 0000000..8973fa8
--- /dev/null
+++ b/docs/interrupts.png
Binary files differ
diff --git a/readfromrpi.sh b/readfromrpi.sh
new file mode 100755
index 0000000..3ebc469
--- /dev/null
+++ b/readfromrpi.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+sudo stty -F /dev/ttyUSB0 115200 cs8 -cstopb -parenb
+sudo chmod 777 /dev/ttyUSB0
+#cat -v < /dev/ttyUSB0
diff --git a/PL0_test.c b/src/PL0/PL0_test.c
index 0bfebc7..0bfebc7 100644
--- a/PL0_test.c
+++ b/src/PL0/PL0_test.c
diff --git a/PL0_test.ld b/src/PL0/PL0_test.ld
index b1d06f4..b1d06f4 100644
--- a/PL0_test.ld
+++ b/src/PL0/PL0_test.ld
diff --git a/PL0_utils.c b/src/PL0/PL0_utils.c
index d83edb9..b9853fb 100644
--- a/PL0_utils.c
+++ b/src/PL0/PL0_utils.c
@@ -1,7 +1,7 @@
#include <stddef.h>
#include <stdint.h>
-#include "svc_interface.h"
+#include "../utils/svc_interface.h"
#include "PL0_utils.h"
// most generic definition possible
diff --git a/PL0_utils.h b/src/PL0/PL0_utils.h
index c26a100..e87b1f0 100644
--- a/PL0_utils.h
+++ b/src/PL0/PL0_utils.h
@@ -1,6 +1,6 @@
#ifndef PL0_UTILS_H
#define PL0_UTILS_H
-#include "io.h"
+#include "../utils/io.h"
#endif // PL0_UTILS_H
diff --git a/atags.c b/src/atags/atags.c
index e2e6a24..54740d8 100644
--- a/atags.c
+++ b/src/atags/atags.c
@@ -1,5 +1,5 @@
#include "atags.h"
-#include "io.h"
+#include "../utils/io.h"
static inline struct atag_header *next_tag(struct atag_header *tag)
{
diff --git a/atags.h b/src/atags/atags.h
index 4b6879f..4b6879f 100644
--- a/atags.h
+++ b/src/atags/atags.h
diff --git a/kernel_stage1.S b/src/boot/kernel_stage1.S
index dd3e6fd..e770513 100644
--- a/kernel_stage1.S
+++ b/src/boot/kernel_stage1.S
@@ -8,7 +8,7 @@
*
* This file is based on (and almost identical with) loader_stage1.S
*/
-
+
.global _boot
_boot:
// Only let the first core execute
@@ -141,7 +141,7 @@ stage2_blob_copying: // copy stage2 of the kernel to address 0x0
// computing address of stage2_end into r7.
add r7, r3, r5
bx r7
-
+
blob_size:
.word stage2_end - stage2_start
stage1_size:
diff --git a/kernel_stage1.ld b/src/boot/kernel_stage1.ld
index 3130634..3130634 100644
--- a/kernel_stage1.ld
+++ b/src/boot/kernel_stage1.ld
diff --git a/kernel_stage2.ld b/src/boot/kernel_stage2.ld
index 9411ca2..9411ca2 100644
--- a/kernel_stage2.ld
+++ b/src/boot/kernel_stage2.ld
diff --git a/loader_stage1.S b/src/boot/loader_stage1.S
index 9326360..69d78c5 100644
--- a/loader_stage1.S
+++ b/src/boot/loader_stage1.S
@@ -50,6 +50,6 @@ loop:
bx r4
.align 4
-stage2_start:
+stage2_start:
.incbin "loader_stage2.img"
stage2_end:
diff --git a/loader_stage1_linker.ld b/src/boot/loader_stage1_linker.ld
index 711fcbf..711fcbf 100644
--- a/loader_stage1_linker.ld
+++ b/src/boot/loader_stage1_linker.ld
diff --git a/loader_stage2.c b/src/boot/loader_stage2.c
index 15d2003..e08756b 100644
--- a/loader_stage2.c
+++ b/src/boot/loader_stage2.c
@@ -1,8 +1,8 @@
#include <stddef.h>
#include <stdint.h>
-#include <uart.h>
-#include <io.h>
-#include <global.h>
+#include "../utils/uart.h"
+#include "../utils/io.h"
+#include "../global.h"
void *const kernel_load_addr = ((void*) 0x8000);
diff --git a/loader_stage2_linker.ld b/src/boot/loader_stage2_linker.ld
index 33e79e9..33e79e9 100644
--- a/loader_stage2_linker.ld
+++ b/src/boot/loader_stage2_linker.ld
diff --git a/psr.h b/src/boot/psr.h
index 5efc6d9..f300a7a 100644
--- a/psr.h
+++ b/src/boot/psr.h
@@ -60,7 +60,7 @@ inline static PSR_t read_CPSR(void)
PSR_t CPSR;
// get content of current program status register
asm("mrs %0, cpsr" : "=r" (CPSR.raw) :: "memory");
-
+
return CPSR;
}
diff --git a/setup.c b/src/boot/setup.c
index f1d1263..2f74e64 100644
--- a/setup.c
+++ b/src/boot/setup.c
@@ -1,12 +1,12 @@
-#include "uart.h"
-#include "io.h"
-#include "demo_functionality.h"
-#include "paging.h"
-#include "atags.h"
+#include "../utils/uart.h"
+#include "../utils/io.h"
+#include "../demo/demo_functionality.h"
+#include "../memory/paging.h"
+#include "../atags/atags.h"
// for POWER_OF_2() macro... perhaps the macro should be moved
-#include "memory.h"
-#include "armclock.h"
-#include "scheduler.h"
+#include "../memory/memory.h"
+#include "../clock/armclock.h"
+#include "../scheduler.h"
void setup(uint32_t r0, uint32_t machine_type,
struct atag_header *atags)
@@ -26,7 +26,9 @@ void setup(uint32_t r0, uint32_t machine_type,
// value 3 introduced by stage1 code means no atags was found
if (r0 == 3)
- puts("No ATAGS was found!");
+ {
+ puts ("No ATAGS was found!");
+ }
else
{
prints("ATAGS copied to 0x");
@@ -40,35 +42,36 @@ void setup(uint32_t r0, uint32_t machine_type,
memory_size = find_memory_size(atags);
}
-
+
if (memory_size)
{
- char *unit;
- uint32_t size_in_unit;
-
- if (memory_size % POWER_OF_2(10))
- {
- unit = "B";
- size_in_unit = memory_size;
- }
- else if (memory_size % POWER_OF_2(20))
- {
- unit = "KB";
- size_in_unit = memory_size / POWER_OF_2(10);
- }
- else if (memory_size % POWER_OF_2(30))
- {
- unit = "MB";
- size_in_unit = memory_size / POWER_OF_2(20);
- }
- else
- {
- unit = "GB";
- size_in_unit = memory_size / POWER_OF_2(30);
- }
-
- prints("memory available: ");
- printdect(size_in_unit); puts(unit);
+ char *unit;
+ uint32_t size_in_unit;
+
+ if (memory_size % POWER_OF_2(10))
+ {
+ unit = "B";
+ size_in_unit = memory_size;
+ }
+ else if (memory_size % POWER_OF_2(20))
+ {
+ unit = "KB";
+ size_in_unit = memory_size / POWER_OF_2(10);
+ }
+ else if (memory_size % POWER_OF_2(30))
+ {
+ unit = "MB";
+ size_in_unit = memory_size / POWER_OF_2(20);
+ }
+ else
+ {
+ unit = "GB";
+ size_in_unit = memory_size / POWER_OF_2(30);
+ }
+
+ prints ("memory available: ");
+ printdect (size_in_unit);
+ puts (unit);
}
else
{
diff --git a/armclock.h b/src/clock/armclock.h
index 32d6517..0d83fc2 100644
--- a/armclock.h
+++ b/src/clock/armclock.h
@@ -3,8 +3,8 @@
#include <stdint.h>
-#include "global.h"
-
+#include "../global.h"
+#include "../interrupts/interrupts.h"
#define ARMCLK_LOAD (ARM_BASE + 0x400)
#define ARMCLK_VALUE (ARM_BASE + 0x404)
#define ARMCLK_CONTROL (ARM_BASE + 0x408)
diff --git a/bcmclock.h b/src/clock/bcmclock.h
index 7070283..d08912b 100644
--- a/bcmclock.h
+++ b/src/clock/bcmclock.h
@@ -2,8 +2,8 @@
#define BCMCLOCK_H
#include <stdint.h>
-
-#include "global.h"
+#include "../interrupts/interrupts.h"
+#include "../global.h"
#define ST_BASE (PERIF_BASE + 0x3000) // System Timer
diff --git a/demo_functionality.c b/src/demo/demo_functionality.c
index 217a858..d9c0888 100644
--- a/demo_functionality.c
+++ b/src/demo/demo_functionality.c
@@ -1,12 +1,12 @@
-#include "io.h"
-#include "psr.h"
-#include "memory.h"
-#include "translation_table_descriptors.h"
-#include "ramfs.h"
-#include "strings.h"
-#include "paging.h"
-#include "armclock.h"
-#include "scheduler.h"
+#include "../utils/io.h"
+#include "../boot/psr.h"
+#include "../memory/memory.h"
+#include "../memory/translation_table_descriptors.h"
+#include "../memory/ramfs.h"
+#include "../utils/strings.h"
+#include "../memory/paging.h"
+#include "../clock/armclock.h"
+#include "../scheduler.h"
void demo_paging_support(void)
{
diff --git a/demo_functionality.h b/src/demo/demo_functionality.h
index a338c71..a338c71 100644
--- a/demo_functionality.h
+++ b/src/demo/demo_functionality.h
diff --git a/global.h b/src/global.h
index c461703..4e17b44 100644
--- a/global.h
+++ b/src/global.h
@@ -25,21 +25,6 @@
// (as in sane kernels - like linux, not like in wiki.osdev codes...)
#define GPIO_BASE (PERIF_BASE + 0x200000)
-// ARM control block
-// called "base address for the ARM interrupt register" elsewhere
-#define ARM_BASE (PERIF_BASE + 0xB000)
-
-#define ARM_IRQ_BASIC_PENDING (ARM_BASE + 0x200)
-#define ARM_IRQ_PENDING_1 (ARM_BASE + 0x204)
-#define ARM_IRQ_PENDING_2 (ARM_BASE + 0x208)
-#define ARM_FIQ_CONTROL (ARM_BASE + 0x20C)
-#define ARM_ENABLE_IRQS_1 (ARM_BASE + 0x210)
-#define ARM_ENABLE_IRQS_2 (ARM_BASE + 0x214)
-#define ARM_ENABLE_BASIC_IRQS (ARM_BASE + 0x218)
-#define ARM_DISABLE_IRQS_1 (ARM_BASE + 0x21C)
-#define ARM_DISABLE_IRQS_2 (ARM_BASE + 0x220)
-#define ARM_DISABLE_BASIC_IRQS (ARM_BASE + 0x224)
-
inline static uint32_t rd32(uint32_t addr)
{
return *(uint32_t volatile*) addr;
diff --git a/interrupt_vector.S b/src/interrupts/interrupt_vector.S
index 9404839..1ec80f7 100644
--- a/interrupt_vector.S
+++ b/src/interrupts/interrupt_vector.S
@@ -49,4 +49,8 @@ fiq_handler_caller:
ldr sp, =_fiq_stack_top
ldr r5, =fiq_handler
bx r5
-
+
+irq:
+ mov sp, #0x8000
+ ldr r5, =abort_handler
+ subs pc,lr,#4
diff --git a/interrupts.c b/src/interrupts/interrupts.c
index bf7ed02..5c30375 100644
--- a/interrupts.c
+++ b/src/interrupts/interrupts.c
@@ -1,8 +1,12 @@
-#include "io.h"
-#include "uart.h"
-#include "svc_interface.h"
-#include "armclock.h"
-#include "scheduler.h"
+#include "../utils/io.h"
+#include "../utils/uart.h"
+#include "../utils/svc_interface.h"
+#include "../clock/armclock.h"
+#include "../scheduler.h"
+/**
+ @brief The undefined instruction interrupt handler
+**/
+
void __attribute__((noreturn)) setup(void);
@@ -31,7 +35,7 @@ uint32_t supervisor_call_handler(uint32_t regs[14])
int c;
if ((c = getchar_non_blocking()) == -1)
schedule_wait_for_input(regs);
-
+
regs[0] = c;
break;
}
@@ -102,3 +106,30 @@ void fiq_handler(void)
error("fiq happened");
}
+
+/* Here is your interrupt function */
+//void
+//__attribute__((interrupt("IRQ")))
+//__attribute__((section(".interrupt_vectors.text")))
+//irq_handler2(void) {
+// /* You code goes here */
+//// uart_puts("GOT INTERRUPT!\r\n");
+//
+// local_timer_clr_reload_reg_t temp = { .IntClear = 1, .Reload = 1 };
+// QA7->TimerClearReload = temp; // Clear interrupt & reload
+//}
+
+///* here is your main */
+//int enable_timer(void) {
+//
+// QA7->TimerRouting.Routing = LOCALTIMER_TO_CORE0_IRQ; // Route local timer IRQ to Core0
+// QA7->TimerControlStatus.ReloadValue = 100; // Timer period set
+// QA7->TimerControlStatus.TimerEnable = 1; // Timer enabled
+// QA7->TimerControlStatus.IntEnable = 1; // Timer IRQ enabled
+// QA7->TimerClearReload.IntClear = 1; // Clear interrupt
+// QA7->TimerClearReload.Reload = 1; // Reload now
+// QA7->Core0TimerIntControl.nCNTPNSIRQ_IRQ = 1; // We are in NS EL1 so enable IRQ to core0 that level
+// QA7->Core0TimerIntControl.nCNTPNSIRQ_FIQ = 0; // Make sure FIQ is zero
+//// uart_puts("Enabled Timer\r\n");
+// return(0);
+//} \ No newline at end of file
diff --git a/src/interrupts/interrupts.h b/src/interrupts/interrupts.h
new file mode 100644
index 0000000..c2818ee
--- /dev/null
+++ b/src/interrupts/interrupts.h
@@ -0,0 +1,47 @@
+#ifndef RPI_MMU_EXAMPLE_INTERRUPTS_H
+#define RPI_MMU_EXAMPLE_INTERRUPTS_H
+
+#include <stdint.h>
+
+// ARM control block
+// called "base address for the ARM interrupt register" elsewhere
+#define ARM_BASE (PERIF_BASE + 0xB000)
+#define ARM_IRQ_BASIC_PENDING (ARM_BASE + 0x200)
+#define ARM_IRQ_PENDING_1 (ARM_BASE + 0x204)
+#define ARM_IRQ_PENDING_2 (ARM_BASE + 0x208)
+#define ARM_FIQ_CONTROL (ARM_BASE + 0x20C)
+#define ARM_ENABLE_IRQS_1 (ARM_BASE + 0x210)
+#define ARM_ENABLE_IRQS_2 (ARM_BASE + 0x214)
+#define ARM_ENABLE_BASIC_IRQS (ARM_BASE + 0x218)
+#define ARM_DISABLE_IRQS_1 (ARM_BASE + 0x21C)
+#define ARM_DISABLE_IRQS_2 (ARM_BASE + 0x220)
+#define ARM_DISABLE_BASIC_IRQS (ARM_BASE + 0x224)
+//offset of peripherals+ offset for first addresable register for interupt controller
+#define RPI_INTERRUPT_CONTROLLER_BASE ( 0x3F000000UL + 0xB200 )
+// Bits in the Enable_Basic_IRQs register to enable various interrupts.
+// According to the BCM2835 ARM Peripherals manual, section 7.5 */
+#define RPI_BASIC_ARM_TIMER_IRQ (1 << 0)
+#define RPI_BASIC_ARM_MAILBOX_IRQ (1 << 1)
+#define RPI_BASIC_ARM_DOORBELL_0_IRQ (1 << 2)
+#define RPI_BASIC_ARM_DOORBELL_1_IRQ (1 << 3)
+#define RPI_BASIC_GPU_0_HALTED_IRQ (1 << 4)
+#define RPI_BASIC_GPU_1_HALTED_IRQ (1 << 5)
+#define RPI_BASIC_ACCESS_ERROR_1_IRQ (1 << 6)
+#define RPI_BASIC_ACCESS_ERROR_0_IRQ (1 << 7)
+
+// @brief The interrupt controller memory mapped register set
+typedef struct {
+ volatile uint32_t IRQ_basic_pending;
+ volatile uint32_t IRQ_pending_1;
+ volatile uint32_t IRQ_pending_2;
+ volatile uint32_t FIQ_control;
+ volatile uint32_t Enable_IRQs_1;
+ volatile uint32_t Enable_IRQs_2;
+ volatile uint32_t Enable_Basic_IRQs;
+ volatile uint32_t Disable_IRQs_1;
+ volatile uint32_t Disable_IRQs_2;
+ volatile uint32_t Disable_Basic_IRQs;
+} rpi_irq_controller_t;
+
+extern rpi_irq_controller_t* RPI_GetIrqController(void);
+#endif //RPI_MMU_EXAMPLE_INTERRUPTS_H
diff --git a/cp_regs.h b/src/memory/cp_regs.h
index e5e7063..e5e7063 100644
--- a/cp_regs.h
+++ b/src/memory/cp_regs.h
diff --git a/makefs.c b/src/memory/makefs.c
index 379e8c5..379e8c5 100644
--- a/makefs.c
+++ b/src/memory/makefs.c
diff --git a/memory.h b/src/memory/memory.h
index bdeba52..bdeba52 100644
--- a/memory.h
+++ b/src/memory/memory.h
diff --git a/paging.c b/src/memory/paging.c
index 771c681..aa18087 100644
--- a/paging.c
+++ b/src/memory/paging.c
@@ -1,8 +1,8 @@
#include "cp_regs.h"
-#include "strings.h"
+#include "../utils/strings.h"
#include "memory.h"
#include "translation_table_descriptors.h"
-#include "io.h"
+#include "../utils/io.h"
#include "paging.h"
diff --git a/paging.h b/src/memory/paging.h
index 4ac8efa..4ac8efa 100644
--- a/paging.h
+++ b/src/memory/paging.h
diff --git a/ramfs.c b/src/memory/ramfs.c
index cc66b4c..cc66b4c 100644
--- a/ramfs.c
+++ b/src/memory/ramfs.c
diff --git a/ramfs.h b/src/memory/ramfs.h
index cf45736..cf45736 100644
--- a/ramfs.h
+++ b/src/memory/ramfs.h
diff --git a/translation_table_descriptors.h b/src/memory/translation_table_descriptors.h
index 981c3c7..981c3c7 100644
--- a/translation_table_descriptors.h
+++ b/src/memory/translation_table_descriptors.h
diff --git a/scheduler.c b/src/scheduler.c
index 141ba1d..146eb29 100644
--- a/scheduler.c
+++ b/src/scheduler.c
@@ -1,9 +1,9 @@
#include "scheduler.h"
-#include "uart.h"
-#include "strings.h"
-#include "armclock.h"
-#include "memory.h"
-#include "io.h"
+#include "utils/uart.h"
+#include "utils/strings.h"
+#include "clock/armclock.h"
+#include "memory/memory.h"
+#include "utils/io.h"
// for now we only have 1 process in "queue"
// later there is going to be an actual queue
diff --git a/scheduler.h b/src/scheduler.h
index 8c0f569..58f659c 100644
--- a/scheduler.h
+++ b/src/scheduler.h
@@ -3,7 +3,7 @@
#include <stdint.h>
-#include "psr.h"
+#include "boot/psr.h"
extern PSR_t PL1_PSR;
diff --git a/io.c b/src/utils/io.c
index bf9e0e3..bf9e0e3 100644
--- a/io.c
+++ b/src/utils/io.c
diff --git a/io.h b/src/utils/io.h
index dcad76e..dcad76e 100644
--- a/io.h
+++ b/src/utils/io.h
diff --git a/pipe_image.c b/src/utils/pipe_image.c
index 7e27fb9..b148ac4 100644
--- a/pipe_image.c
+++ b/src/utils/pipe_image.c
@@ -3,7 +3,7 @@
#include <endian.h>
#include <stdint.h>
#include <sys/types.h>
-#include "lib/rs232/rs232.h"
+#include "../../lib/rs232/rs232.h"
#define ANSI_FG_RED "\033[0;31m"
#define ANSI_FG_DEFAULT "\033[0;39m"
diff --git a/strings.c b/src/utils/strings.c
index 368d7dc..368d7dc 100644
--- a/strings.c
+++ b/src/utils/strings.c
diff --git a/strings.h b/src/utils/strings.h
index aff0533..aff0533 100644
--- a/strings.h
+++ b/src/utils/strings.h
diff --git a/svc.S b/src/utils/svc.S
index 65200d8..65200d8 100644
--- a/svc.S
+++ b/src/utils/svc.S
diff --git a/svc_interface.h b/src/utils/svc_interface.h
index aa478ce..aa478ce 100644
--- a/svc_interface.h
+++ b/src/utils/svc_interface.h
diff --git a/uart.c b/src/utils/uart.c
index 2d4e176..a389e41 100644
--- a/uart.c
+++ b/src/utils/uart.c
@@ -1,7 +1,7 @@
#include <stddef.h>
#include <stdint.h>
-#include <uart.h>
-#include <global.h>
+#include "uart.h"
+#include "../global.h"
// Loop <delay> times in a way that the compiler won't optimize away
static inline void delay(int32_t count)
diff --git a/uart.h b/src/utils/uart.h
index 72f7f94..2a8b7d4 100644
--- a/uart.h
+++ b/src/utils/uart.h
@@ -2,7 +2,8 @@
#define UART_H
#include <stdint.h>
-#include <global.h>
+#include "../global.h"
+#include "../interrupts/interrupts.h"
// The offsets for reach register.