summaryrefslogtreecommitdiff
path: root/sys/include/arch/amd64
diff options
context:
space:
mode:
Diffstat (limited to 'sys/include/arch/amd64')
-rw-r--r--sys/include/arch/amd64/bus.h39
-rw-r--r--sys/include/arch/amd64/cpu.h158
-rw-r--r--sys/include/arch/amd64/cpu_mp.h40
-rw-r--r--sys/include/arch/amd64/cpuid.h40
-rw-r--r--sys/include/arch/amd64/frame.h82
-rw-r--r--sys/include/arch/amd64/frameasm.h103
-rw-r--r--sys/include/arch/amd64/gdt.h79
-rw-r--r--sys/include/arch/amd64/hpet.h40
-rw-r--r--sys/include/arch/amd64/idt.h70
-rw-r--r--sys/include/arch/amd64/intr.h37
-rw-r--r--sys/include/arch/amd64/io.h78
-rw-r--r--sys/include/arch/amd64/ioapic.h43
-rw-r--r--sys/include/arch/amd64/ioapicvar.h57
-rw-r--r--sys/include/arch/amd64/isa/i8042regs.h69
-rw-r--r--sys/include/arch/amd64/isa/i8254.h44
-rw-r--r--sys/include/arch/amd64/isa/spkr.h37
-rw-r--r--sys/include/arch/amd64/lapic.h59
-rw-r--r--sys/include/arch/amd64/lapicvar.h102
-rw-r--r--sys/include/arch/amd64/msr.h66
-rw-r--r--sys/include/arch/amd64/pcb.h39
-rw-r--r--sys/include/arch/amd64/spectre.h38
-rw-r--r--sys/include/arch/amd64/sysvec.h55
-rw-r--r--sys/include/arch/amd64/tlb.h42
-rw-r--r--sys/include/arch/amd64/trap.h78
-rw-r--r--sys/include/arch/amd64/tss.h120
-rw-r--r--sys/include/arch/amd64/uart.h40
-rw-r--r--sys/include/arch/amd64/vas.h54
27 files changed, 0 insertions, 1709 deletions
diff --git a/sys/include/arch/amd64/bus.h b/sys/include/arch/amd64/bus.h
deleted file mode 100644
index 53d1fe2..0000000
--- a/sys/include/arch/amd64/bus.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_BUS_H_
-#define _AMD64_BUS_H_
-
-#include <sys/types.h>
-
-typedef uint64_t bus_addr_t;
-
-int bus_map(bus_addr_t addr, size_t size, int flags, void **vap);
-
-#endif /* !_AMD64_BUS_H_ */
diff --git a/sys/include/arch/amd64/cpu.h b/sys/include/arch/amd64/cpu.h
deleted file mode 100644
index 3febf5a..0000000
--- a/sys/include/arch/amd64/cpu.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_CPU_H_
-#define _AMD64_CPU_H_
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-#include <sys/spinlock.h>
-#include <sys/sched_state.h>
-#include <sys/queue.h>
-#include <sys/intr.h>
-#include <machine/tss.h>
-#include <machine/msr.h>
-/*
- * XXX: We are not using the PAUSE instruction for the sake of
- * ensuring compatibility... PAUSE is F3 90, REP NOP is
- * F3 90... REP NOP will be read as a PAUSE on processors
- * that support it.
- */
-#define hint_spinwait() __ASMV("rep; nop")
-
-#define this_cpu() amd64_this_cpu()
-#define get_bsp() amd64_get_bsp()
-#define is_intr_mask() amd64_is_intr_mask()
-#define CPU_INFO_LOCK(info) spinlock_acquire(&(info->lock))
-#define CPU_INFO_UNLOCK(info) spinlock_release(&(info->lock))
-
-/*
- * Info about a specific processor.
- *
- * XXX: Spinlock must be acquired outside of this module!
- * None of these module's internal functions should
- * acquire the spinlock themselves!
- */
-struct cpu_info {
- /* Per-arch fields */
- void *pmap; /* Current pmap */
- uint32_t id;
- uint32_t idx;
- struct spinlock lock;
- struct sched_state sched_state;
- TAILQ_ENTRY(cpu_info) link;
-
- /* AMD64 */
- volatile size_t lapic_tmr_freq;
- volatile void *lapic_base;
- volatile bool has_x2apic;
- volatile struct tss_entry *tss;
- volatile uintptr_t tlb_flush_ptr; /* Address to flush */
- struct intr_info *tlb_shootdown; /* Shootdown interrupt info */
-};
-
-/*
- * Contains information for the current
- * core. Stored in %GS.
- *
- * MUST REMAIN IN ORDER!!!
- */
-struct cpu_ctx {
- struct cpu_info *ci;
-};
-
-/*
- * Returns true for this core if maskable
- * interrupts are masked (CLI) and false if
- * they aren't (STI).
- */
-static inline bool
-amd64_is_intr_mask(void)
-{
- uint64_t flags;
-
- __ASMV("pushfq; pop %0" : "=rm" (flags) :: "memory");
- return !__TEST(flags, 1 << 9);
-}
-
-static inline void
-amd64_write_gs_base(uintptr_t val)
-{
- wrmsr(IA32_KERNEL_GS_BASE, val);
-}
-
-static inline uintptr_t
-amd64_read_gs_base(void)
-{
- return rdmsr(IA32_KERNEL_GS_BASE);
-}
-
-static inline uint64_t
-amd64_read_cr0(void)
-{
- uint64_t cr0;
- __ASMV("mov %%cr0, %0" : "=r" (cr0) :: "memory");
- return cr0;
-}
-
-static inline void
-amd64_write_cr0(uint64_t val)
-{
- __ASMV("mov %0, %%cr0" :: "r" (val) : "memory");
-}
-
-static inline uint64_t
-amd64_read_cr4(void)
-{
- uint64_t cr4;
- __ASMV("mov %%cr4, %0" : "=r" (cr4) :: "memory");
- return cr4;
-}
-
-static inline void
-amd64_write_cr4(uint64_t val)
-{
- __ASMV("mov %0, %%cr4" :: "r" (val) : "memory");
-}
-
-static inline void
-amd64_fxsave(void *area)
-{
- __ASMV("fxsave (%0)" :: "r" (area) : "memory");
-}
-
-static inline void
-amd64_fxrstor(void *area)
-{
- __ASMV("fxrstor (%0)" :: "r" (area) : "memory");
-}
-
-struct cpu_info *amd64_this_cpu(void);
-
-#endif /* !_AMD64_CPU_H_ */
diff --git a/sys/include/arch/amd64/cpu_mp.h b/sys/include/arch/amd64/cpu_mp.h
deleted file mode 100644
index 4047f3b..0000000
--- a/sys/include/arch/amd64/cpu_mp.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SYS_CPU_AP_H_
-#define _SYS_CPU_AP_H_
-
-#include <machine/cpu.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-__weak void ap_bootstrap(struct cpu_info *ci);
-__weak bool mp_supported(void);
-
-#endif /* !_SYS_CPU_AP_H_ */
diff --git a/sys/include/arch/amd64/cpuid.h b/sys/include/arch/amd64/cpuid.h
deleted file mode 100644
index b193d60..0000000
--- a/sys/include/arch/amd64/cpuid.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_CPUID_H_
-#define _AMD64_CPUID_H_
-
-#include <sys/cdefs.h>
-
-#define __CPUID(level, a, b, c, d) \
- __ASMV("cpuid\n\t" \
- : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
- : "0" (level))
-
-#endif /* !_AMD64_CPUID_H_ */
diff --git a/sys/include/arch/amd64/frame.h b/sys/include/arch/amd64/frame.h
deleted file mode 100644
index 85edea9..0000000
--- a/sys/include/arch/amd64/frame.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_FRAME_H_
-#define _AMD64_FRAME_H_
-
-#if !defined(__ASSEMBLER__)
-
-#include <sys/types.h>
-
-struct trapframe {
- uint64_t trapno;
- uint64_t rax;
- uint64_t rcx;
- uint64_t rdx;
- uint64_t rbx;
- uint64_t rsi;
- uint64_t rdi;
- uint64_t rbp;
- uint64_t r8;
- uint64_t r9;
- uint64_t r10;
- uint64_t r11;
- uint64_t r12;
- uint64_t r13;
- uint64_t r14;
- uint64_t r15;
- /* Pushed by hardware */
- uint64_t error_code;
- uint64_t rip;
- uint64_t cs;
- uint64_t rflags;
- uint64_t rsp;
- uint64_t ss;
-};
-
-#define init_frame(FRAME, IP, SP) \
- (FRAME)->rip = IP; \
- (FRAME)->cs = 0x08; \
- (FRAME)->rflags = 0x202; \
- (FRAME)->rsp = SP; \
- (FRAME)->ss = 0x10; \
-
-#define init_frame_user(FRAME, IP, SP) \
- (FRAME)->rip = IP; \
- (FRAME)->cs = 0x18 | 3; \
- (FRAME)->rflags = 0x202; \
- (FRAME)->rsp = SP; \
- (FRAME)->ss = 0x20 | 3; \
-
-#define set_frame_sp(FRAME, SP) (FRAME)->rsp = SP
-#define set_frame_ip(FRAME, IP) (FRAME)->rip = IP
-#define get_frame_ip(FRAME) (FRAME)->rip
-
-#endif /* !defined(__ASSEMBLER__) */
-#endif /* !_AMD64_FRAME_H_ */
diff --git a/sys/include/arch/amd64/frameasm.h b/sys/include/arch/amd64/frameasm.h
deleted file mode 100644
index cdcdd20..0000000
--- a/sys/include/arch/amd64/frameasm.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_FRAMEASM_H_
-#define _AMD64_FRAMEASM_H_
-
-/*
- * If the interrupt has an error code, this macro shall
- * be used to create the trapframe.
- *
- * XXX: A trapframe created with this must be popped with
- * pop_trapframe_ec
- */
-.macro push_trapframe_ec trapno
- push %r15
- push %r14
- push %r13
- push %r12
- push %r11
- push %r10
- push %r9
- push %r8
- push %rbp
- push %rdi
- push %rsi
- push %rbx
- push %rdx
- push %rcx
- push %rax
- push \trapno
-.endm
-
-/*
- * If the interrupt has an error code, this macro shall
- * be used to cleanup the trapframe.
- */
-.macro pop_trapframe_ec
- add $8, %rsp /* Trapno */
- pop %rax
- pop %rcx
- pop %rdx
- pop %rbx
- pop %rsi
- pop %rdi
- pop %rbp
- pop %r8
- pop %r9
- pop %r10
- pop %r11
- pop %r12
- pop %r13
- pop %r14
- pop %r15
-.endm
-
-/*
- * If the interrupt has no error code, this macro
- * shall be used to create the trapframe.
- *
- * XXX: A trapframe created with this must be popped
- * with pop_trapframe
- */
-.macro push_trapframe trapno
- push $0
- push_trapframe_ec \trapno
-.endm
-
-
-/*
- * If the interrupt has no error code, this macro shall
- * be used to cleanup the trapframe.
- */
-.macro pop_trapframe
- pop_trapframe_ec
- add $8, %rsp /* Pop error code */
-.endm
-#endif /* !_AMD64_FRAMEASM_H_ */
diff --git a/sys/include/arch/amd64/gdt.h b/sys/include/arch/amd64/gdt.h
deleted file mode 100644
index c3ea8e8..0000000
--- a/sys/include/arch/amd64/gdt.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef AMD64_GDT_H_
-#define AMD64_GDT_H_
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-
-#define GDT_TSS 5
-#define KERNEL_CS 0x8
-#define KERNEL_DS 0x10
-
-struct __packed gdt_entry {
- uint16_t limit;
- uint16_t base_low;
- uint8_t base_mid;
- uint8_t access;
- uint8_t granularity;
- uint8_t base_hi;
-};
-
-struct __packed gdtr {
- uint16_t limit;
- uintptr_t offset;
-};
-
-static inline void
-gdt_load(struct gdtr *gdtr)
-{
- __asm("lgdt %0\n"
- "push $8\n" /* Push CS */
- "lea 1f(%%rip), %%rax\n" /* Load 1 label address into RAX */
- "push %%rax\n" /* Push the return address (label 1) */
- "lretq\n" /* Far return to update CS */
- "1:\n"
- " mov $0x10, %%eax\n"
- " mov %%eax, %%ds\n"
- " mov %%eax, %%es\n"
- " mov %%eax, %%fs\n"
- " mov %%eax, %%gs\n"
- " mov %%eax, %%ss\n"
- :
- : "m" (*gdtr)
- : "rax", "memory"
- );
-}
-
-extern struct gdt_entry g_gdt[256];
-extern struct gdt_entry *g_gdt_tss;
-extern struct gdtr g_gdtr;
-
-#endif /* !AMD64_GDT_H_ */
diff --git a/sys/include/arch/amd64/hpet.h b/sys/include/arch/amd64/hpet.h
deleted file mode 100644
index dc4366c..0000000
--- a/sys/include/arch/amd64/hpet.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _TIMER_HPET_H_
-#define _TIMER_HPET_H_
-
-#include <sys/types.h>
-
-int hpet_init(void);
-int hpet_msleep(size_t ms);
-int hpet_usleep(size_t us);
-int hpet_nsleep(size_t ns);
-
-#endif /* !_TIMER_HPET_H_ */
diff --git a/sys/include/arch/amd64/idt.h b/sys/include/arch/amd64/idt.h
deleted file mode 100644
index 36ce44e..0000000
--- a/sys/include/arch/amd64/idt.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_IDT_H_
-#define _AMD64_IDT_H_
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-
-#define LIDT(idtr) __ASMV("lidt %0" \
- :: "m" (idtr))
-
-#define IDT_TRAP_GATE_FLAGS 0x8F
-#define IDT_INT_GATE_FLAGS 0x8E
-#define IDT_INT_GATE_USER 0xEE
-
-/*
- * AMD64 Interrupt Gate Descriptor.
- */
-struct idt_entry {
- uint16_t off_lo; /* Low 16 bits of ISR offset */
- uint16_t segsel; /* Segment selector, hardcode to kernel CS */
- uint8_t ist : 2; /* Interrupt stack table */
- uint8_t zero : 1; /* Unused: keep zero */
- uint8_t zero1 : 4; /* Unused: keep zero */
- uint8_t type : 4; /* Gate type */
- uint8_t zero2 : 1; /* Unused: keep zero */
- uint8_t dpl : 2; /* Descriptor privilege level */
- uint8_t p : 1; /* Present (keep 1 to mark as valid) */
- uint16_t off_mid; /* Middle 16 bits of ISR offset */
- uint32_t off_hi; /* High 32-bits of ISR offset */
- uint32_t reserved; /* Reserved: keep zero */
-};
-
-struct __packed idtr {
- uint16_t limit;
- uintptr_t offset;
-};
-
-
-void idt_set_desc(uint8_t vec, uint8_t type, uintptr_t isr, uint8_t ist);
-void idt_load(void);
-
-#endif /* !_AMD64_IDT_H_ */
diff --git a/sys/include/arch/amd64/intr.h b/sys/include/arch/amd64/intr.h
deleted file mode 100644
index d48a573..0000000
--- a/sys/include/arch/amd64/intr.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_INTR_H_
-#define _AMD64_INTR_H_
-
-#define IST_SCHED 1U
-#define IST_HW_IRQ 2U
-#define IST_SW_INT 3U
-
-#endif /* !_AMD64_INTR_H_ */
diff --git a/sys/include/arch/amd64/io.h b/sys/include/arch/amd64/io.h
deleted file mode 100644
index c24c08d..0000000
--- a/sys/include/arch/amd64/io.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_IO_H_
-#define _AMD64_IO_H_
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-
-static inline uint8_t
-inb(uint16_t port)
-{
- uint8_t result;
- __asm__("in %%dx, %%al" : "=a" (result) : "d" (port));
- return result;
-}
-
-static inline void
-outb(uint16_t port, uint8_t data)
-{
- __asm__("out %%al, %%dx" : :"a" (data), "d" (port));
-}
-
-static inline void
-outw(uint16_t port, uint16_t data)
-{
- __ASMV("outw %w0, %w1" : : "a" (data), "Nd" (port));
-}
-
-static inline uint16_t
-inw(uint16_t port)
-{
- uint16_t data;
- __ASMV("inw %w1, %w0" : "=a" (data) : "Nd" (port));
- return data;
-}
-
-static inline void
-outl(uint16_t port, uint32_t data)
-{
- __ASMV("outl %0, %w1" : : "a" (data), "Nd" (port));
-}
-
-static inline uint32_t
-inl(uint16_t port)
-{
- uint32_t data;
- __ASMV("inl %w1, %0" : "=a" (data) : "Nd" (port));
- return data;
-}
-
-#endif /* !_AMD64_IO_H_ */
diff --git a/sys/include/arch/amd64/ioapic.h b/sys/include/arch/amd64/ioapic.h
deleted file mode 100644
index 0d86441..0000000
--- a/sys/include/arch/amd64/ioapic.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_IOAPIC_H_
-#define _AMD64_IOAPIC_H_
-
-#include <sys/types.h>
-
-void ioapic_irq_mask(uint8_t irq);
-void ioapic_irq_unmask(uint8_t irq);
-void ioapic_gsi_mask(uint8_t gsi);
-void ioapic_gsi_unmask(uint8_t gsi);
-void ioapic_set_base(void *mmio_base);
-void ioapic_set_vec(uint8_t irq, uint8_t vector);
-void ioapic_init(void);
-
-#endif /* !_AMD64_IOAPIC_H_ */
diff --git a/sys/include/arch/amd64/ioapicvar.h b/sys/include/arch/amd64/ioapicvar.h
deleted file mode 100644
index 5128bc8..0000000
--- a/sys/include/arch/amd64/ioapicvar.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_IOAPICVAR_H_
-#define _AMD64_IOAPICVAR_H_
-
-#include <sys/types.h>
-
-/* Register offsets */
-#define IOREGSEL 0x00
-#define IOWIN 0x10
-#define IOAPICVER 0x01
-#define IOREDTBL 0x10
-
-union ioapic_redentry {
- struct {
- uint8_t vector;
- uint8_t delmod : 3;
- uint8_t destmod : 1;
- uint8_t delivs : 1;
- uint8_t intpol : 1;
- uint8_t remote_irr : 1;
- uint8_t trigger_mode : 1;
- uint8_t interrupt_mask : 1;
- uint64_t reserved : 39;
- uint8_t dest_field;
- };
- uint64_t value;
-};
-
-#endif /* !_AMD64_IOAPICVAR_H_ */
diff --git a/sys/include/arch/amd64/isa/i8042regs.h b/sys/include/arch/amd64/isa/i8042regs.h
deleted file mode 100644
index edef2ee..0000000
--- a/sys/include/arch/amd64/isa/i8042regs.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_I8042REG_H_
-#define _AMD64_I8042REG_H_
-
-#include <sys/cdefs.h>
-
-#define I8042_DATA 0x60
-#define I8042_STATUS 0x64
-#define I8042_COMMAND 0x64
-
-/* Status register bits */
-#define I8042_OBUF_FULL __BIT(0) /* Output buffer full */
-#define I8042_IBUF_FULL __BIT(1) /* Input buffer full */
-
-/* Commands */
-#define I8042_DISABLE_PORT0 0xAD
-#define I8042_DISABLE_PORT1 0xA7
-#define I8042_ENABLE_PORT0 0xAE
-#define I8042_ENABLE_PORT1 0xA8
-#define I8042_GET_CONFB 0x20
-#define I8042_SET_CONFB 0x60
-#define I8042_PORT1_SEND 0xD4
-
-/* Controller config bits */
-#define I8042_PORT0_INTR __BIT(0)
-#define I8042_PORT1_INTR __BIT(1)
-#define I8042_PORT0_CLK __BIT(4)
-#define I8042_PORT1_CLK __BIT(5)
-
-/* Aux commands */
-#define I8042_AUX_DEFAULTS 0xF5
-#define I8042_AUX_ENABLE 0xF4
-#define I8042_AUX_DISABLE 0xF5
-#define I8042_AUX_RESET 0xFF
-
-/* LED bits */
-#define I8042_LED_SCROLL __BIT(0)
-#define I8042_LED_NUM __BIT(1)
-#define I8042_LED_CAPS __BIT(2)
-
-#endif /* !_AMD64_I8042REG_H_ */
diff --git a/sys/include/arch/amd64/isa/i8254.h b/sys/include/arch/amd64/isa/i8254.h
deleted file mode 100644
index 8215bf4..0000000
--- a/sys/include/arch/amd64/isa/i8254.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_ISA_i8254_H_
-#define _AMD64_ISA_i8254_H_
-
-#include <sys/types.h>
-
-#define i8254_COMMAND 0x43
-#define i8254_CHANNEL_0 0x40
-#define i8254_CHANNEL_2 0x42
-#define i8254_DIVIDEND 1193182ULL
-
-uint16_t i8254_get_count(void);
-void i8254_set_reload(uint16_t val);
-void i8254_set_frequency(uint64_t frequency_hz);
-
-#endif /* !_AMD64_ISA_i8254_H_ */
diff --git a/sys/include/arch/amd64/isa/spkr.h b/sys/include/arch/amd64/isa/spkr.h
deleted file mode 100644
index 2691721..0000000
--- a/sys/include/arch/amd64/isa/spkr.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ISA_SPKR_H_
-#define _ISA_SPKR_H_
-
-#include <sys/types.h>
-
-int pcspkr_tone(uint16_t freq, uint32_t msec);
-
-#endif
diff --git a/sys/include/arch/amd64/lapic.h b/sys/include/arch/amd64/lapic.h
deleted file mode 100644
index c8a4de4..0000000
--- a/sys/include/arch/amd64/lapic.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_LAPIC_H_
-#define _AMD64_LAPIC_H_
-
-#include <sys/types.h>
-
-#define LAPIC_TMR_ONESHOT 0x00
-#define LAPIC_TMR_PERIODIC 0x01
-
-/* IPI Destination Shorthands */
-enum {
- IPI_SHORTHAND_NONE,
- IPI_SHORTHAND_SELF,
- IPI_SHORTHAND_ALL,
- IPI_SHORTHAND_OTHERS
-};
-
-/* IPI Destination Modes */
-enum {
- IPI_DEST_PHYSICAL,
- IPI_DEST_LOGICAL
-};
-
-void lapic_timer_init(size_t *freq_out);
-void lapic_timer_oneshot(bool mask, uint32_t count);
-void lapic_timer_oneshot_us(size_t us);
-void lapic_send_ipi(uint8_t id, uint8_t shorthand, uint8_t vector);
-void lapic_send_eoi(void);
-void lapic_init(void);
-
-#endif /* !_AMD64_LAPIC_H_ */
diff --git a/sys/include/arch/amd64/lapicvar.h b/sys/include/arch/amd64/lapicvar.h
deleted file mode 100644
index 84f73d2..0000000
--- a/sys/include/arch/amd64/lapicvar.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_LAPICVAR_H_
-#define _AMD64_LAPICVAR_H_
-
-#include <sys/cdefs.h>
-
-/* LAPIC register offsets */
-#define LAPIC_ID 0x0020U /* ID Register */
-#define LAPIC_VERSION 0x0030U /* Version Register */
-#define LAPIC_TPR 0x0080U /* Task Priority Register */
-#define LAPIC_APR 0x0090U /* Arbitration Priority Register */
-#define LAPIC_PPR 0x00A0U /* Processor Priority Register */
-#define LAPIC_EOI 0x00B0U /* End Of Interrupt Register */
-#define LAPIC_RRD 0x00C0U /* Remote Read Register */
-#define LAPIC_LDR 0x00D0U /* Logical Destination Register */
-#define LAPIC_DFR 0x00E0U /* Destination Format Register */
-#define LAPIC_SVR 0x00F0U /* Spurious Vector Register */
-#define LAPIC_ISR 0x0100U /* In service register (max=0x0220) */
-#define LAPIC_TMR 0x0180U /* Trigger Mode Register (max=0x0220) */
-#define LAPIC_IRR 0x0200U /* Interrupt Request Register (max=0x0270) */
-#define LAPIC_ERR 0x0280U /* Error Status Register */
-#define LAPIC_ICRLO 0x0300U /* Interrupt Command Low Register */
-#define LAPIC_ICRHI 0x0310U /* Interrupt Command High Register */
-#define LAPIC_LVT_TMR 0x0320U /* LVT Timer Register */
-#define LAPIC_DCR 0x03E0U /* Divide Configuration Register (for timer) */
-#define LAPIC_INIT_CNT 0x0380U /* Initial Count Register (for timer) */
-#define LAPIC_CUR_CNT 0x0390U /* Current Count Register (for timer) */
-
-#define IA32_APIC_BASE_MSR 0x1B
-
-/*
- * The x2APIC register space is accessed via
- * RDMSR/WRMSR instructions. The below defines
- * the base MSR address for the register space.
- */
-#define x2APIC_MSR_BASE 0x00000800
-
-/*
- * To hardware enable, OR the value
- * of the IA32_APIC_BASE MSR with
- * LAPIC_HW_ENABLE and rewrite it.
- *
- * To software enable, OR the value
- * of the SVR with LAPIC_SW_ENABLE
- * and rewrite it.
- *
- * LAPIC_SW_ENABLE has the low 8 bits set
- * as some hardware requires the spurious
- * vector to be hardwired to 1s so we'll
- * go with that to be safe.
- */
-#define LAPIC_HW_ENABLE __BIT(11)
-#define LAPIC_SW_ENABLE (__BIT(8) | 0xFF)
-#define x2APIC_ENABLE_SHIFT 10
-
-/*
- * The initial logical APIC ID to be set
- *
- * XXX: This value does *not* apply to processors
- * that support x2APIC mode. In x2APIC mode
- * the LDR register is readonly to system software.
- */
-#define LAPIC_STARTUP_LID 0x1
-
-/* LVT bits */
-#define LAPIC_LVT_MASK __BIT(16)
-#define LVT_TMR_ONESHOT 0x00
-#define LVT_TMR_PERIODIC 0x01
-#define LVT_TMR_TSC_DEADLINE 0x02
-
-/* LAPIC timer interrupt stack size in bytes */
-#define LAPIC_TMR_STACKSZ 4096
-
-#endif /* !_AMD64_LAPICVAR_H_ */
diff --git a/sys/include/arch/amd64/msr.h b/sys/include/arch/amd64/msr.h
deleted file mode 100644
index d36548b..0000000
--- a/sys/include/arch/amd64/msr.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_MSR_H_
-#define _AMD64_MSR_H_
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-
-#define IA32_SPEC_CTL 0x00000048
-#define IA32_KERNEL_GS_BASE 0xC0000102
-
-static inline uint64_t
-rdmsr(uint32_t msr_addr)
-{
- uint32_t lo, hi;
-
- __ASMV("rdmsr"
- : "=a" (lo), "=d" (hi)
- : "c" (msr_addr)
- );
- return ((uint64_t)hi << 32) | lo;
-}
-
-static inline void
-wrmsr(uint32_t msr_addr, uint64_t value)
-{
- uint32_t lo, hi;
-
- lo = (uint32_t)value;
- hi = (uint32_t)(value >> 32);
-
- __ASMV("wrmsr"
- : /* No outputs */
- : "a" (lo), "d" (hi),
- "c" (msr_addr)
- );
-}
-
-#endif /* !_AMD64_MSR_H_ */
diff --git a/sys/include/arch/amd64/pcb.h b/sys/include/arch/amd64/pcb.h
deleted file mode 100644
index 0e0aab8..0000000
--- a/sys/include/arch/amd64/pcb.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_PCB_H_
-#define _AMD64_PCB_H_
-
-#include <sys/types.h>
-
-struct pcb {
- uint8_t *fpu_state;
-};
-
-#endif /* !_AMD64_PCB_H_ */
diff --git a/sys/include/arch/amd64/spectre.h b/sys/include/arch/amd64/spectre.h
deleted file mode 100644
index d12df21..0000000
--- a/sys/include/arch/amd64/spectre.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_SPECTRE_H_
-#define _AMD64_SPECTRE_H_
-
-#include <sys/cdefs.h>
-#include <sys/errno.h>
-
-__weak int try_spectre_mitigate(void);
-
-#endif
diff --git a/sys/include/arch/amd64/sysvec.h b/sys/include/arch/amd64/sysvec.h
deleted file mode 100644
index 99a84c0..0000000
--- a/sys/include/arch/amd64/sysvec.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_SYSVEC_H_
-#define _AMD64_SYSVEC_H_
-
-#include <sys/cdefs.h>
-
-/*
- * Interrupt vectors reserved
- * to core system usage excluding
- * device IRQs routed by 8259 PIC,
- * I/O APIC, etc.
- */
-typedef enum {
- SYSVEC_LAPIC_TIMER = 0x21, /* Local APIC timer */
- SYSVEC_IPI, /* IPI vector */
- SYSVEC_HLT, /* Halt vector */
- SYSVEC_PCKBD, /* Keyboard vector */
- SYSVEC_TLB, /* TLB shootdown */
-
- /* -- XXX: New vectors go above -- */
- NSYSVEC_BASE, /* Non-system vector base */
-} sysvec_t;
-
-/* Unlikely, but just in case */
-__STATIC_ASSERT(NSYSVEC_BASE <= 0xFF, "VECTOR OVERFLOW CAUGHT");
-
-#endif /* !_AMD64_SYSVEC_H_ */
diff --git a/sys/include/arch/amd64/tlb.h b/sys/include/arch/amd64/tlb.h
deleted file mode 100644
index c85e0e1..0000000
--- a/sys/include/arch/amd64/tlb.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ASM_TLB_H_
-#define _ASM_TLB_H_
-
-#include <sys/cdefs.h>
-
-#define tlb_flush(va) \
- __ASMV("invlpg (%0)" \
- : \
- : "r" (va) \
- : "memory" \
- )
-
-#endif /* !_ASM_TLB_H_ */
diff --git a/sys/include/arch/amd64/trap.h b/sys/include/arch/amd64/trap.h
deleted file mode 100644
index c75fa28..0000000
--- a/sys/include/arch/amd64/trap.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_TRAP_H_
-#define _AMD64_TRAP_H_
-
-#if !defined(__ASSEMBLER__)
-#include <sys/types.h>
-#include <machine/frame.h>
-#endif /* !defined(__ASSEMBLER__) */
-
-#define TRAP_NONE 0 /* Used for general interrupts */
-#define TRAP_BREAKPOINT 1 /* Breakpoint */
-#define TRAP_ARITH_ERR 2 /* Arithmetic error (e.g division by 0) */
-#define TRAP_OVERFLOW 3 /* Overflow */
-#define TRAP_BOUND_RANGE 4 /* BOUND range exceeded */
-#define TRAP_INVLOP 5 /* Invalid opcode */
-#define TRAP_DOUBLE_FAULT 6 /* Double fault */
-#define TRAP_INVLTSS 7 /* Invalid TSS */
-#define TRAP_SEGNP 8 /* Segment not present */
-#define TRAP_PROTFLT 9 /* General protection */
-#define TRAP_PAGEFLT 10 /* Page fault */
-#define TRAP_NMI 11 /* Non-maskable interrupt */
-#define TRAP_SS 12 /* Stack-segment fault */
-
-/* Trap is coming from user mode */
-#define TRAP_USER 0x100
-
-#if !defined(__ASSEMBLER__)
-typedef void(*ftrap_handler_t)(void);
-
-void breakpoint_handler(void *sf);
-void arith_err(void *sf);
-void overflow(void *sf);
-void bound_range(void *sf);
-void invl_op(void *sf);
-void double_fault(void *sf);
-void invl_tss(void *sf);
-void segnp(void *sf);
-void general_prot(void *sf);
-void page_fault(void *sf);
-void nmi(void *sf);
-void ss_fault(void *sf);
-void trap_handler(struct trapframe *tf);
-#else
-.macro handle_trap
- mov %rsp, %rdi
- call trap_handler
-.endm
-#endif /* !defined(__ASSEMBLER__) */
-
-#endif /* !_AMD64_TRAP_H_ */
diff --git a/sys/include/arch/amd64/tss.h b/sys/include/arch/amd64/tss.h
deleted file mode 100644
index ca0ba57..0000000
--- a/sys/include/arch/amd64/tss.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_TSS_H_
-#define _AMD64_TSS_H_
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-
-/*
- * cpu_info is from machine/cpu.h
- *
- * XXX: machine/cpu.h includes this header
- * so we must create this as including
- * machine/cpu.h will not do anything...
- */
-struct cpu_info;
-
-/*
- * A TSS entry (64-bit)
- *
- * See Intel SDM Section 8.2.1 - Task-State Segment (TSS)
- */
-struct __packed tss_entry {
- uint32_t reserved1;
- uint32_t rsp0_lo;
- uint32_t rsp0_hi;
- uint32_t rsp1_lo;
- uint32_t rsp1_hi;
- uint32_t rsp2_lo;
- uint32_t rsp2_hi;
- uint64_t reserved2;
- uint32_t ist1_lo;
- uint32_t ist1_hi;
- uint32_t ist2_lo;
- uint32_t ist2_hi;
- uint32_t ist3_lo;
- uint32_t ist3_hi;
- uint32_t ist4_lo;
- uint32_t ist4_hi;
- uint32_t ist5_lo;
- uint32_t ist5_hi;
- uint32_t ist6_lo;
- uint32_t ist6_hi;
- uint32_t ist7_lo;
- uint32_t ist7_hi;
- uint64_t reserved3;
- uint16_t reserved4;
- uint16_t io_base;
-};
-
-/*
- * TSS descriptor (64-bit)
- *
- * The TSS descriptor describes the location
- * of the TSS segments among other things...
- *
- * See Intel SDM Section 8.2.3 - TSS Descriptor in 64-bit mode
- */
-struct __packed tss_desc {
- uint16_t seglimit;
- uint16_t base_lo16;
- uint8_t base_mid8;
- uint8_t type : 4;
- uint8_t zero : 1;
- uint8_t dpl : 2;
- uint8_t p : 1;
- uint8_t seglimit_hi : 4;
- uint8_t avl : 1;
- uint8_t unused : 2;
- uint8_t g : 1;
- uint8_t base_hi_mid8;
- uint32_t base_hi32;
- uint32_t reserved;
-};
-
-/*
- * Holds the address of the address pointing
- * to the top of an interrupt stack.
- */
-union tss_stack {
- struct {
- uint32_t top_lo;
- uint32_t top_hi;
- };
- uint64_t top;
-};
-
-int tss_alloc_stack(union tss_stack *entry_out, size_t size);
-int tss_update_ist(struct cpu_info *ci, union tss_stack stack, uint8_t istno);
-void write_tss(struct cpu_info *cpu, struct tss_desc *desc);
-void tss_load(void); /* In tss.S */
-
-#endif /* _!_AMD64_TSS_H_ */
diff --git a/sys/include/arch/amd64/uart.h b/sys/include/arch/amd64/uart.h
deleted file mode 100644
index a49e626..0000000
--- a/sys/include/arch/amd64/uart.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* UART 8250 init logic */
-
-#ifndef _UART_H_
-#define _UART_H_
-
-#include <sys/types.h>
-
-int uart8250_try_init(void);
-void uart8250_write(char byte);
-
-#endif
diff --git a/sys/include/arch/amd64/vas.h b/sys/include/arch/amd64/vas.h
deleted file mode 100644
index b8eef89..0000000
--- a/sys/include/arch/amd64/vas.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Hyra nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _AMD64_PMAP_H_
-#define _AMD64_PMAP_H_
-
-#include <sys/types.h>
-#include <sys/spinlock.h>
-
-/*
- * VAS structure - describes a virtual address space
- *
- * XXX: This structure shall exist per-process.
- *
- * TODO: As of now, VAS operations are *not* serialized!!!
- * This must change once Hyra becomes multi-threaded
- * or things will go wrong *very* quickly. Ensure of
- * this or you will suffer the consequences of undefined
- * behavior and you will not like it!
- */
-struct vas {
- size_t cr3_flags; /* CR3 flags */
- uintptr_t top_level; /* PML5 if `use_l5_paging' true, otherwise PML4 */
- bool use_l5_paging; /* True if 5-level paging is supported */
- struct spinlock lock;
-};
-
-#endif /* !_AMD64_PMAP_H_ */