Compare commits

...

6 Commits

Author SHA1 Message Date
lucic71 537f6c61a7 Added kernel size assertion 2020-07-17 17:22:04 +03:00
lucic71 a32bf1ad04 Fixed pmmap_size 2020-07-16 16:57:22 +03:00
lucic71 ac2ae75f5b Fixed lists in README 2020-07-16 12:50:37 +03:00
lucic71 911fd3dd64 Merge branch 'master' of https://github.com/lucic71/lucicOS 2020-07-16 12:46:44 +03:00
lucic71 ebfce6701c Updated README 2020-07-16 12:45:50 +03:00
Lucian c2e88d1669
Create LICENSE.md 2020-07-16 11:50:53 +03:00
7 changed files with 78 additions and 9 deletions

25
LICENSE.md Normal file
View File

@ -0,0 +1,25 @@
BSD 2-Clause License
Copyright (c) 2020, Lucian
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.
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 HOLDER 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.

View File

@ -1,20 +1,60 @@
# lucicOS
![OS logo](logo.png)
![OS logo](demo/logo.png)
lucicOS is an educational, UNIX-like operating system built from scratch using
the following resources:
* [OSdev](https://wiki.osdev.org/Expanded_Main_Page)
* [Little OS Book](https://littleosbook.github.io/)
* [JamesM kernel development tutorial](http://www.jamesmolloy.co.uk/tutorial_html/)
* [OS from 0 to 1](https://github.com/tuhdo/os01)
* [Intel manuals](http://web.eecs.umich.edu/~farnam/482/Winter99/intarch.html)
* [BrokenThron](http://www.brokenthorn.com/Resources/OSDevIndex.html)
At the moment it is not aimed to be portable or support multiple architectures.
It is just my attempt to learn some important concepts about operating systems
and develop my coding techniques.
It only supports x86 architecture.
## Building the project
It can be built using the following command: `./build.sh`. To run the OS in
bochs, just run `./bochs.sh`, the same applies to qemu, just run `./qemu.sh`.
For building, running and testing, I use the following tools:
* i686-elf-gcc (GCC) 8.2.0
* GNU ld (GNU Binutils) 2.31.1
* GNU ar (GNU Binutils) 2.31.1
* QEMU emulator version 2.11.
* Bochs ??
## Screenshots
![Screenshot](demo/screenshot.png)
## Features
At this moment there is still a lot of work to do in order to call this a real
Operating System. It has some modules for writing to VGA, for writing to
a serial port and it has support for entering in protected mode.
Operating System.
These are some features that I managed to understand and implement:
* VGA (writing on screen)
* Serial (writing on serial ports)
* Keyboard (reading characters/shortcuts from keyboard)
* Timer (Receiving data from Programmable Interval Timer)
* Physical and Virtual Memory Mangers
* Interrupt request and Interrupt Service Routines
* Global Descriptor Table and Protected Mode
What I am currently working at:
* Moving the kernel in the Higher Half
* Writing a consistent Page Allocator
* Making a tutorial out of this project
## License
This project is licensed under BSD-2-Clause License.
## Notes
The only supported architecture is x86 because it has the richest documentation
and all the tutorials on the internet are x86 oriented.

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

BIN
demo/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -52,8 +52,12 @@ SECTIONS {
*(.note.gnu.build-id)
}
_kernel_size = _kernel_end - _kernel_start;
}
ASSERT(_kernel_size < 0x300000, "Kernel size exceeds 3MB");
/*
* Note:
* COMMON section keeps data objects that are not yet allocated,

View File

@ -1,9 +1,9 @@
#ifndef PMM_INTERNALS_H_
#define PMM_INTERNALS_H_
#define BLOCKS_PER_BYTE 8
#define BLOCK_SIZE 4096
#define BLOCK_ALIGN BLOCK_SIZE
#define BLOCKS_PER_DWORD 32
#define BLOCK_SIZE 4096
#define BLOCK_ALIGN BLOCK_SIZE
/* Macros for testing and aligning memory. */

View File

@ -24,8 +24,8 @@ void pmm_init(uint32_t pmmap_addr, size_t size) {
used_blocks = max_blocks;
pmmap = (uint32_t *) pmmap_addr;
pmmap_size = mem_size / BLOCKS_PER_BYTE;
if (mem_size % BLOCKS_PER_BYTE)
pmmap_size = max_blocks / BLOCKS_PER_DWORD;
if (max_blocks % BLOCKS_PER_DWORD)
pmmap_size++;
memset(pmmap, 0xFF, pmmap_size);