Skip to content

Commit cfbbfc6

Browse files
authored
Merge pull request #91 from kushagra765/0.10
Merge changes from '0.10' branch
2 parents 8b21b20 + d82f068 commit cfbbfc6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+958
-1660
lines changed

.clang-format

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ AllowShortFunctionsOnASingleLine: None
1515
AllowShortIfStatementsOnASingleLine: Never
1616
AllowShortLoopsOnASingleLine: false
1717
BreakStringLiterals: false
18-
ReflowComments: true
19-
SortIncludes: true
20-
UseTab: Never
18+
ReflowComments: true
19+
SortIncludes: true
20+
UseTab: Never
2121
...

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
scripts/gen_initrd
99
toolchain/compiler/
1010
isodir/
11+
kernel/include/generated/

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
# Makefile for Platypus OS
22

33
VERSION = 0.10
4-
EXTRAVERSION = -rc3
4+
EXTRAVERSION =
55

66
MAKEFILE_BUILD = ./scripts/Makefile.build
77
MAKEFILE_RUN = ./scripts/Makefile.run
88

99
.PHONY: all
1010

1111
all:
12-
make -f $(MAKEFILE_BUILD) -j$(nproc)
12+
@./scripts/gen_config.sh
13+
@make -f $(MAKEFILE_BUILD) -j$(nproc)
1314

1415
clean:
15-
make -f $(MAKEFILE_BUILD) clean
16+
@make -f $(MAKEFILE_BUILD) clean
1617

1718
run:
18-
make -f $(MAKEFILE_RUN)
19+
@make -f $(MAKEFILE_RUN)

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ To build the OS, read the [build guide](docs/Building.md).
1818
See the [Mailing Patches](docs/Mailing-Patches.md) file.
1919

2020
# Screenshot
21-
![Image](screenshots/Screenshot-0.10-rc3.png)
21+
Version 0.10 (GitHub Actions Build ISO)
22+
![Image](screenshots/Screenshot-0.10.png)
2223

