Massive backlog of changes
This commit is contained in:
9
include/platform/context.h
Normal file
9
include/platform/context.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
void *initialize_context(void *task_entry);
|
||||
|
||||
void destroy_context(void *ctx);
|
||||
|
||||
void save_context(struct process_context_t *context, void *ptr);
|
||||
|
||||
void load_context(struct process_context_t *context);
|
||||
20
include/platform/interrupts.h
Normal file
20
include/platform/interrupts.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int initialize_interrupts();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
void irq_enable();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
void irq_disable();
|
||||
96
include/platform/paging.h
Normal file
96
include/platform/paging.h
Normal file
@@ -0,0 +1,96 @@
|
||||
#pragma once
|
||||
|
||||
#include "types/physaddr.h"
|
||||
#include <stddef.h>
|
||||
|
||||
enum page_flag_t
|
||||
{
|
||||
PAGE_RW = 1,
|
||||
PAGE_EXECUTABLE = 1 << 1,
|
||||
PAGE_USERMODE = 1 << 2,
|
||||
PAGE_PRESENT = 1 << 16,
|
||||
PAGE_ANON = 1 << 17,
|
||||
PAGE_COPY_ON_WRITE = 1 << 18
|
||||
};
|
||||
|
||||
const size_t page_table_levels;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param table
|
||||
* @return int
|
||||
*/
|
||||
int paging_init_top_table(physaddr_t table);
|
||||
|
||||
/**
|
||||
* @brief Returns the physical address of the top-level page table currently in
|
||||
* use.
|
||||
*
|
||||
* @return physaddr_t
|
||||
*/
|
||||
physaddr_t paging_current_address_space();
|
||||
|
||||
/**
|
||||
* @brief Load an existing top-level page table
|
||||
*
|
||||
* @param table
|
||||
*/
|
||||
void paging_load_address_space(physaddr_t table);
|
||||
|
||||
/**
|
||||
* @brief Get the pte type object
|
||||
*
|
||||
* @param page
|
||||
* @param level
|
||||
* @return int
|
||||
*/
|
||||
int get_pte_type(void *page, int level);
|
||||
|
||||
/**
|
||||
* @brief Set the pte type object
|
||||
*
|
||||
* @param page
|
||||
* @param level
|
||||
* @param flags
|
||||
* @return int
|
||||
*/
|
||||
int set_pte_type(void *page, int level, int flags);
|
||||
|
||||
/**
|
||||
* @brief Get the pte address object
|
||||
*
|
||||
* @param page
|
||||
* @param level
|
||||
* @return physaddr_t
|
||||
*/
|
||||
physaddr_t get_pte_address(void *page, int level);
|
||||
|
||||
/**
|
||||
* @brief Set the pte address object
|
||||
*
|
||||
* @param page
|
||||
* @param level
|
||||
* @param addr
|
||||
* @return int
|
||||
*/
|
||||
int set_pte_address(void *page, int level, physaddr_t addr);
|
||||
|
||||
/**
|
||||
* @brief Set the pte object
|
||||
*
|
||||
* @param page
|
||||
* @param level
|
||||
* @param flags
|
||||
* @param addr
|
||||
* @return int
|
||||
*/
|
||||
int set_pte(void *page, int level, int flags, physaddr_t addr);
|
||||
|
||||
/**
|
||||
* @brief Resets all entries in the same table as the specified entry
|
||||
*
|
||||
* @param page
|
||||
* @param level
|
||||
*/
|
||||
void wipe_page_table(void *page, int level);
|
||||
24
include/platform/putc.h
Normal file
24
include/platform/putc.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @brief Prepare to output characters to the screen.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int initialize_screen();
|
||||
|
||||
/**
|
||||
* @brief Write a single character to the screen.
|
||||
*
|
||||
* @param c
|
||||
* @return int
|
||||
*/
|
||||
int putchar(int c);
|
||||
|
||||
/**
|
||||
* @brief Write a string to the screen.
|
||||
*
|
||||
* @param str
|
||||
* @return int
|
||||
*/
|
||||
int puts(const char *str);
|
||||
Reference in New Issue
Block a user