Skip to content

Commit

Permalink
Minor updates and README
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis Jenkins committed Dec 25, 2016
1 parent e512da6 commit 4f26c0c
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 85 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The below depicts an early "schedule" or rather a path I will be taking in terms
- [ ] ELF Binary Support
- [ ] Graphical User Interfaces

#Progress Update
#Progress Update & Changelog

## Version .001a

Expand All @@ -34,4 +34,17 @@ Implemented the GDT, IDT (and IRQs and ISRs), reprogrammed the PIC's (Master and
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
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.

![Screenshot](/kbd_input.PNG)
![Screenshot](/kbd_input.PNG)

## Version .001c

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
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.

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
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
a significant amount of work and should be pushed to master.

Lastly, I also added a nice logger macro, `KLOG`, and panic macro, `KPANIC`.

![Screenshot](/ram_and_kbd.PNG)
Binary file added ram_and_kbd.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ if [ $? -ne 0 ]; then
fi

# Finally, run the virtual machine.
bochs -f bochs.bxrc;
bochs -f bochsrc.bxrc;
4 changes: 2 additions & 2 deletions src/kernel/include/kernel/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stdio.h>

#ifndef NDEBUG
#define KLOG(format, ...) printf(format, ##__VA_ARGS__)
#define KLOG(format, ...) printf(format "\n", ##__VA_ARGS__)
#else
#define KLOG(format, ...)
#endif
Expand All @@ -13,7 +13,7 @@
// Kernel Panic which will just print error message and spin
#define KPANIC(format, ...) \
do { \
printf("[%s:%s:%s] PANIC: \"" format "\"", __FILE__, __FUNCTION__, STRINGIFY(__LINE__), ##__VA_ARGS__); \
printf("[%s:%s:%s] PANIC: \"" format "\"\n", __FILE__, __FUNCTION__, STRINGIFY(__LINE__), ##__VA_ARGS__); \
asm volatile ("cli"); \
while (true) \
asm volatile ("hlt"); \
Expand Down
16 changes: 5 additions & 11 deletions src/kernel/include/kernel/multiboot.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,26 @@ struct multiboot_mmap {


static bool multiboot_RAM(struct multiboot_info *mbinfo, uint32_t *start, uint32_t *end) {
bool found = false;
printf("Flags: %d\n", mbinfo->flags);
// Check if there is a memory mapping available
if (mbinfo->flags & (1 << 6)) {
// We are going to be skipping the lower ram...
bool found_lower = false;
KLOG("MMAP Entries: %d\n", mbinfo->mmap_length / 16);
KLOG("MMAP Entries: %d", mbinfo->mmap_length / 24);
struct multiboot_mmap *mmap = mbinfo->mmap_addr;
while(mmap < mbinfo->mmap_addr + mbinfo->mmap_length) {
KLOG("MMAP Type: %x, MMAP Start: %x, MMAP Length: %x, MMAP Size: %x\n", mmap->type, mmap->start_high, mmap->length_high, mmap->size);
KLOG("MMAP Entry: {Type: %s, Start: %x, Length: %x}", mmap->type == MULTIBOOT_MMAP_RAM ? "RAM" : "RESERVED", mmap->start_low, mmap->length_low);
// Jackpot... (The OS is 32-bit, so there is no upper currently.)
if (mmap->type == MULTIBOOT_MMAP_RAM) {
KLOG("MMAP RAM entry found!\n");
*start = mmap->start_low;
*end = *start + mmap->length_low;
if (found_lower) {
return true;
} else {
found_lower = true;
}
found = true;
}

mmap = (struct multiboot_mmap *) ((uint32_t) mmap + mmap->size + sizeof(mmap->size));
}
}

return false;
return found;
}

#endif /* MOLTAROS_MULTIBOOT_H */
1 change: 0 additions & 1 deletion src/kernel/kernel/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ void kernel_init(struct multiboot_info *info) {
uint32_t start;
bool retval = multiboot_RAM(info, &start, &PHYSICAL_MEMORY_SIZE);
KLOG("RAM Stats: Available: %d, Start: %d, End: %d", retval, start, PHYSICAL_MEMORY_SIZE);
KPANIC("STOP EARLY!");
}

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

0 comments on commit 4f26c0c

Please sign in to comment.