From 681dc11b1b3d7cf4620649e44f37ec5c613bf468 Mon Sep 17 00:00:00 2001
From: Able <abl3theabove@gmail.com>
Date: Thu, 18 Nov 2021 02:11:53 -0600
Subject: [PATCH] Removing deprecated platforms

---
 ableos/src/arch/aarch32/boot.s                | 52 -------------------
 ableos/src/arch/aarch32/build.sh              |  7 ---
 ableos/src/arch/aarch32/drivers/graphics.rs   |  1 -
 ableos/src/arch/aarch32/drivers/mod.rs        |  1 -
 ableos/src/arch/aarch32/init.rs               |  4 --
 ableos/src/arch/aarch32/linker.ld             | 43 ---------------
 ableos/src/arch/aarch32/mbox.rs               |  2 -
 ableos/src/arch/aarch32/mod.rs                | 38 --------------
 ableos/src/arch/aarch32/run.sh                |  3 --
 .../src/arch/ps_portable/drivers/graphics.rs  |  1 -
 ableos/src/arch/ps_portable/drivers/mod.rs    |  1 -
 ableos/src/arch/ps_portable/init.rs           |  2 -
 ableos/src/arch/ps_portable/mod.rs            | 47 -----------------
 .../src/arch/ps_portable/simple_graphics.rs   | 27 ----------
 ableos/src/arch/ps_portable/timer.rs          | 13 -----
 15 files changed, 242 deletions(-)
 delete mode 100644 ableos/src/arch/aarch32/boot.s
 delete mode 100644 ableos/src/arch/aarch32/build.sh
 delete mode 100644 ableos/src/arch/aarch32/drivers/graphics.rs
 delete mode 100644 ableos/src/arch/aarch32/drivers/mod.rs
 delete mode 100644 ableos/src/arch/aarch32/init.rs
 delete mode 100644 ableos/src/arch/aarch32/linker.ld
 delete mode 100644 ableos/src/arch/aarch32/mbox.rs
 delete mode 100644 ableos/src/arch/aarch32/mod.rs
 delete mode 100644 ableos/src/arch/aarch32/run.sh
 delete mode 100644 ableos/src/arch/ps_portable/drivers/graphics.rs
 delete mode 100644 ableos/src/arch/ps_portable/drivers/mod.rs
 delete mode 100644 ableos/src/arch/ps_portable/init.rs
 delete mode 100644 ableos/src/arch/ps_portable/mod.rs
 delete mode 100644 ableos/src/arch/ps_portable/simple_graphics.rs
 delete mode 100644 ableos/src/arch/ps_portable/timer.rs

