Xyris  0.5
Entry.cpp File Reference
#include "Logger.hpp"
#include "Panic.hpp"
#include <Library/stdio.hpp>
#include <Library/time.hpp>
#include <Scheduler/tasks.hpp>
#include <Bootloader/Handoff.hpp>
#include <Arch/Arch.hpp>
#include <Memory/paging.hpp>
#include <Devices/Clock/rtc.hpp>
#include <Devices/Graphics/console.hpp>
#include <Devices/Graphics/graphics.hpp>
#include <Devices/PCSpeaker/spkr.hpp>
#include <Devices/Serial/rs232.hpp>
#include <Applications/primes.hpp>
#include <Applications/spinner.hpp>
#include <Support/defines.hpp>
#include <stdint.h>
+ Include dependency graph for Entry.cpp:

Go to the source code of this file.

Functions

void kernelEntry (void *info, uint32_t magic)
 

Detailed Description

The entry point into the Xyris kernel.

Author
Keeton Feavel (keeto.nosp@m.nfea.nosp@m.vel@c.nosp@m.edar.nosp@m.ville.nosp@m..edu)
Version
0.3
Date
2019-11-14

Definition in file Entry.cpp.

Function Documentation

◆ kernelEntry()

void kernelEntry ( void *  info,
uint32_t  magic 
)

This is the Xyris kernel entry point. This function is called directly from the assembly written in boot.S located in Arch/i686/boot.S. The pragma allows this function to be declared without needing a former declaration.

Kernel entry point. Performs all kernel initialization and starts the init process(es). Should be called from bootloader entry points.


| |/ /___ _ _ _ _ ___| | | __|_ _| |_ _ _ _ _ | ' </ -_) '_| ' \/ -_) | | _|| ' \ _| '_| || | |_|____|_| |_||____|_| |___|_||___|_| _, | |__/

Definition at line 82 of file Entry.cpp.

83 {
86 
87  Boot::Handoff handoff(info, magic);
88  Memory::init(handoff.MemoryMap());
89  Graphics::init(handoff.FramebufferInfo());
90  tasks_init();
91 
92  printSplash();
94  Console::printf("UTC: %i/%i/%i %i:%i\n",
95  time.getMonth(),
96  time.getDay(),
97  time.getYear(),
98  time.getHour(),
99  time.getMinutes());
100  Logger::Info(__func__, "%s\n%s\n", Arch::CPU::vendor(), Arch::CPU::model());
101 
102  struct task compute, status, spinner;
103  tasks_new(Apps::find_primes, &compute, TASK_READY, "prime_compute");
104  tasks_new(Apps::show_primes, &status, TASK_READY, "prime_display");
105  tasks_new(Apps::spinner, &spinner, TASK_READY, "spinner");
106  // Now that we're done make a joyful noise
107  bootTone();
108 
109  // Keep the kernel task alive.
111  panic("Kernel terminated unexpectedly!");
112 }
Boot::Handoff
Definition: Handoff.hpp:88
tasks_init
void tasks_init()
Initializes the kernel task manager.
Definition: tasks.cpp:151
Arch::CPU::init
void init()
Definition: Arch.i686.cpp:110
Arch::CPU::criticalRegion
void criticalRegion(Function critWork)
Definition: Arch.hpp:82
task
Definition: tasks.hpp:32
TASK_READY
@ TASK_READY
Definition: tasks.hpp:22
Arch::CPU::vendor
const char * vendor()
Definition: Arch.i686.cpp:127
Memory::init
void init(MemoryMap *map)
Sets up the environment, page directories etc and enables paging.
Definition: paging.cpp:57
Apps::show_primes
void show_primes(void)
Starts a task to display number of primes found by find_primes.
Definition: primes.cpp:37
Time::TimeDescriptor::getHour
int getHour()
Definition: time.hpp:28
tasks_new
struct task * tasks_new(void(*entry)(void), struct task *storage, task_state state, const char *name)
Creates a new kernel task with a provided entry point, register storage struct, and task state struct...
Definition: tasks.cpp:289
Time::TimeDescriptor
Definition: time.hpp:19
Apps::find_primes
void find_primes(void)
Starts a task to find prime numbers.
Definition: primes.cpp:27
Logger::Info
static void Info(const char *tag, const char *fmt,...)
Definition: Logger.cpp:81
Apps::spinner
void spinner(void)
Starts a spinner in an infinite loop.
Definition: spinner.cpp:16
Time::TimeDescriptor::getMinutes
int getMinutes()
Definition: time.hpp:27
TASK_PAUSED
@ TASK_PAUSED
Definition: tasks.hpp:26
Time::TimeDescriptor::getDay
int getDay()
Definition: time.hpp:29
Time::TimeDescriptor::getYear
int getYear()
Definition: time.hpp:31
Console::printf
int printf(const char *fmt,...)
Definition: console.cpp:273
Arch::CPU::model
const char * model()
Definition: Arch.i686.cpp:134
Time::TimeDescriptor::getMonth
int getMonth()
Definition: time.hpp:30
panic
void panic(const char *msg)
Halt the system and print the provided message on the panic screen.
Definition: Panic.cpp:82
tasks_block_current
void tasks_block_current(task_state reason)
Blocks the current task.
Definition: tasks.cpp:422
Graphics::init
void init(Framebuffer *fb)
Initializes the framebuffer (if available)
Definition: graphics.cpp:32