mirror of
https://github.com/usatiuk/ficus.git
synced 2025-10-29 00:27:52 +01:00
asserts.hpp
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <cstdint>
|
||||
#include <new>
|
||||
|
||||
#include "asserts.hpp"
|
||||
#include "gdt.hpp"
|
||||
#include "globals.hpp"
|
||||
#include "idt.hpp"
|
||||
@@ -12,7 +13,6 @@
|
||||
#include "memman.hpp"
|
||||
#include "misc.hpp"
|
||||
#include "paging.hpp"
|
||||
#include "serial.hpp"
|
||||
|
||||
AddressSpace *BOOT_AddressSpace;
|
||||
alignas(AddressSpace) char BOOT_AddressSpace_storage[sizeof(AddressSpace)];
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "idt.hpp"
|
||||
|
||||
#include "asserts.hpp"
|
||||
#include "gdt.hpp"
|
||||
#include "io.hpp"
|
||||
#include "misc.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "task.hpp"
|
||||
#include "timer.hpp"
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "SkipList.hpp"
|
||||
#include "String.hpp"
|
||||
#include "TestTemplates.hpp"
|
||||
#include "asserts.hpp"
|
||||
#include "globals.hpp"
|
||||
#include "kmem.hpp"
|
||||
#include "limine_fb.hpp"
|
||||
@@ -14,7 +15,6 @@
|
||||
#include "misc.hpp"
|
||||
#include "mutex.hpp"
|
||||
#include "rand.h"
|
||||
#include "serial.hpp"
|
||||
#include "task.hpp"
|
||||
#include "timer.hpp"
|
||||
#include "tty.hpp"
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
#include "LockGuard.hpp"
|
||||
#include "Spinlock.hpp"
|
||||
#include "asserts.hpp"
|
||||
#include "globals.hpp"
|
||||
#include "memman.hpp"
|
||||
#include "paging.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "task.hpp"
|
||||
|
||||
#include "string.h"
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include "memman.hpp"
|
||||
#include "LockGuard.hpp"
|
||||
#include "Spinlock.hpp"
|
||||
#include "asserts.hpp"
|
||||
#include "misc.hpp"
|
||||
#include "paging.hpp"
|
||||
#include "serial.hpp"
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
//
|
||||
|
||||
#include "paging.hpp"
|
||||
#include "asserts.hpp"
|
||||
#include "limine.h"
|
||||
#include "memman.hpp"
|
||||
#include "misc.hpp"
|
||||
#include "serial.hpp"
|
||||
|
||||
// Returns a free page frame in HHDM
|
||||
static uint64_t *get_free_frame() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Created by Stepan Usatiuk on 12.08.2023.
|
||||
//
|
||||
|
||||
#include "serial.hpp"
|
||||
#include "asserts.hpp"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -15,15 +15,5 @@ char read_serial();
|
||||
int is_transmit_empty();
|
||||
void write_serial(char a);
|
||||
void writestr(const char *a);
|
||||
extern "C" {
|
||||
static inline void _assert2(int val, const char *msg) {
|
||||
if (!val) {
|
||||
writestr(msg);
|
||||
_hcf();
|
||||
}
|
||||
}
|
||||
}
|
||||
#define assert2(x, y) _assert2(x, y)
|
||||
#define assert(x) _assert2(x, "Assertion failed")
|
||||
|
||||
#endif//OS1_SERIAL_H
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
#include "LockGuard.hpp"
|
||||
#include "SkipList.hpp"
|
||||
#include "Spinlock.hpp"
|
||||
#include "asserts.hpp"
|
||||
#include "gdt.hpp"
|
||||
#include "kmem.hpp"
|
||||
#include "misc.hpp"
|
||||
#include "mutex.hpp"
|
||||
#include "paging.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "string.h"
|
||||
#include "timer.hpp"
|
||||
#include "tty.hpp"
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
#include "LockGuard.hpp"
|
||||
#include "Vector.hpp"
|
||||
#include "asserts.hpp"
|
||||
#include "kmem.hpp"
|
||||
#include "mutex.hpp"
|
||||
#include "serial.hpp"
|
||||
|
||||
static Mutex ttysMutex;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
target_include_directories(kernel.elf PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_sources(kernel.elf PRIVATE mutex.cpp cppsupport.cpp Spinlock.cpp LockGuard.cpp rand.cpp)
|
||||
target_sources(kernel.elf PRIVATE mutex.cpp cppsupport.cpp Spinlock.cpp LockGuard.cpp rand.cpp VMA.cpp asserts.cpp)
|
||||
|
||||
add_subdirectory(templates)
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef OS2_SPINLOCK_H
|
||||
#define OS2_SPINLOCK_H
|
||||
|
||||
#include "serial.hpp"
|
||||
#include "asserts.hpp"
|
||||
#include "task.hpp"
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
|
||||
5
src/kernel/asserts.cpp
Normal file
5
src/kernel/asserts.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
//
|
||||
// Created by Stepan Usatiuk on 26.10.2023.
|
||||
//
|
||||
|
||||
#include "asserts.hpp"
|
||||
24
src/kernel/asserts.hpp
Normal file
24
src/kernel/asserts.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Created by Stepan Usatiuk on 26.10.2023.
|
||||
//
|
||||
|
||||
#ifndef OS2_ASSERTS_HPP
|
||||
#define OS2_ASSERTS_HPP
|
||||
|
||||
#include "misc.hpp"
|
||||
#include "serial.hpp"
|
||||
|
||||
extern "C" {
|
||||
static inline void _assert2(int val, const char *msg) {
|
||||
if (!val) {
|
||||
writestr(msg);
|
||||
_hcf();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define assert2(x, y) _assert2(x, y)
|
||||
#define assert(x) _assert2(x, "Assertion failed")
|
||||
|
||||
|
||||
#endif//OS2_ASSERTS_HPP
|
||||
@@ -5,9 +5,9 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "asserts.hpp"
|
||||
#include "kmem.hpp"
|
||||
#include "misc.hpp"
|
||||
#include "serial.hpp"
|
||||
|
||||
#if UINT32_MAX == UINTPTR_MAX
|
||||
#define STACK_CHK_GUARD 0xb079a218
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "mutex.hpp"
|
||||
#include "LockGuard.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "asserts.hpp"
|
||||
#include "task.hpp"
|
||||
#include "timer.hpp"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
#include "serial.hpp"
|
||||
#include "asserts.hpp"
|
||||
|
||||
template<typename T>
|
||||
class List {
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
}
|
||||
|
||||
template<class... Args>
|
||||
Node* create_node(Args &&...args) {
|
||||
Node *create_node(Args &&...args) {
|
||||
return new Node{std::forward<Args>(args)..., nullptr};
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "asserts.hpp"
|
||||
#include "rand.h"
|
||||
#include "serial.hpp"
|
||||
|
||||
template<typename K, typename V>
|
||||
class SkipList {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
|
||||
#include "asserts.hpp"
|
||||
#include "kmem.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "string.h"
|
||||
|
||||
class String {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "SkipListSet.hpp"
|
||||
#include "String.hpp"
|
||||
#include "Vector.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "asserts.hpp"
|
||||
|
||||
#include "tty.hpp"
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "asserts.hpp"
|
||||
#include "kmem.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "string.h"
|
||||
|
||||
class VectorTester;
|
||||
|
||||
Reference in New Issue
Block a user