Refresh all files with project headers and documentation

This commit is contained in:
Curle 2020-08-23 00:48:49 +01:00
parent 3eb69c052d
commit 493ef776e2
Signed by: TheCurle
GPG Key ID: 5942F13718443F79
18 changed files with 175 additions and 8 deletions

View File

@ -2,6 +2,11 @@
#ifndef _BOOTLOADER_H_ #ifndef _BOOTLOADER_H_
#define _BOOTLOADER_H_ #define _BOOTLOADER_H_
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -1,9 +1,14 @@
#pragma once #pragma once
/************************ /************************
*** Team Kitty, 2020 *** *** Team Kitty, 2020 ***
*** Sync *** *** Chroma ***
***********************/ ***********************/
/* This file serves as the central kernel header. Every file in the kernel should include this header.
* It provides functionality to every core component of the system, and provides unrestricted cross-communication between modules.
* It also provides the symbols for the framebuffer and configuration file, which are both equually important.
*/
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include <stdarg.h> #include <stdarg.h>
@ -12,6 +17,7 @@
#include <kernel/boot/boot.h> #include <kernel/boot/boot.h>
#include <kernel/system/io.h> #include <kernel/system/io.h>
#include <kernel/system/memory.h> #include <kernel/system/memory.h>
#include <kernel/system/pci.h>
extern size_t LoadAddr; extern size_t LoadAddr;
extern bootinfo bootldr; extern bootinfo bootldr;

View File

