Skip to content

Commit 4f26c0c

Browse files
author
Louis Jenkins
committed
Minor updates and README
1 parent e512da6 commit 4f26c0c

File tree

8 files changed

+90
-85
lines changed

8 files changed

+90
-85
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The below depicts an early "schedule" or rather a path I will be taking in terms
2121
- [ ] ELF Binary Support
2222
- [ ] Graphical User Interfaces
2323

24-
#Progress Update
24+
#Progress Update & Changelog
2525

2626
## Version .001a
2727

@@ -34,4 +34,17 @@ Implemented the GDT, IDT (and IRQs and ISRs), reprogrammed the PIC's (Master and
3434
Implemented the keyboard driver, but it won't be able to communicate with other components (such as an interactive shell) until memory management is implemented... perhaps, not even until processes and scheduling is implemented. That is the next thing I will be releasing. Currently, when you execute
3535
the OS, it will have a blank screen, until you use the keyboard. When executing the keyboard, it will display what key has been pressed and what has been released... but only one at a time unfortunaately, no multi-key press events are supported.
3636

37-
![Screenshot](/kbd_input.PNG)
37+
![Screenshot](/kbd_input.PNG)
38+
39+
## Version .001c
40+
41+
Began implementation of memory management, but not finished yet. Paging SHOULD be implemented very soon (and most code has been written), as well the heap is also mainly written using Pancakes' Bitmap Heap implementation, and paired with the identity paging technique, development of all other parts of the OS should proceed as expected. Today, I also managed to make use of the multiboot info struct that GRUB
42+
gives us that was pushed on the stack in 'kernel_init', and now it can detect the amount of physical memory (RAM) that the machine (or virtual machine) has to offer. This is crucial to finished memory management.
43+
44+
As well, there has been a huge restructure in terms of the hierarchy and logical structure of the operating system. For example, the folders 'mm' and 'drivers' now also have their own respective folders in the
45+
include folder, I.E 'drivers/vga.c' will have it's header in 'include/drivers/vga.h'. While in terms of usability, it is not too much of an update (yet, memory management will be in version .002), there has been
46+
a significant amount of work and should be pushed to master.
47+
48+
Lastly, I also added a nice logger macro, `KLOG`, and panic macro, `KPANIC`.
49+
50+
![Screenshot](/ram_and_kbd.PNG)

ram_and_kbd.PNG

62.5 KB
Loading

src/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ if [ $? -ne 0 ]; then
3333
fi
3434

3535
# Finally, run the virtual machine.
36-
bochs -f bochs.bxrc;
36+
bochs -f bochsrc.bxrc;

src/kernel/include/kernel/logger.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <stdio.h>
55

