Merge into main the new state of the operating system/kernel #1

Open
Nigel wants to merge 120 commits from dev into main

120 Commits

Author SHA1 Message Date
2522492835 Couple of small changes
* Commented out the map page function call to handle page not present
* Mapped the ACPI_RECLAIMABLE_MEMORY
* Set VBE to false when VBE is not initialized by the bootloader
2023-10-28 20:42:28 +02:00
e82392e9d9 FAT Filesystem implementation additions 2023-10-27 18:07:11 +02:00
64c87a2a58 Fixing an issue in the CoreLib 2023-10-27 18:04:09 +02:00
04470edcc6 Adding gdb init and adjusting some of the build automation steps 2023-10-27 18:03:45 +02:00
2970806705 ACPI reading memory when mapped to higher half 2023-09-11 23:23:38 +02:00
e8df6ec628 Updating Build scripts 2023-09-11 23:21:43 +02:00
5781f730d9 Implemented the basis for syscalls
A software interrupt with vector 0x50 will cause a syscall to start executing.
The EAX register will hold the syscall_num.
Other registers and the stack can be used to hold further arguments.
2023-02-27 00:34:30 +01:00
2d0bb16fad Fixed up ACPI Version 1.0 checksum validation code 2023-02-27 00:32:16 +01:00
e6901f0526 We can now open and read files on the harddisk through a messy virtual filesystem
The uri has to contain 8.3 filenames for now as I have not yet figured out
how to convert from that to regular filenaming for the name comparison.

