wake-0 / fhvOS

This repository contains an os for the arm cortex a8 in combination with beaglebone.
GNU General Public License v2.0
7 stars 1 forks source link

[Kernel] Implement kernel functions #58

Closed ghost closed 9 years ago

ghost commented 9 years ago

The kernel should provide functions like:

1.) KernelGetUptime() 3.) KernelExecute(char* command) 4.) KernelInfo(...) should print info message, providing the same interface as printf 5.) KernelDebug(...) should print debug message 6.) KernelError(...) should print error message 7.) KernelTick(int) should count up the ticks by parameter (uptime)

trylimits commented 9 years ago

@mpe5651 @Blackjack92 I'm not sure about function 2.) Should the kernel really be responsible for managing the current working directory. Shouldn't we introduce some kind of FileManager which is responsible for this (and more ofc). Pls provide your oppinions.

trylimits commented 9 years ago

I have implemented KernelTick(int) which counts up the uptime ticks and returns the new value.

trylimits commented 9 years ago

Above commit implements KernelInfo, KernelError and KernelDebug. Those functions should be used to print to the console within the kernel functions. The interface is equivalent to the printf function, therefore something like below is possible:

KernelInfo("Variable i=%i\n", i);

The implemented functions also use a mutex to guarantee correct output.

ghost commented 9 years ago

am I right in the assumption that kernelExecute is for system calls? in that case, implementing this function is done simply by calling a swi with a a appropriate sysCall number.

trylimits commented 9 years ago

KernelExecute is meant to be a function which starts an external program/command, e.g. KernelExecute("uptime"); starts an external or internal process which prints the uptime. Other examples are KernelExecute("ls"),KernelExecute("more ") etc. Actually KernelExecute(..) just searches for an executable in a specified folder and runs the corresponding program. At the moment we should compile some core processes into the kernel, such as uptime.

trylimits commented 9 years ago

I found an issue with the implemented functions for printing out debug/error/info stuff. These functions use a mutex to ensure ordered output, however, in some cases this weirdly freezes the kernel as most of these functions are called within interrupt handlers which should not be locked :)

trylimits commented 9 years ago

Above commit solves the mutex issue.

wake-0 commented 9 years ago

I would appreciate the FileManager idea. Some instance should handle the current directory with the contained files.

trylimits commented 9 years ago

The print functions of the Kernel should be wrapped into some conditional statements to allow disabling debug and error output in release mode.

trylimits commented 9 years ago

Above commit introduces #defines in kernel.c which allow to control the output level of kernel messages.

trylimits commented 9 years ago

We should move the KernelExecute(..) function completely to the FileManager implementation.

Edit: Nope :)

trylimits commented 9 years ago

This ticket is solved.