diff --git a/ableos/src/arch/aarch32/boot.s b/ableos/src/arch/aarch32/boot.s
deleted file mode 100644
index 6ff3a59..0000000
--- a/ableos/src/arch/aarch32/boot.s
+++ /dev/null
@@ -1,52 +0,0 @@
-// AArch32 mode
-
-// To keep this in the first portion of the binary.
-.section ".text.boot"
-
-// Make _start global.
-.globl _start
-
-        .org 0x8000
-// Entry point for the kernel.
-// r15 -> should begin execution at 0x8000.
-// r0 -> 0x00000000
-// r1 -> 0x00000C42 - machine id
-// r2 -> 0x00000100 - start of ATAGS
-// preserve these registers as argument for kernel_main
-_start:
-	// Shut off extra cores
-	mrc p15, 0, r5, c0, c0, 5
-	and r5, r5, #3
-	cmp r5, #0
-	bne halt
-
-	// Setup the stack.
-	ldr r5, =_start
-	mov sp, r5
-
-	// Clear out bss.
-	ldr r4, =__bss_start
-	ldr r9, =__bss_end
-	mov r5, #0
-	mov r6, #0
-	mov r7, #0
-	mov r8, #0
-	b       2f
-
-1:
-	// store multiple at r4.
-	stmia r4!, {r5-r8}
-
-	// If we are still below bss_end, loop.
-2:
-	cmp r4, r9
-	blo 1b
-
-	// Call kernel_main
-	ldr r3, =kernel_main
-	blx r3
-
-	// halt
-halt:
-	wfe
-	b halt
diff --git a/ableos/src/arch/aarch32/build.sh b/ableos/src/arch/aarch32/build.sh
deleted file mode 100644
index e1cc335..0000000
--- a/ableos/src/arch/aarch32/build.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-arm-none-eabi-gcc -mcpu=cortex-a7 -fpic -ffreestanding -c src/arch/aarch32/boot.s -o boot.o
-mv src/main.rs src/main.rs.pass
-cargo build --release --target json_targets/aarch32-ableos.json
-arm-none-eabi-gcc -T src/arch/aarch32/linker.ld -o ableos.elf -ffreestanding -O2 -nostdlib boot.o \
-target/aarch32-ableos/release/libableos.rlib
-mv src/main.rs.pass src/main.rs
-rm boot.o
diff --git a/ableos/src/arch/aarch32/drivers/graphics.rs b/ableos/src/arch/aarch32/drivers/graphics.rs
deleted file mode 100644
index 8b13789..0000000
--- a/ableos/src/arch/aarch32/drivers/graphics.rs
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/ableos/src/arch/aarch32/drivers/mod.rs b/ableos/src/arch/aarch32/drivers/mod.rs
deleted file mode 100644
index 175de44..0000000
--- a/ableos/src/arch/aarch32/drivers/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub mod graphics;
diff --git a/ableos/src/arch/aarch32/init.rs b/ableos/src/arch/aarch32/init.rs
deleted file mode 100644
index e74274f..0000000
--- a/ableos/src/arch/aarch32/init.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-use super::write;
-pub fn init() {
-	write("booted on arm :>\n");
-}
diff --git a/ableos/src/arch/aarch32/linker.ld b/ableos/src/arch/aarch32/linker.ld
deleted file mode 100644
index 1f51675..0000000
--- a/ableos/src/arch/aarch32/linker.ld
+++ /dev/null
@@ -1,43 +0,0 @@
-ENTRY(_start)
-
-SECTIONS
-{
-    /* Starts at LOADER_ADDR. */
-    . = 0x80000;
-    __start = .;
-    __text_start = .;
-    .text :
-    {
-        KEEP(*(.text.boot))
-        *(.text)
-    }
-    . = ALIGN(4096); /* align to page size */
-    __text_end = .;
-
-    __rodata_start = .;
-    .rodata :
-    {
-        *(.rodata)
-    }
-    . = ALIGN(4096); /* align to page size */
-    __rodata_end = .;
-
-    __data_start = .;
-    .data :
-    {
-        *(.data)
-    }
-    . = ALIGN(4096); /* align to page size */
-    __data_end = .;
-
-    __bss_start = .;
-    .bss :
-    {
-        bss = .;
-        *(.bss)
-    }
-    . = ALIGN(4096); /* align to page size */
-    __bss_end = .;
-    __bss_size = __bss_end - __bss_start;
-    __end = .;
-}
diff --git a/ableos/src/arch/aarch32/mbox.rs b/ableos/src/arch/aarch32/mbox.rs
deleted file mode 100644
index 46230d8..0000000
--- a/ableos/src/arch/aarch32/mbox.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-const MMIO_BASE: u32 = 0x3F00_0000;
-const VIDEOCORE_MBOX: u32 = MMIO_BASE + 0xB880;
diff --git a/ableos/src/arch/aarch32/mod.rs b/ableos/src/arch/aarch32/mod.rs
deleted file mode 100644
index 68809b1..0000000
--- a/ableos/src/arch/aarch32/mod.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#![allow(warnings)]
-pub const ARCH: &'static str = "aarch32";
-use core::intrinsics::{volatile_load, volatile_store};
-pub mod drivers;
-pub mod init;
-pub mod mbox;
-// raspi2 and raspi3 have peripheral base address 0x3F000000,
-// b ut raspi1 has peripheral base address 0x20000000. Ensure
-// you are using the correct peripheral address for your
-// hardware.
-const UART_DR: u32 = 0x3F201000;
-const UART_FR: u32 = 0x3F201018;
-pub fn mmio_write(reg: u32, val: u32) {
-	unsafe { volatile_store(reg as *mut u32, val) }
-}
-pub fn mmio_read(reg: u32) -> u32 {
-	unsafe { volatile_load(reg as *const u32) }
-}
-pub fn transmit_fifo_full() -> bool {
-	mmio_read(UART_FR) & (1 << 5) > 0
-}
-pub fn receive_fifo_empty() -> bool {
-	mmio_read(UART_FR) & (1 << 4) > 0
-}
-pub fn writec(c: u8) {
-	while transmit_fifo_full() {}
-	mmio_write(UART_DR, c as u32);
-}
-pub fn getc() -> u8 {
-	while receive_fifo_empty() {}
-	mmio_read(UART_DR) as u8
-}
-pub fn write(msg: &str) {
-	for c in msg.chars() {
-		writec(c as u8)
-	}
-}
-pub fn shutdown() {}
diff --git a/ableos/src/arch/aarch32/run.sh b/ableos/src/arch/aarch32/run.sh
deleted file mode 100644
index a30d46c..0000000
--- a/ableos/src/arch/aarch32/run.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-sh src/arch/aarch32/build.sh && \
-qemu-system-arm -M raspi2 -kernel ableos.elf --serial stdio && \
-rm ableos.elf
diff --git a/ableos/src/arch/ps_portable/drivers/graphics.rs b/ableos/src/arch/ps_portable/drivers/graphics.rs
deleted file mode 100644
index 8b13789..0000000
--- a/ableos/src/arch/ps_portable/drivers/graphics.rs
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/ableos/src/arch/ps_portable/drivers/mod.rs b/ableos/src/arch/ps_portable/drivers/mod.rs
deleted file mode 100644
index 175de44..0000000
--- a/ableos/src/arch/ps_portable/drivers/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub mod graphics;
diff --git a/ableos/src/arch/ps_portable/init.rs b/ableos/src/arch/ps_portable/init.rs
deleted file mode 100644
index 8dd6519..0000000
--- a/ableos/src/arch/ps_portable/init.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-use super::*;
-pub fn init() {}
diff --git a/ableos/src/arch/ps_portable/mod.rs b/ableos/src/arch/ps_portable/mod.rs
deleted file mode 100644
index d293b61..0000000
--- a/ableos/src/arch/ps_portable/mod.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-#![no_std]
-#![no_main]
-pub const ARCH: &'static str = "mipsr4000";
-pub mod drivers;
-static mut LIST: psp::Align16<[u32; 0x40000]> = psp::Align16([0; 0x40000]);
-// Create a module named "sample_module" with version 1.0
-psp::module!("ableos", 1, 0);
-fn psp_main() {
-	// println!("AbleOS booted on PSP");
-	// todo
-	// println!("{}", crate::experiments::systeminfo::format_system_info());
-	// gl_basic();
-	println!("{}", crate::time::kilotime::Kilosecond::from_sec(23944));
-	let mut second = timer_update().seconds;
-	loop {
-		/*
-		{
-			let time = timer_update();
-			// FIXME: this is a little broken
-			if (second) == time.seconds {
-				if second == 59 {
-					second = 0;
-				}
-				// time
-				print!(
-					"{:?}/{:?}/{:?} {:02}:{:02}:{:02} UTC\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
-					time.year, time.month, time.day, time.hour, time.minutes, time.seconds
-				);
-				second += 1;
-			}
-		}
-		*/
-	}
-}
-pub fn shutdown() {}
-mod simple_graphics;
-use simple_graphics::gl_basic;
-mod timer;
-use crate::arch::timer::timer_update;
-use core::ffi::c_void;
-use psp::{
-	sys::{self, DisplayPixelFormat, GuState, TexturePixelFormat},
-	vram_alloc::get_vram_allocator,
-	{BUF_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH},
-};
-pub mod init;
-use crate::println;
diff --git a/ableos/src/arch/ps_portable/simple_graphics.rs b/ableos/src/arch/ps_portable/simple_graphics.rs
deleted file mode 100644
index bfcd766..0000000
--- a/ableos/src/arch/ps_portable/simple_graphics.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-use crate::arch::*;
-/// used as a very basic bare minimum gl example
-pub fn gl_basic() {
-	unsafe {
-		let mut allocator = get_vram_allocator().unwrap();
-		let fbp0 = allocator
-			.alloc_texture_pixels(BUF_WIDTH, SCREEN_HEIGHT, TexturePixelFormat::Psm8888)
-			.as_mut_ptr_from_zero();
-		sys::sceGuInit();
-		sys::sceGuStart(
-			sys::GuContextType::Direct,
-			&mut LIST as *mut _ as *mut c_void,
-		);
-		sys::sceGuDrawBuffer(DisplayPixelFormat::Psm8888, fbp0 as _, BUF_WIDTH as i32);
-		sys::sceGuDebugPrint(
-			100,
-			100,
-			0xff0000ff,
-			b"hi there from ableOS PSP graphics\0" as *const u8,
-		);
-		sys::sceGuDebugFlush();
-		sys::sceGuFinish();
-		sys::sceGuSync(sys::GuSyncMode::Finish, sys::GuSyncBehavior::Wait);
-		sys::sceDisplayWaitVblankStart();
-		sys::sceGuDisplay(true);
-	}
-}
diff --git a/ableos/src/arch/ps_portable/timer.rs b/ableos/src/arch/ps_portable/timer.rs
deleted file mode 100644
index 5a11b40..0000000
--- a/ableos/src/arch/ps_portable/timer.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-pub fn timer_update() -> ScePspDateTime {
-	unsafe {
-		let mut tick = 0;
-		psp::sys::sceRtcGetCurrentTick(&mut tick);
-		// Convert the tick to an instance of `ScePspDateTime`
-		let mut date = MaybeUninit::uninit();
-		psp::sys::sceRtcSetTick(date.as_mut_ptr(), &tick);
-		let date = date.assume_init();
-		return date;
-	}
-}
-use core::mem::MaybeUninit;
-use psp::sys::ScePspDateTime;