2324
# Acknowledgments
2425
## Projects
25-
- [pdclib](https://github.com/DevSolar/pdclib) (The libc is based on pdclib)
26+
- [pdclib](https://github.com/DevSolar/pdclib)
27+
- [libc11](https://github.com/dryc/libc11)
2628

2729
# License
2830
This project is licensed under GPL v2. See the [`LICENSE`](LICENSE) file for more info.

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
| Version | Supported |
66
| ------- | ------------------ |
7-
| 0.10-rc2 | :white_check_mark: |
7+
| 0.10 | :white_check_mark: |
88
| 0.09 | :x: |
99
| 0.08 | :x: |
1010
| 0.07 | :x: |

docs/Building.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ cd ./toolchain/
55
sh ./build_toolchain.sh
66
```
77

8-
After the toolchain is built, you can build the OS by running: <br/>
9-
`make`
8+
After the toolchain is built, you can build the OS by running: `make`
109

1110
# Building the OS (without toolchain)
1211
If you already have the `i686-elf-gcc` toolchain, there's no need to build it again. Open the `scripts/Makefile.build` file and change the `CC` variable to the path where you have installed the toolchain and run `make`.
13-
14-
# Booting the OS
15-
After building the OS, you can boot it by running `make run`.
File renamed without changes.

docs/user-guide/User-Guide.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# User Guide
22
This is what you should read if you're a user, and you want to try it out.
3+
34
## Prerequisites
45
1. [Building](../Building.md)
6+
57
## Table Of Contents
6-
1. [The Terminal](terminal.md)
8+
1. [The Terminal](Terminal.md)

init/main.c

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
#include "multiboot.h"
2+
#include <assert.h>
23
#include <cpu/gdt.h>
34
#include <cpu/idt.h>
45
#include <cpu/irq.h>
56
#include <cpu/isr.h>
7+
#include <floppy/floppy.h>
68
#include <initrd/initrd.h>
7-
#include <kernel/paging.h>
9+
#include <kernel/device.h>
10+
#include <kernel/elf.h>
11+
#include <kernel/kheap.h>
12+
#include <kernel/pmm.h>
813
#include <kernel/printm.h>
9-
#include <kernel/task.h>
14+
#include <kernel/vmm.h>
1015
#include <keyboard/keyboard.h>
1116
#include <pit/pit.h>
1217
#include <rtc/rtc.h>
@@ -17,8 +22,8 @@
1722
#include <vga/framebuffer.h>
1823
#include <vga/vga.h>
1924

20-
extern uint32_t placement_address;
2125
uint32_t initial_esp;
26+
elf_t kernel_elf;
2227

2328
void welcome_screen() {
2429
settextcolor(LIGHT_YELLOW, BLACK);
@@ -43,13 +48,12 @@ void welcome_screen() {
4348
settextcolor(BLUE, BLACK);
4449
writestr("Version: ");
4550
settextcolor(LIGHT_RED, BLACK);
46-
writestr("0.10-rc3\n");
51+
writestr("0.10\n");
4752
reset_text_color();
4853
writestr("\n");
4954
}
5055

51-
void kernel_main(multiboot_info_t *mboot_info, uint32_t initial_stack) {
52-
initial_esp = initial_stack;
56+
void kernel_main(multiboot_info_t *mboot_info) {
5357

5458
// Initialize VGA and Framebuffer
5559
init_vga();
@@ -60,24 +64,39 @@ void kernel_main(multiboot_info_t *mboot_info, uint32_t initial_stack) {
6064
init_idt();
6165
init_isr();
6266
init_irq();
63-
writestr("[OK] Load GDT, IDT, ISR and IRQ\n");
67+
printm("[OK] Load GDT, IDT, ISR and IRQ\n");
6468

6569
// Load Drivers
6670
init_pit(1000);
6771
init_keyboard();
68-
register_snd_driver();
72+
init_pcspkr();
6973
init_serial();
7074
init_rtc();
71-
writestr("[OK] Load Drivers\n");
75+
printm("[OK] Load Drivers\n");
7276

77+
init_pmm(mboot_info->mem_upper);
78+
init_vmm();
79+
80+
uint32_t i = mboot_info->mmap_addr;
81+
while (i < mboot_info->mmap_addr + mboot_info->mmap_length) {
82+
multiboot_memory_map_t *entry = (multiboot_memory_map_t *)i;
83+
84+
if (entry->type == MULTIBOOT_MEMORY_AVAILABLE) {
85+
uint32_t j;
86+
for (j = entry->base_addr_low;
87+
j < entry->base_addr_low + entry->length_low; j += 0x1000) {
88+
free_page_pmm(j);
89+
}
90+
}
91+
i += entry->size + sizeof(uint32_t);
92+
}
93+
94+
kernel_elf = elf_from_multiboot(mboot_info->u.elf_sec);
95+
96+
ASSERT(mboot_info->mods_count > 0);
7397
uint32_t initrd = *((uint32_t *)mboot_info->mods_addr);
74-
uint32_t initrd_end = *(uint32_t *)(mboot_info->mods_addr + 4);
75-
placement_address = initrd_end;
7698

77-
// Initialize paging and tasking
78-
init_paging();
79-
init_tasking();
80-
writestr("[OK] Initialize paging and tasking\n");
99+
init_device_manager();
81100

82101
irq_enable();
83102

@@ -87,8 +106,9 @@ void kernel_main(multiboot_info_t *mboot_info, uint32_t initial_stack) {
87106
writestr("Kernel command line: %s\n", mboot_info->cmdline);
88107
uint32_t memsize = (mboot_info->mem_lower + mboot_info->mem_upper) / 1024;
89108
writestr("Total memory: %d MB\n", memsize);
90-
writestr("Initrd at address: %x", initrd);
91-
writestr("\n\n");
109+
writestr("Initrd at address: %x\n", initrd);
110+
detect_drives_floppy();
111+
writestr("\n");
92112

93113
vfs_root = init_initrd(initrd);
94114

init/multiboot.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,10 @@ struct multiboot_color {
222222

223223
struct multiboot_mmap_entry {
224224
multiboot_uint32_t size;
225-
multiboot_uint32_t addr;
226-
multiboot_uint32_t len;
225+
multiboot_uint32_t base_addr_low;
226+
multiboot_uint32_t base_addr_high;
227+
multiboot_uint32_t length_low;
228+
multiboot_uint32_t length_high;
227229
#define MULTIBOOT_MEMORY_AVAILABLE 1
228230
#define MULTIBOOT_MEMORY_RESERVED 2
229231
#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3

0 commit comments

Comments
 (0)