@ -1,6 +1,11 @@
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
typedef struct __attribute__((packed)) { typedef struct __attribute__((packed)) {
uint16_t LowLimit; uint16_t LowLimit;
uint16_t BaseLow; uint16_t BaseLow;

View File

@ -1,9 +1,12 @@
#ifndef KHEAP_H #pragma once
#define KHEAP_H
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
uint8_t HeapEnabled = 0; uint8_t HeapEnabled = 0;
#endif

View File

@ -1,6 +1,11 @@
#pragma once #pragma once
#include <stddef.h> #include <stddef.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
extern const char* ExceptionStrings[]; extern const char* ExceptionStrings[];

View File

@ -1,5 +1,10 @@
#include <kernel/system/descriptors.h> #include <kernel/system/descriptors.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
uint8_t kbdSBuffer[8]; uint8_t kbdSBuffer[8];
uint8_t InputBuffer[128]; uint8_t InputBuffer[128];

View File

@ -2,6 +2,11 @@
#include <stdint.h> #include <stdint.h>
#include <kernel/system/interrupts.h> #include <kernel/system/interrupts.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
#define PAGE_SIZE 4096 #define PAGE_SIZE 4096
#define PAGES_PER_BUCKET 8 #define PAGES_PER_BUCKET 8

View File

@ -1,6 +1,6 @@
/************************ /************************
*** Team Kitty, 2019 *** *** Team Kitty, 2020 ***
*** Sync *** *** Chroma ***
***********************/ ***********************/
// This file contains all of the bitmap fonts made by me (Curle) and taken from the public domain // This file contains all of the bitmap fonts made by me (Curle) and taken from the public domain

View File

@ -1,5 +1,17 @@
#include <kernel/chroma.h> #include <kernel/chroma.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
/* This file is the entry point to the system.
* It dictates the order of operations of everything the kernel actually does.
* If a function isn't fired here, directly or indirectly, it is not run.
*/
size_t KernelAddr = (size_t) &LoadAddr; size_t KernelAddr = (size_t) &LoadAddr;
size_t KernelEnd = (size_t) &end; size_t KernelEnd = (size_t) &end;

View File

@ -1,6 +1,23 @@
#include <kernel/chroma.h> #include <kernel/chroma.h>
#include <kernel/system/interrupts.h> #include <kernel/system/interrupts.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
/* This class provides functions for setting up and preparing the CPU for the things the kernel will do.
* Mainly, it allows you to:
*
* Set up and install the GDT and IDT
* Refresh the Code Segment to force ourselves into our own GDT
* Install new ISR and IRQ handlers.
* It also has (unused) functionality for extra stacks, to be used with Non-Maskable Interrupt, Double Fault, Machine Check and Breakpoint Exceptions.
* //TODO
*
*/
#define NMI_STACK 4096 #define NMI_STACK 4096
#define DF_STACK 4096 #define DF_STACK 4096
#define MC_STACK 4096 #define MC_STACK 4096

View File

@ -1,5 +1,20 @@
#include <kernel/chroma.h> #include <kernel/chroma.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
/* This file contains (mostly unused) implementations of a full PS/2 keyboard driver.
*
* It provides provisions for full 2-way communication, as well as auxiliary key commands.
* //TODO: Media keys?
*
* Once this driver is to a workable state, I would like to start adding a proper keyboard buffer,
* which will integrate with a window system.
*
*/
char keys[128] = { char keys[128] = {
0, 27, 0, 27,
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b',

View File

@ -1,6 +1,6 @@
/************************ /************************
*** Team Kitty, 2019 *** *** Team Kitty, 2020 ***
*** Sync *** *** Chroma ***
***********************/ ***********************/
/* This file contains all of the ISR and IRQ /* This file contains all of the ISR and IRQ

View File

@ -1,5 +1,25 @@
#include <kernel/chroma.h> #include <kernel/chroma.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
/****************************************
* W O R K I N P R O G R E S S *
****************************************
*
* This file contains functions for virtual memory management.
*
* Virtual Memory Management is still a work in progress.
* The functions here are hold-offs from old versions of the software implemented here, as well as from the EFI version of Chroma, called Sync.
*
* There, these functions worked, but here, under BIOS, it's a lot more difficult.
* It will take some time to get these functions working.
*
*/
//__attribute__((aligned(4096))) static size_t Pagetable[512] = {0}; //__attribute__((aligned(4096))) static size_t Pagetable[512] = {0};
#define LAST_ENTRY 0xFF8 #define LAST_ENTRY 0xFF8

View File

@ -1,6 +1,27 @@
#include <kernel/chroma.h> #include <kernel/chroma.h>
#include <kernel/system/heap.h> #include <kernel/system/heap.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
/* This file contains functions for physical memory management.
*
* This is also called blocking, or block memory allocation.
* It mostly deals with the memory map handed to us by the bootloader.
*
* It is useful in virtual memory management, because it allows us to map one block of physical memory to one page of virtual memory.
*
* Most of the processing here is done with a bitwise mapping of blocks to allocations, normally called a memory bitmap.
* See heap.h for the implementation.
*
* This file also contains memory manipulation functions, like memset and memcpy.
* //TODO: replace these functions with SSE2 equivalent.
*
*/
uint8_t* Memory = ((uint8_t*)(&end)); uint8_t* Memory = ((uint8_t*)(&end));
uint8_t* MemoryStart; uint8_t* MemoryStart;
size_t MemoryBuckets; size_t MemoryBuckets;

View File

@ -1,5 +1,14 @@
#include <kernel/chroma.h> #include <kernel/chroma.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
/* This file serves to allow us to communicate with the computer through raw I/O.
* It provides interfaces for Ports and commonly used Registers (Control Registers, Model-Specific Registers, GDT, IDT..)
*/
uint32_t ReadPort(uint16_t Port, int Length) { uint32_t ReadPort(uint16_t Port, int Length) {
uint32_t Data = 0; uint32_t Data = 0;
uint16_t Data16 = 0; uint16_t Data16 = 0;

View File

@ -1,4 +1,12 @@
#include <kernel/chroma.h> #include <kernel/chroma.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
/* This file provides functions related to the Serial port.
* Through this file, you send and receive text and extra debugging information if available.
*/
#define SERIAL_DATA(base) (base) #define SERIAL_DATA(base) (base)
#define SERIAL_DLAB(base) (base + 1) #define SERIAL_DLAB(base) (base + 1)

View File

@ -1,6 +1,24 @@
#include <kernel/chroma.h> #include <kernel/chroma.h>
#include <kernel/video/bitmapfont.h> #include <kernel/video/bitmapfont.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
/* This file contains all of the draw-to-screen routines.
* It (currently; 23/08/20) handles the keyboard input test routine,
* moving the current character back and forth, up and down.
*
* It also handles filling the screen with color in the case of an event,
* and will be hooked into Vector and Shape of lainlib to eventually provide
* geometry.
*
* It will also eventually be plugged into stb_image to provide a way to draw PNGs
* and JPGs from disk.
*/
#define FONT bitfont_latin #define FONT bitfont_latin
static size_t strlen(const char* String) { static size_t strlen(const char* String) {

View File

@ -1,5 +1,18 @@
#include <kernel/chroma.h> #include <kernel/chroma.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
/* This file contains all of the String / Print related functions
* that are required by the core of the kernel.
*
* There will be a proper C++ std::string implementation in lainlib.
*
* This file also provides SerialPrintf.
*/
static size_t strlen(const char* String) { static size_t strlen(const char* String) {
size_t Len = 0; size_t Len = 0;
while(String[Len] != '\0') { while(String[Len] != '\0') {