reading files is still limited to 1 sector
2023-02-26 13:44:41 +01:00
61f1852420 Added file reading without cluster chain following 2023-02-25 21:03:10 +01:00
32b0d990df Added ctype std lib functions 2023-02-25 20:41:21 +01:00
745656eb2d Fixup C++ compiler path in makefile of CoreLib
memcpy implementation added
2023-02-25 20:04:34 +01:00
644ff5b1f5 Adding subdir functionality
Added FAT16 driver ability to list subdir entries
Removed structure of FAT32 (we won't be using it anytime soon)
2023-02-24 21:31:20 +01:00
a77621faf5 Shellscript improvement plus FAT driver implementations
- Improved the run bash script to exit when an error occurs in one of the sub tasks
- Wrote basic FAT16 functions that should give enough information to properly implement the rest of the driver
- FAT structure namings are now in accordence with the microsoft spec of March 2005
2023-02-23 23:54:02 +01:00
50bf952a49 Basic idea's are created for the storage solution
- Added boot device info parsing to the kernel
- Added a pointer in the kernel to our pre-kernel BootInfo structure
- Created a layout for the FAT driver
- Created a layout for the virtual filesystem
- Separated IDE driver from the basic atapio driver.
	This will ensure we are not using one or the other
- The create_harddrive shell script will now actually build a harddrive image of
	the kernel
- The virtual filesystem initializes and creates a filesystem structure
	for every FAT16 partition in the master boot record
2023-02-21 21:43:14 +01:00
ef2bba5c1c Started fleshing out the storage API 2023-02-21 14:36:20 +01:00
81f7351fe6 Created a few shell scripts to update and create an build of the Kernel/Operating System.
A python script can be run to run the scripts in the correct order and immediatly try the build.
2023-02-20 01:03:46 +01:00
dea8ab7d71 Improved build system
Added new entries to .gitignore
Moved away from source directory as central spot for all source code
2023-02-20 00:29:06 +01:00
2bcc79216e Remove mlibc submodule. The standarc C/C++ will use later on will be added later.
It may or not be mlibc
2023-02-19 23:47:43 +01:00
b07b4f0d38 Moving certain aspects into their own static library
Problem:
	As our kernel grows we need more complex datastructures and functions these would come from
	the standard C/C++ library with normal programs.
	The kernel is a freestanding programme and has no access to standard libraries.

Solution:
	We build a mini version of the standard C/C++ library which will contain the
	datastructures and functions we want. This library can then be statically linked
	into our kernel binary.

	Making it a statically linked library also gives more structure to the project.
	Keeping these random functions and datastructures in the kernel just clutters the
	kernel source code with less relevant source code.
2023-02-19 23:38:32 +01:00
94a2de3847 Started on path resolution algorithm
- The algorithm will work once I am of better mind to deal with
raw C strings
- The resolution should look at each entry divided by '/'.
  if the entry is not there then we can quit early, however for
now I am mostly concerned with getting the names of directory entries
we would need to look for.
2023-02-19 22:17:56 +01:00
dbb147e110 Primitie listing rootdir of FAT16 filesystem 2023-02-19 14:17:47 +01:00
37542b736f Remove cpu.h and cpu.cpp in favor of i386/processor.[h|cpp]
Moving enable protected Mode to processor class
2023-02-17 22:01:32 +01:00
490529099b Started implementing the virtual file system
- The FAT command is no longer available
- At Startup the FileSystem initialise funciton
is called, it should execute the same code as the FAT command did.
- ACPI::initialise is commented out because it causes a Exception
2023-02-17 21:52:03 +01:00
133c16cae7 Added CPUID based checks 2023-02-17 16:27:36 +01:00
ecab248cd6 Clean up jump into RING 3 2023-02-17 14:46:44 +01:00
4ce7cc093b Cleanup of PCI API 2023-02-17 14:42:42 +01:00
c9a036bfbb Ring 3 ready
- Fixed issue with setting up the Task Segment Register
2023-02-13 22:44:47 +01:00
1f90a5d862 Starting to move towards proper HAL and ring3
- slight clean up of PCI driver
- Added TaskSegment header
- Rename some folders
2023-02-11 12:22:45 +01:00
520104a43a Moved reading file from disk to its own super visor terminal command
- Updated gdt assembly
- Updated Interrupt service request handlers
- Improved virtual memory manager
- NOTE: we're dependent on identity mappings for the heap to work
2023-02-08 14:07:44 +01:00
7993a2d172 Merge interrupts into dev 2023-02-05 10:30:10 +01:00
27e99fe4f2 Merged FAT16 into Dev
Hopefully with success
2023-02-03 21:47:05 +01:00
749f2aa492 Updating folders name's (1)
This should help merging into dev branch
2023-02-03 20:01:31 +01:00
891085e151 Successfully able to create a disk-image file
- Created a scripts folder
- Written instructions on how to create the disk image
- Working on a python build script that executes all other scripts

The scripts folder should contain scripts to build a full installation of
our operating system. Scripts like creating a filesystem should be found here
2023-02-02 14:59:42 +01:00
364d10d02e src folder -> source folder; makes merging with dev a bit easier. 2022-09-10 20:06:49 +02:00
68371475d9 Marking memory management features as done. Work still needs to be done but the bare minimum for memory management is there. 2022-09-03 17:38:22 +02:00
16e2354019 KERNEL: Moved serials test function into the test folder 2022-09-03 17:27:41 +02:00
a47879f404 KERNEL: First Kernel heap implementation 2022-09-03 17:27:29 +02:00
656ca0baa8 KERNEL: Pre-kernel sets up the physical memory manager.
* BUG: allocated blocks is possibly incorrect!
* prekernel no longer gets compiled as being in physical memory
2022-09-03 01:00:17 +02:00
01fcb0aa15 KERNEL: Improved Physical memory allocation code / Code refactor
* Moved tests to a different folder
* Adjusted the memory map address locations
* Improved readability of `kernel.cpp`
2022-09-02 21:09:51 +02:00
13e9beea79 KERNEL: Implementing VMM & cleaning up
Folders now are alll lower case

Started working on the implementation of the Virtual memory manager. Implemented allocate and free page funtionality for as far as I can atm.

Implemented the
2022-09-01 20:16:16 +02:00
9893a0bd17 KERNEL: Cleanup
Removing quite a few unnecessary parts.
2022-09-01 17:02:04 +02:00
a70ae5ca31 KERNEL: Mapping the bios region ( below 1Mib)
Keyboard.h: remove the incorrect use of typedef

PhysicalMemoryManager.cpp:
Map the Bios region as used. This prevents us from allocation the area used by the bios
2022-09-01 16:42:56 +02:00
15443601a6 Adding dev-scripts (Without much content) .. this can later help setting up the projects on other pc's. 2022-09-01 16:15:24 +02:00
c90e90bd84 Moving the images from the repo into the disk folder 2022-09-01 16:15:24 +02:00
a5e7fdd07e KERNEL: Physical Page Frame allocation
Rewriting the setup to allow for physical memory allocation again to work.
2022-09-01 16:15:10 +02:00
59ba41f3d2 Multiboot Memory Map get copied to a "safe" place 2022-08-23 21:35:19 +02:00
5051b8903c Divided the kernel into seperate distinct phases
The first stage after GRUB will be Pre-Kernel. This stage will organize the
information we receive from the bootloader. (in our case that will be grub)

The second stage is for now called early_main. The program will at this
point already be running in virtual higher-half / higher-quarter address space.
The goal of the second stage is to set up the kernel in such a way that we are
ready to jump in to usermode.

The third stage is for now called kernel_main. This stage will jump us into
usermode and load the startup programs.

- Added a GRUB entry for tests
- Started writing the pre-kernel stage
- Removed knowledge of multiboot from early_main
- Edited the linkerscript to link variables in pre-kernel to
	lower address space. ( from 1MB and up)
2022-08-22 21:16:34 +02:00
0f0fc9f252 Adding a skeleton for the memory management code
Moved the PMM away from being object orientated as it is just plain annoying
renamed src folder to source
Set timeout to 5 seconds in the grub config
2022-08-21 21:18:53 +02:00
e70f56a005 Improving the memory mapping boot code
Removed the need to map the extra MBI structure in as a seperate pagetable
Renaming / Restructuring the memory folder
2022-08-21 21:15:15 +02:00
560dd64e64 Kernel is working in its full former glory as a higher half kernel 2022-08-19 23:44:38 +02:00
9436e6e033 End of the day cleanup.
* Added symbol files to .gitignore
* Improved text in #PG and #GP handlers
* Added the printing of the multiboot structure address and the magic value
* Added page fault screenshot to readme
2022-08-19 01:05:10 +02:00
d280aa0584 Page faults and protetion faults will now hang with a helpful message
to explain what is going on.

I removed previously set barriers from the code to load
the kernel further.
2022-08-19 00:44:52 +02:00
7d6c823d79 Basic Launch of Higher half kernel
We now can launch the kernel at 0xC0000000 (or 3 GiB mark) with paging enabled.
A lot of early main is currently not executed to keep debugging as simple as possible
during the initial testing of higher half kernel loading.

A lot of the implementation is straight from wiki.osdev.org/Higher_Half_x86_Bare_Bones. Thanks to all the folks
who keep that wiki updated, its really resourceful.
2022-08-18 01:26:49 +02:00
bbfea39c23 Fixing include paths for new structure
Removed non-sensical libc folder from project
2022-08-17 14:57:50 +02:00
3b3e2597a1 Restructering Kernel folder before moving to higher half kernel
The boot up process will be changed somewhat dramatically, therefor a
restructering of the kernel seems as a good starting point.
2022-08-17 14:29:26 +02:00
0b0e37b762 Paging cleanup, more cpu testing and psuedo code for higher half kernel 2022-08-17 14:17:58 +02:00
388ac8e7f9 Added checks to be sure paging is actually enabled on the cpu.
- Made a special assembly file to put CPU check function in. E.G. functions to get the state of
	specific registers

In this case I have created a simple assembly function to get the contents of the CR0 register.
With the help of the c++ preprocessor the value can then be used to check if certains bits are set.
For example to check if the PG (paging) bit is set, indicating that paging is enabled for the
processor.
2022-08-16 19:06:16 +02:00
9172da075a Added identity paging basics
Followed wiki.osdev.org/Setting_Up_Paging
2022-08-15 19:51:22 +02:00
23c68d9863 Setup paging function signatures... Ready to be implemented. 2022-03-18 22:09:04 +01:00
2e2693d1ea Build some structures will need for the virtual filesystem 2022-03-15 21:56:32 +01:00
a93bf566c8 Added FAT-16 screenshot 2022-03-12 17:04:38 +01:00
2e59e6593e Add proper Physical memory management to this branch
to ensure it doesn't get too out of date

We can now run the FAT command to demo reading out the FAT16 filesystem,
however this will cause the need for a reboot as after this command. We are FOR NOW
not able to put in any new commands
2022-03-12 16:56:50 +01:00
b4cff3e667 Basic block allocation for physical memory allocation.
- 1 block = 4096 bytes : because this will make page fault handling possibly
somewhat easier

- 1 byte in the bitmap = 8 blocks of physical memory

unsure if the allocation is perfect ... guess i'll find out some day if this is actually correct.

The bitmap needs 16kb to keep track of 2gb of physical memory. Seems a decent percentage to me.
2022-02-26 20:55:34 +01:00
7330b81a10 Started definition file for a CMOS driver 2021-12-29 16:28:55 +01:00
97606dbf71 Clean up of debugging logs and new commands.
As this project grows it becomes important to keep things properly organised.
In this commit I've put some effort into making the kernel.cpp file more consise and thus improve its
readability.
Certain parts of the code have gotten their own definition file where before it
was only a header file.

- Moving the Supervisor Terminal into its own definition file.
- Subtracting debugging messages with preprocessor ifdef's
- Time and Date is now not just a header but has its own proper definition file
- Banner is displayed when booting up
- Terminal has a couple new commands

	Commmand		Description
	=================|||||===================================================
	DATE (was TIME)		Displays the curren time, date and ticks
	VERSION			Displays system version information
	MEMORY			Displays memory information
2021-12-29 16:15:18 +01:00
7496299761 Basic Intel Exceptions
Any interrupt thrown for any Intel defined Exception is not only being caught but
displays an appropriate message to the screen.

Changes made in src/kernel/idt/idt.cpp
2021-12-28 19:54:10 +01:00
0d8ef065e0 Interactive supervisor mode
To ease the pain of debuggin I can now interact with the system through a
very simplistic terminal. Hopefully things can be tested more easily by activating
the piece through a simple command. The max characters for a command is 10.

To achieve this I have had to make the following changes.
- Changed IRQ to update a global status variable
- Added a standalone keyboard driver with getKey functions
- Changed the main kernel loop to display a prompt
- Added a strncmp function to the clib/string file
2021-12-28 19:52:48 +01:00
19b9cfe908 Reading files from disk
- Modified makefile to start the virtualbox vm on `make run`
- Listing files in rootdirectory with their properties and
	content
2021-12-27 19:35:24 +01:00
b8d75dddae Moving lots into seperate folders to cleanup the project structure
- Drivers have now gotten Category folders
- RSDP is now called ACPI
- Ports folders is now called Serial to show that its a serial driver
- Paging assembly definition is moved to the memory folder
- VGA folder has moved into the drivers
- Patched the makefile and include statements to reflect the changes
	in the project structure
2021-12-27 15:26:32 +01:00
fb2a19e11d FAT16 structures read from disk using ATA.
The proper reading of folders and files is not yet implemented. Although
it is close.
2021-12-24 21:31:10 +01:00
72008b0a7a Find RSD Table in early BIOS memory
Adding functions and structures to read the RSD.
2021-12-24 20:13:28 +01:00
2621399349 Small code fix up
- Moved memcmp function to temporary libc/mem.h
- I/O functions are inlined
- ATA_DEVICE read function won't print the 512 bytes by default
2021-12-24 20:08:18 +01:00
767dac7e73 Adjustments to IDE driver 2021-12-23 17:46:27 +01:00
6d946ddce3 Struct defining the EXT2 filesystems superblock 2021-12-23 17:44:27 +01:00
9173b90eb1 Structures added for MasterBootRecord support 2021-12-23 17:43:25 +01:00
bd5d3f5d49 Basic PIO ATA driver which can read and identify ata drives 2021-12-23 17:41:07 +01:00
88cc1d75bb Re-enabled interrupts from keyboard, Enabled and configured the PIT to throw interrupts at a regular interval 2021-12-20 21:53:57 +01:00
2db83b33e1 ATAPI can identify a device correctly 2021-12-01 00:00:45 +01:00
5a68f77b33 Started the base implementation for PCI IDE drivers 2021-11-29 20:00:28 +01:00
72438ae70d Makefile: Added ISO test option for qemu. 2021-11-28 23:06:21 +01:00
a36e3d1c16 PCI support checked of on features.md, PCI enumeration screenshot added to readme.md 2021-11-28 21:12:12 +01:00
08b97af863 PCI: enumeration code cleanup 2021-11-28 21:07:05 +01:00
5089da5e9e PCI: Improved syntax of PCI enumeration, Added a PCI information storage class and structs 2021-11-28 16:46:16 +01:00
ec654143c6 Basic PCI Enumeration 2021-11-25 22:05:16 +01:00
23ede25ed6 Small changes to reflect renaming in readme.md 2021-11-22 20:04:14 +01:00
ba043ef31b Small improvements on Makefile, TODO.md has been renamed to features.md 2021-11-22 20:01:12 +01:00
88c5196586 Rewritten GDT logic 2021-11-16 21:17:49 +01:00
3a87b74224 Renaming/Moving stuff into a different file structure 2021-11-16 13:57:15 +01:00
32909aaed9 GDT is running again 2021-11-06 21:56:42 +01:00
5fb55367ca Implementation of simplistic physical memory manager 2021-11-06 16:27:13 +01:00
d79fc6e8e2 Split up boot.s into multiple assembly definitions, Started page frame allocator implementation, kterm definition is now considered c plus plus 2021-11-06 14:05:29 +01:00
5f39f7e7ed Merge branch 'dev' into InterruptHandling 2021-11-02 21:56:57 +01:00
d455735ea2 Modified screenshot?? 2021-11-02 21:44:50 +01:00
bdcf9e66f8 Small adjustment in directory structure of memory and bootloader files in kernel 2021-11-02 21:15:00 +01:00
c9b789ed7b Added a bunch of new stuff no time to figure out what's what, No longer any compiler warnings 2021-11-02 21:03:11 +01:00
b4b615ae97 Checked off some todo's 2021-10-23 12:27:13 +01:00
092c5d520d Added option to create an iso 2021-10-23 12:26:15 +01:00
643f2d708b Added emulator options, Added header for VBE driver, Added CPUID function, Added demodisk.img as drive 2021-07-22 22:14:58 +01:00
f2c8b8ac5c Improved multiboot compliance 2021-07-22 20:02:47 +01:00
f48f8072c0 Merge InterruptHandling into MemoryManagement 2021-07-22 19:11:01 +01:00
9dc7a05da1 Basic keyboard input 2021-07-21 21:31:57 +01:00
7409e579c8 Basic keyboard input 2021-07-21 21:31:57 +01:00
59bcc17668 Kernel now responding to keyboard interrupts 2021-05-28 22:20:13 +01:00
04f941a625 Kernel now responding to keyboard interrupts 2021-05-28 22:20:13 +01:00
5f50f8c013 Fix up wrong interrupt handler numbers in boot.s 2021-05-28 22:18:50 +01:00
24a855bb3b Fix up wrong interrupt handler numbers in boot.s 2021-05-28 22:18:50 +01:00
595a7d5163 Nicer time print 2021-05-22 19:24:29 +01:00
83d220019c Nicer time print 2021-05-22 19:24:29 +01:00
e84d196b00 Kernel now enter continuous time telling mode 2021-05-18 21:14:26 +01:00
48b65b2276 Kernel now enter continuous time telling mode 2021-05-18 21:14:26 +01:00
f71a3a8ed6 Removed itoa and printf from idt 2021-05-18 21:13:14 +01:00
e0dfa69df8 Removed itoa and printf from idt 2021-05-18 21:13:14 +01:00
63ea825e2e Added CMOS time read function, Added cariage return support to kterm 2021-05-18 21:11:48 +01:00
394882ca2e Added CMOS time read function, Added cariage return support to kterm 2021-05-18 21:11:48 +01:00
a094f510d3 More work on interrupt handling, Started timer interrupt implementation, PIC remapped hopefully successfull 2021-05-16 15:53:14 +01:00
592db0ebcf More work on interrupt handling, Started timer interrupt implementation, PIC remapped hopefully successfull 2021-05-16 15:53:14 +01:00
nigel
28ac6a05af Interrupts are working.. processor no longer resets 2021-05-12 20:43:15 -04:00
0d0c06ab09 Working on PIC 2021-05-12 23:48:06 +01:00
5e668f5e67 Basics for an proper GDT and IDT 2021-05-12 23:03:00 +01:00