66
#ifndef NDEBUG
7-
#define KLOG(format, ...) printf(format, ##__VA_ARGS__)
7+
#define KLOG(format, ...) printf(format "\n", ##__VA_ARGS__)
88
#else
99
#define KLOG(format, ...)
1010
#endif
@@ -13,7 +13,7 @@
1313
// Kernel Panic which will just print error message and spin
1414
#define KPANIC(format, ...) \
1515
do { \
16-
printf("[%s:%s:%s] PANIC: \"" format "\"", __FILE__, __FUNCTION__, STRINGIFY(__LINE__), ##__VA_ARGS__); \
16+
printf("[%s:%s:%s] PANIC: \"" format "\"\n", __FILE__, __FUNCTION__, STRINGIFY(__LINE__), ##__VA_ARGS__); \
1717
asm volatile ("cli"); \
1818
while (true) \
1919
asm volatile ("hlt"); \

src/kernel/include/kernel/multiboot.h

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,32 +62,26 @@ struct multiboot_mmap {
6262

6363

6464
static bool multiboot_RAM(struct multiboot_info *mbinfo, uint32_t *start, uint32_t *end) {
65+
bool found = false;
6566
printf("Flags: %d\n", mbinfo->flags);
6667
// Check if there is a memory mapping available
6768
if (mbinfo->flags & (1 << 6)) {
68-
// We are going to be skipping the lower ram...
69-
bool found_lower = false;
70-
KLOG("MMAP Entries: %d\n", mbinfo->mmap_length / 16);
69+
KLOG("MMAP Entries: %d", mbinfo->mmap_length / 24);
7170
struct multiboot_mmap *mmap = mbinfo->mmap_addr;
7271
while(mmap < mbinfo->mmap_addr + mbinfo->mmap_length) {
73-
KLOG("MMAP Type: %x, MMAP Start: %x, MMAP Length: %x, MMAP Size: %x\n", mmap->type, mmap->start_high, mmap->length_high, mmap->size);
72+
KLOG("MMAP Entry: {Type: %s, Start: %x, Length: %x}", mmap->type == MULTIBOOT_MMAP_RAM ? "RAM" : "RESERVED", mmap->start_low, mmap->length_low);
7473
// Jackpot... (The OS is 32-bit, so there is no upper currently.)
7574
if (mmap->type == MULTIBOOT_MMAP_RAM) {
76-
KLOG("MMAP RAM entry found!\n");
7775
*start = mmap->start_low;
7876
*end = *start + mmap->length_low;
79-
if (found_lower) {
80-
return true;
81-
} else {
82-
found_lower = true;
83-
}
77+
found = true;
8478
}
8579

8680
mmap = (struct multiboot_mmap *) ((uint32_t) mmap + mmap->size + sizeof(mmap->size));
8781
}
8882
}
8983

90-
return false;
84+
return found;
9185
}
9286

9387
#endif /* MOLTAROS_MULTIBOOT_H */

src/kernel/kernel/kernel.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ void kernel_init(struct multiboot_info *info) {
2727
uint32_t start;
2828
bool retval = multiboot_RAM(info, &start, &PHYSICAL_MEMORY_SIZE);
2929
KLOG("RAM Stats: Available: %d, Start: %d, End: %d", retval, start, PHYSICAL_MEMORY_SIZE);
30-
KPANIC("STOP EARLY!");
3130
}
3231

3332
static void kernel_tick(struct registers *regs) {

src/tmp/MoltarOS.iso

0 Bytes
Binary file not shown.

src/tmp/bochsout.txt

Lines changed: 67 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
00000000000i[ ] SB16 support: yes
3434
00000000000i[ ] USB support: yes
3535
00000000000i[ ] VGA extension support: vbe cirrus voodoo
36-
00000000000i[MEM0 ] allocated memory at 10126020. after alignment, vector=10127000
36+
00000000000i[MEM0 ] allocated memory at 058C5020. after alignment, vector=058C6000
3737
00000000000i[MEM0 ] 256.00MB
3838
00000000000i[MEM0 ] mem block size = 0x00100000, blocks=256
3939
00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('C:\Program Files (x86)\Bochs-2.6.8/BIOS-bochs-latest')
@@ -45,7 +45,7 @@
4545
00000000000i[DEV ] PIIX3 PCI-to-ISA bridge present at device 1, function 0
4646
00000000000i[PLUGIN] init_dev of 'cmos' plugin device by virtual method
4747
00000000000i[CMOS ] Using local time for initial clock
48-
00000000000i[CMOS ] Setting initial clock to: Sun Dec 25 21:05:42 2016 (time0=1482699942)
48+
00000000000i[CMOS ] Setting initial clock to: Sun Dec 25 22:13:09 2016 (time0=1482703989)
4949
00000000000i[PLUGIN] init_dev of 'dma' plugin device by virtual method
5050
00000000000i[DMA ] channel 4 used by cascade
5151
00000000000i[PLUGIN] init_dev of 'pic' plugin device by virtual method
@@ -151,69 +151,68 @@
151151
00001251759i[BIOS ] ram_size=0x10000000
152152
00001252232i[BIOS ] ram_end=256MB
153153
00001906142i[WINGUI] dimension update x=720 y=400 fontheight=16 fontwidth=9 bpp=8
154-
00218747527i[BIOS ] Found 1 cpu(s)
155-
00218761591i[BIOS ] bios_table_addr: 0x000fa498 end=0x000fcc00
156-
00219085189i[PCI ] i440FX PMC write to PAM register 59 (TLB Flush)
157-
00219417509i[P2ISA ] PCI IRQ routing: PIRQA# set to 0x0b
158-
00219417535i[P2ISA ] PCI IRQ routing: PIRQB# set to 0x09
159-
00219417535i[P2ISA ] PCI IRQ routing: PIRQC# set to 0x0b
160-
00219417535i[P2ISA ] PCI IRQ routing: PIRQD# set to 0x09
161-
00219417535i[P2ISA ] write: ELCR2 = 0x0a
162-
00219418222i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
163-
00219425740i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
164-
00219428019i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
165-
00219430137i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
166-
00219430684i[PIDE ] new BM-DMA address: 0xc000
167-
00219431223i[BIOS ] region 4: 0x0000c000
168-
00219432989i[BIOS ] PCI: bus=0 devfn=0x0a: vendor_id=0x8086 device_id=0x7020 class=0x0c03
169-
00219433347i[UHCI ] new base address: 0xc020
170-
00219434050i[BIOS ] region 4: 0x0000c020
171-
00219434250i[UHCI ] new irq line = 9
172-
00219435825i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
173-
00219436377i[ACPI ] new irq line = 11
174-
00219436411i[ACPI ] new irq line = 9
175-
00219436430i[ACPI ] new PM base address: 0xb000
176-
00219436430i[ACPI ] new SM base address: 0xb100
177-
00219436462i[PCI ] setting SMRAM control register to 0x4a
178-
00219600580i[CPU0 ] Enter to System Management Mode
179-
00219600580i[CPU0 ] enter_system_management_mode: temporary disable VMX while in SMM mode
180-
00219600584i[CPU0 ] RSM: Resuming from System Management Mode
181-
00219764606i[PCI ] setting SMRAM control register to 0x0a
182-
00219779212i[BIOS ] MP table addr=0x000fa570 MPC table addr=0x000fa4a0 size=0xc8
183-
00219781194i[BIOS ] SMBIOS table addr=0x000fa580
184-
00219783165i[BIOS ] ACPI tables: RSDP addr=0x000fa6a0 ACPI DATA addr=0x0fff0000 size=0xf72
185-
00219786567i[BIOS ] Firmware waking vector 0xfff00cc
186-
00219788509i[PCI ] i440FX PMC write to PAM register 59 (TLB Flush)
187-
00219789090i[BIOS ] bios_table_cur_addr: 0x000fa6c4
188-
00219916847i[VBIOS ] VGABios $Id: vgabios.c,v 1.76 2013/02/10 08:07:03 vruppert Exp $
189-
00219916932i[BXVGA ] VBE known Display Interface b0c0
190-
00219916951i[BXVGA ] VBE known Display Interface b0c5
191-
00219919875i[VBIOS ] VBE Bios $Id: vbe.c,v 1.65 2014/07/08 18:02:25 vruppert Exp $
192-
00224131381i[BIOS ] IDE time out
193-
15274137918i[BIOS ] Booting from 07c0:0000
194-
15275321800i[BIOS ] int13_harddisk: function 41, unmapped device for ELDL=80
195-
15275325480i[BIOS ] int13_harddisk: function 08, unmapped device for ELDL=80
196-
15275329151i[BIOS ] *** int 15h function AX=00c0, BX=0000 not yet supported!
197-
15508529538i[CPU0 ] WARNING: HLT instruction with IF=0!
198-
65732000000p[WINGUI] >>PANIC<< POWER button turned off.
199-
65732000000i[CPU0 ] CPU is in protected mode (halted)
200-
65732000000i[CPU0 ] CS.mode = 32 bit
201-
65732000000i[CPU0 ] SS.mode = 32 bit
202-
65732000000i[CPU0 ] EFER = 0x00000000
203-
65732000000i[CPU0 ] | EAX=0000001f EBX=0002ffa0 ECX=00000300 EDX=001032cd
204-
65732000000i[CPU0 ] | ESP=00108c14 EBP=00108c40 ESI=00103309 EDI=0fff0000
205-
65732000000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df if tf sf zf af PF cf
206-
65732000000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
207-
65732000000i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 ffffffff 1 1
208-
65732000000i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
209-
65732000000i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
210-
65732000000i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 ffffffff 1 1
211-
65732000000i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
212-
65732000000i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
213-
65732000000i[CPU0 ] | EIP=001000b2 (001000b2)
214-
65732000000i[CPU0 ] | CR0=0x60000011 CR2=0x00000000
215-
65732000000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
216-
65732000000i[CPU0 ] 0x00000000001000b2>> jmp .-6 (0x001000b1) : E9FAFFFFFF
217-
65732000000i[CMOS ] Last time is 1482700007 (Sun Dec 25 21:06:47 2016)
218-
65732000000i[ ] restoring default signal behavior
219-
65732000000i[SIM ] quit_sim called with exit code 1
154+
00208893537i[BIOS ] Found 1 cpu(s)
155+
00208907601i[BIOS ] bios_table_addr: 0x000fa498 end=0x000fcc00
156+
00209231199i[PCI ] i440FX PMC write to PAM register 59 (TLB Flush)
157+
00209563519i[P2ISA ] PCI IRQ routing: PIRQA# set to 0x0b
158+
00209563545i[P2ISA ] PCI IRQ routing: PIRQB# set to 0x09
159+
00209563545i[P2ISA ] PCI IRQ routing: PIRQC# set to 0x0b
160+
00209563545i[P2ISA ] PCI IRQ routing: PIRQD# set to 0x09
161+
00209563545i[P2ISA ] write: ELCR2 = 0x0a
162+
00209564232i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
163+
00209571750i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
164+
00209574029i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
165+
00209576147i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
166+
00209576694i[PIDE ] new BM-DMA address: 0xc000
167+
00209577233i[BIOS ] region 4: 0x0000c000
168+
00209578999i[BIOS ] PCI: bus=0 devfn=0x0a: vendor_id=0x8086 device_id=0x7020 class=0x0c03
169+
00209579357i[UHCI ] new base address: 0xc020
170+
00209580060i[BIOS ] region 4: 0x0000c020
171+
00209580260i[UHCI ] new irq line = 9
172+
00209581835i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
173+
00209582387i[ACPI ] new irq line = 11
174+
00209582421i[ACPI ] new irq line = 9
175+
00209582440i[ACPI ] new PM base address: 0xb000
176+
00209582440i[ACPI ] new SM base address: 0xb100
177+
00209582472i[PCI ] setting SMRAM control register to 0x4a
178+
00209746590i[CPU0 ] Enter to System Management Mode
179+
00209746590i[CPU0 ] enter_system_management_mode: temporary disable VMX while in SMM mode
180+
00209746594i[CPU0 ] RSM: Resuming from System Management Mode
181+
00209910616i[PCI ] setting SMRAM control register to 0x0a
182+
00209925222i[BIOS ] MP table addr=0x000fa570 MPC table addr=0x000fa4a0 size=0xc8
183+
00209927204i[BIOS ] SMBIOS table addr=0x000fa580
184+
00209929175i[BIOS ] ACPI tables: RSDP addr=0x000fa6a0 ACPI DATA addr=0x0fff0000 size=0xf72
185+
00209932577i[BIOS ] Firmware waking vector 0xfff00cc
186+
00209934519i[PCI ] i440FX PMC write to PAM register 59 (TLB Flush)
187+
00209935100i[BIOS ] bios_table_cur_addr: 0x000fa6c4
188+
00210062857i[VBIOS ] VGABios $Id: vgabios.c,v 1.76 2013/02/10 08:07:03 vruppert Exp $
189+
00210062942i[BXVGA ] VBE known Display Interface b0c0
190+
00210062961i[BXVGA ] VBE known Display Interface b0c5
191+
00210065885i[VBIOS ] VBE Bios $Id: vbe.c,v 1.65 2014/07/08 18:02:25 vruppert Exp $
192+
00214277391i[BIOS ] IDE time out
193+
15093113853i[BIOS ] Booting from 07c0:0000
194+
15094297735i[BIOS ] int13_harddisk: function 41, unmapped device for ELDL=80
195+
15094301415i[BIOS ] int13_harddisk: function 08, unmapped device for ELDL=80
196+
15094305086i[BIOS ] *** int 15h function AX=00c0, BX=0000 not yet supported!
197+
2218620000000p[WINGUI] >>PANIC<< POWER button turned off.
198+
2218620000000i[CPU0 ] CPU is in protected mode (halted)
199+
2218620000000i[CPU0 ] CS.mode = 32 bit
200+
2218620000000i[CPU0 ] SS.mode = 32 bit
201+
2218620000000i[CPU0 ] EFER = 0x00000000
202+
2218620000000i[CPU0 ] | EAX=00101410 EBX=0002ffa0 ECX=00101421 EDX=00000021
203+
2218620000000i[CPU0 ] | ESP=00108c38 EBP=00108c38 ESI=00056bf9 EDI=00056bee
204+
2218620000000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df IF tf sf zf AF pf cf
205+
2218620000000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
206+
2218620000000i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 ffffffff 1 1
207+
2218620000000i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
208+
2218620000000i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
209+
2218620000000i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 ffffffff 1 1
210+
2218620000000i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
211+
2218620000000i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
212+
2218620000000i[CPU0 ] | EIP=001001e5 (001001e5)
213+
2218620000000i[CPU0 ] | CR0=0x60000011 CR2=0x00000000
214+
2218620000000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
215+
2218620000000i[CPU0 ] 0x00000000001001e5>> jmp .-6 (0x001001e4) : E9FAFFFFFF
216+
2218620000000i[CMOS ] Last time is 1482706207 (Sun Dec 25 22:50:07 2016)
217+
2218620000000i[ ] restoring default signal behavior
218+
2218620000000i[SIM ] quit_sim called with exit code 1

0 commit comments

Comments
 (0)