Code Monkey home page Code Monkey logo

baremetal-os-legacy's People

Contributors

alexforster avatar benaryorg avatar bendyer avatar benjaminsavoy avatar bluehaunter avatar faissaloo avatar gitter-badger avatar ianseyler avatar lidenburg avatar ngg avatar ohnx avatar roxxik avatar techtonik avatar vilhelmgray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

baremetal-os-legacy's Issues

enhancement in os_mem_

there should be a function (named os_mem_most_allocatable_pages or something like this) which gives the most number of free pages in succession

Reduce Kernel size

The kernel's compiled size is now larger than 16KiB. Take a look at slimming this down.

Ideas:
Move the CLI into its own program.
Remove the Ethernet ring buffer and use a callback instead.
Remove some of the os_string functions that are not really necessary.
Shorten the exception code in interrupt.asm.
Rework the FAT16 driver.
system_status in misc.asm could be optimized.

NewLib printf() output missing

printf("NewLib Test Application\n=======================\n");

Seems to only print "NewLib Test Application\n"

printf("You entered: '%s'", tempstring);

Seems to only print "You entered: '%s". Trailing ' is gone.

Need to investigate what is being passed to os_output_chars.

kernel64.asm not compiling

kernel64 is not compiling and it fails with

cli.asm:143: error: symbol `os_file_list' undefined

command used:

nasm kernel64.asm -o kernel.sys

Memory map

Use the PML4 to keep track of pages in use instead of a separate area of memory?

Compile fails

Hello Ian,

When I compile the code, it gives this error and fails:

syscalls/screen.asm:299: error: short jump is out of range

Implement UDMA or ADMA in the Disk driver

Currently all disk calls are done via PIO. For performance this should be replaced with proper DMA calls.

UDMA is supported on all hardware that BareMetal targets. However UDMA transfers are limited to 32-bit memory addresses

ADMA is supported in all SATA chipsets and transfers work with any 64-bit memory address.

UDMA links:
http://wiki.osdev.org/ATA/ATAPI_using_DMA
http://savrus.blogspot.com/2009/10/writing-dma-bootloader.html

ADMA links:
http://wiki.osdev.org/ADMA

ATA links:
http://wiki.osdev.org/Category:ATA

This needs to be completed before the disk block calls. PIO can read/write 128KiB per call and we want something closer to 2MiB.

HPET support

Add HPET support on IRQ 2 (to replace the legacy timer). Disabled by default but configurable via system calls.

Higher half

Move the kernel to the higher half of memory (0xFFFF800000000000).

Required adjustment of the PML4.

Smart keyboard interrupt

keyboard interrupt handler could be a bit smarter

  1. recognize Ctrl+C and trigger int3 for it (this way I can see where it is stuck from the stack dump)
  2. ctrl, shift, alt status should be accessible with a function
  3. capslock

CLI history

The CLI should store a history of last entered commands (Similar to DOSKEY back in the day). Up and down arrows would scroll through the history.

Support for newer Gigabit chips from Intel

Need to look into the latest chips that are coming out from Intel and check if they will be supported by the current i8254x driver. If not then a new driver will need to be written.

NIC detection performance

When running in VirtualBox, over 90% of CPU cycles used during boot are spent finding an appropriate NIC/driver pair, specifically in iterating over all PCI devices for each supported vendor/device ID.

If the init_net code iterated over attached PCI devices in the outer loop, then over supported vendors/device IDs in the inner loop, the process would be much faster.

Missing syscalls

Compared to the amount of syscalls in the source code, bmdev.asm is relatively empty. This means you can only use a limited subset of the syscalls in assembly. This is the same with libBareMetal.h. Is there any reason for this or should I go ahead and add them?

Stuck on "Initializing system..."

I loaded the latest (0.5.3) VMDK into VirtualBox on my Mac OS X machine and the setup seems to hang on "Initializing system".

I can provide more details as needed.

Typo in readme.md

BareMetal is used as a verb:

"At the moment there is no plan to BareMetal into a general-purpose operating system" [...]

Direction flag with input/output functions

Some functions will break if the direction flag is set.

Should this be left to the app programmer to verify? Or should the OS save/restore the state of the flag on all calls?

Network Callback

A defective network callback will freeze the system if the interrupt never returns. The callback should be called after the interrupt has been handled. The stack will need to be modified.

Symmetric I/O Mode

The latest version of Pure64 now enables and configures the IO-APIC. All interrupts are still being sent to the BSP still.

Newlib - Clean up gettimeofday()

Have the RTC interrupt increment a 64-bit value every second.
On the first call to gettimeofday() check this value.
If the value is less than 946684800 (2000/1/1 00:00:00) then we have an invalid date.
gettimeofday() can then call the RTC hardware and calculate the real epoch time.
gettimeofday() will then update the OS timer.

TCP/IP

Need to implement the following

  • ARP
  • Static IP config
  • ICMP
  • UDP
  • TCP
  • DHCP

Currently being worked on.

lock pseudo-instruction

Compile kernel

hamilok ~/projects/baremetal $ nasm kernel64.asm -o kernel64.sys 
syscalls/smp.asm:109: warning: instruction is not lockable
syscalls/smp.asm:167: warning: instruction is not lockable
syscalls/smp.asm:290: warning: instruction is not lockable

Patch

index d1be871..c569fd3 100644
--- a/os/syscalls/smp.asm
+++ b/os/syscalls/smp.asm
@@ -106,8 +106,7 @@ os_smp_enqueue:
 os_smp_enqueue_spin:
        bt word [os_QueueLock], 0       ; Check if the mutex is free
        jc os_smp_enqueue_spin          ; If not check it again
-       lock                            ; The mutex was free, lock the bus
-       bts word [os_QueueLock], 0      ; Try to grab the mutex
+       lock bts word [os_QueueLock], 0 ; The mutex was free, lock the bus. Try to grab the mutex
        jc os_smp_enqueue_spin          ; Jump if we were unsuccessful

        cmp word [os_QueueLen], 256     ; aka cpuqueuemax
@@ -122,7 +121,7 @@ os_smp_enqueue_spin:
        stosq                           ; Store the code address from RAX
        mov rax, rsi
        stosq                           ; Store the variable
-       
+
        add word [os_QueueLen], 1
        shr rcx, 4                      ; Quickly divide RCX by 16
        add cx, 1
@@ -164,8 +163,7 @@ os_smp_dequeue:
 os_smp_dequeue_spin:
        bt word [os_QueueLock], 0       ; Check if the mutex is free
        jc os_smp_dequeue_spin          ; If not check it again
-       lock                            ; The mutex was free, lock the bus
-       bts word [os_QueueLock], 0      ; Try to grab the mutex
+       lock bts word [os_QueueLock], 0 ; The mutex was free, lock the bus. Try to grab the mutex
        jc os_smp_dequeue_spin          ; Jump if we were unsuccessful

        cmp word [os_QueueLen], 0
@@ -287,8 +285,7 @@ skipit:
 os_smp_lock:
        bt word [rax], 0        ; Check if the mutex is free (Bit 0 cleared to 0)
        jc os_smp_lock          ; If not check it again
-       lock                    ; The mutex was free, lock the bus
-       bts word [rax], 0       ; Try to grab the mutex (Bit 0 set to 1)
+       lock bts word [rax], 0  ; The mutex was free, lock the bus. Try to grab the mutex (Bit 0 set to 1)
        jc os_smp_lock          ; Jump if we were unsuccessful
        ret                     ; Lock acquired. Return to the caller
 ; -----------------------------------------------------------------------------

Remove the CLI from the kernel

The Command Line Interface should be removed from the kernel binary. It should be treated as an application instead of a kernel component. This could be a good opportunity to re-write the CLI in C.

ACHI driver

The current ATA PIO driver is slow and obsolete. Going forward a driver should be written that supports SATA drives on an ACHI controller. The PIO driver could then be removed.

bss should be cleared with zeros when loading a program

C compilers assume that .bss section is filled with zeros, so cli.asm should clear it after loading the file

For example:
int x[256] = {0}; //this compiles to .bss
int y[256] = {1}; //this compiles to .data

so if i check x[0], this should be 0

PS: modifying linker script's last line to ".bss ALIGN(0x08) : { *(.bss) }" will make bss section start on an address divisible by 8

temporary solution:
gcc-option: -fno-zero-initialized-in-bss

Rework Ethernet functions

os_ethernet_tx should send a pre-built packet.

os_ethernet_rx should process the latest packet that was received on the wire.

Remove the ring buffer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.