diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-04-29 09:25:53 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-04-29 09:37:44 +0200 |
| commit | 4b71a936183070e43a6ca73c2975eae70742e124 (patch) | |
| tree | 2f3f3be1f816bfd392ae09a69c9ff92696b75967 /kapi/include | |
| parent | d6ef2153fb32ee7ba04acdf37e7a535a855229db (diff) | |
| download | teachos-4b71a936183070e43a6ca73c2975eae70742e124.tar.xz teachos-4b71a936183070e43a6ca73c2975eae70742e124.zip | |
chore: migrate 'kapi' to p1204 layout
Diffstat (limited to 'kapi/include')
24 files changed, 0 insertions, 1677 deletions
diff --git a/kapi/include/kapi/acpi.hpp b/kapi/include/kapi/acpi.hpp deleted file mode 100644 index 885fcde..0000000 --- a/kapi/include/kapi/acpi.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef TEACHOS_KAPI_ACPI_HPP -#define TEACHOS_KAPI_ACPI_HPP - -#include <acpi/acpi.hpp> - -#include <kstd/memory> -#include <kstd/units> - -#include <string_view> - -namespace kapi::acpi -{ - - //! @addtogroup kapi-acpi-kernel-defined - //! @{ - - //! Initialize the ACPI subsystem and discover the available tables. - //! - //! @return true iff. a valid system description tabled was found, false otherwise. - auto init(::acpi::rsdp const & sdp) -> bool; - - //! Get a pointer to an ACPI table by its signature. - //! - //! @param signature The signature of the table to get. - //! @return A pointer to the table if found, nullptr otherwise. - auto get_table(std::string_view signature) -> kstd::observer_ptr<::acpi::table_header const>; - - //! Get a type-cast pointer to an ACPI table by its signature. - //! - //! @tparam Signature The signature of the table to get - //! @return A pointer to the table if found, nullptr otherwise. - template<char const * Signature> - auto get_table() -> kstd::observer_ptr<::acpi::table_type_t<Signature> const> - { - return kstd::make_observer(static_cast<::acpi::table_type_t<Signature> const *>(get_table(Signature).get())); - } - -} // namespace kapi::acpi - -#endif diff --git a/kapi/include/kapi/boot.hpp b/kapi/include/kapi/boot.hpp deleted file mode 100644 index 55ca941..0000000 --- a/kapi/include/kapi/boot.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef TEACHOS_KAPI_BOOT_HPP -#define TEACHOS_KAPI_BOOT_HPP - -namespace kapi::boot -{ - //! @qualifier platform-defined - //! Information passed from the early pre-main stage to the kernel executable. - //! - //! The specific structure of this type is defined on a platform level. - struct information; - - //! @qualifier platform-defined - //! An object passed from the early pre-main stage to the kernel executable. - extern "C" information const bootstrap_information; -} // namespace kapi::boot - -#endif diff --git a/kapi/include/kapi/boot_module/boot_module.hpp b/kapi/include/kapi/boot_module/boot_module.hpp deleted file mode 100644 index 9b4b165..0000000 --- a/kapi/include/kapi/boot_module/boot_module.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef TEACHOS_KAPI_BOOT_MODULE_BOOT_MODULE_HPP -#define TEACHOS_KAPI_BOOT_MODULE_BOOT_MODULE_HPP - -#include <kapi/memory.hpp> - -#include <cstddef> -#include <string_view> - -namespace kapi::boot_modules -{ - // ! The boot module struct - // ! - // ! The boot module struct represents a module loaded by the bootloader, and contains information about it, such as - // ! its name, virtual start address, and size. - struct boot_module - { - std::string_view name{}; - memory::linear_address start_address{}; - std::size_t size{}; - }; -} // namespace kapi::boot_modules - -#endif
\ No newline at end of file diff --git a/kapi/include/kapi/boot_module/boot_module_registry.hpp b/kapi/include/kapi/boot_module/boot_module_registry.hpp deleted file mode 100644 index fc3590f..0000000 --- a/kapi/include/kapi/boot_module/boot_module_registry.hpp +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef TEACHOS_KAPI_BOOT_MODULE_BOOT_MODULE_REGISTRY_HPP -#define TEACHOS_KAPI_BOOT_MODULE_BOOT_MODULE_REGISTRY_HPP - -#include <kapi/boot_module/boot_module.hpp> - -#include <kstd/vector> - -#include <cstddef> - -namespace kapi::boot_modules -{ - - // ! The interface of the boot module registry - // ! - // ! The boot module registry is responsible for keeping track of the modules loaded by the bootloader, and - // ! providing access to them for the rest of the kernel. - struct boot_module_registry - { - using range_type = kstd::vector<boot_module>; - using value_type = range_type::value_type; - using const_reference = range_type::const_reference; - - using const_iterator = range_type::const_iterator; - using const_reverse_iterator = range_type::const_reverse_iterator; - using size_type = range_type::size_type; - - [[nodiscard]] auto begin() const noexcept -> const_iterator - { - return m_modules.begin(); - } - - [[nodiscard]] auto end() const noexcept -> const_iterator - { - return m_modules.end(); - } - - [[nodiscard]] auto cbegin() const noexcept -> const_iterator - { - return begin(); - } - - [[nodiscard]] auto cend() const noexcept -> const_iterator - { - return end(); - } - - [[nodiscard]] auto rbegin() const noexcept -> const_reverse_iterator - { - return m_modules.rbegin(); - } - - [[nodiscard]] auto rend() const noexcept -> const_reverse_iterator - { - return m_modules.rend(); - } - - [[nodiscard]] auto crbegin() const noexcept -> const_reverse_iterator - { - return rbegin(); - } - - [[nodiscard]] auto crend() const noexcept -> const_reverse_iterator - { - return rend(); - } - - [[nodiscard]] auto front() const noexcept -> const_reference - { - return m_modules.front(); - } - - [[nodiscard]] auto back() const noexcept -> const_reference - { - return m_modules.back(); - } - - [[nodiscard]] auto size() const noexcept -> std::size_t - { - return m_modules.size(); - } - - [[nodiscard]] auto empty() const noexcept -> bool - { - return m_modules.empty(); - } - - [[nodiscard]] auto at(std::size_t index) const -> const_reference - { - return m_modules.at(index); - } - - [[nodiscard]] auto operator[](std::size_t index) const noexcept -> const_reference - { - return m_modules[index]; - } - - auto add_boot_module(boot_module module) -> void - { - m_modules.push_back(module); - } - - private: - range_type m_modules{}; - }; -} // namespace kapi::boot_modules - -#endif
\ No newline at end of file diff --git a/kapi/include/kapi/boot_modules.hpp b/kapi/include/kapi/boot_modules.hpp deleted file mode 100644 index 026479d..0000000 --- a/kapi/include/kapi/boot_modules.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef TEACHOS_KAPI_BOOT_MODULES_HPP -#define TEACHOS_KAPI_BOOT_MODULES_HPP - -#include <kapi/boot_module/boot_module_registry.hpp> // IWYU pragma: export - -namespace kapi::boot_modules -{ - - //! @qualifier platform-defined - //! Initialize the boot module registry. - //! - //! @note This function must be implemented by the target platform. - //! - //! This function initializes the boot module registry, which is responsible for keeping track of the modules loaded - //! by the bootloader, and providing access to them for the rest of the kernel. - auto init() -> void; - - //! @qualifier kernel-defined - //! Set the boot module registry - //! - //! @param registry A new boot module registry. - auto set_boot_module_registry(boot_module_registry & registry) -> void; - - //! @qualifier kernel-defined - //! Get the boot module registry. - //! - //! @returns The boot module registry. - auto get_boot_module_registry() -> boot_module_registry &; - -} // namespace kapi::boot_modules -#endif
\ No newline at end of file diff --git a/kapi/include/kapi/cio.hpp b/kapi/include/kapi/cio.hpp deleted file mode 100644 index 9bbf7fa..0000000 --- a/kapi/include/kapi/cio.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef TEACHOS_KAPI_CIO_HPP -#define TEACHOS_KAPI_CIO_HPP - -#include <kapi/cio/output_device.hpp> // IWYU pragma: export - -#include <kstd/format> - -#include <optional> -#include <string_view> - -namespace kapi::cio -{ - - //! @addtogroup kapi-cio - //! @{ - //! @} - - //! @addtogroup kapi-cio-kernel-defined - //! @{ - - //! Set the currently active output device. - //! - //! @param device A new output device. - //! @return The previously active output device. - auto set_output_device(output_device & device) -> std::optional<output_device *>; - - //! Write a string to the given output stream. - //! - //! @param stream The output stream to write to. - //! @param text The text to write to the stream. - auto write(output_stream stream, std::string_view text) -> void; - - //! @} - - //! @addtogroup kapi-cio-platform-defined - //! @{ - - //! Initialize the character I/O subsystem. - //! - //! If a platform support character output, it shall ensure that when this function returns, basic character - //! output can be performed on the system. - auto init() -> void; - - //! @} - -} // namespace kapi::cio - -#endif diff --git a/kapi/include/kapi/cio/output_device.hpp b/kapi/include/kapi/cio/output_device.hpp deleted file mode 100644 index 9fe2557..0000000 --- a/kapi/include/kapi/cio/output_device.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef TEACHOS_KAPI_CIO_OUTPUT_DEVICE_HPP -#define TEACHOS_KAPI_CIO_OUTPUT_DEVICE_HPP - -// IWYU pragma: private, include <kapi/cio.hpp> - -#include <string_view> - -namespace kapi::cio -{ - - enum struct output_stream - { - stdout, - stderr, - }; - - //! The interface of a device able to perform character output on a platform. - struct output_device - { - output_device(output_device const &) = delete; - output_device(output_device &&) = delete; - auto operator=(output_device const &) -> output_device & = delete; - auto operator=(output_device &&) -> output_device & = delete; - - virtual ~output_device() = default; - - //! Write the given text to the output device. - //! - //! @param stream The stream to write to. - //! @param text The text to write. - auto virtual write(output_stream stream, std::string_view text) -> void = 0; - - protected: - output_device() = default; - }; - -} // namespace kapi::cio - -#endif diff --git a/kapi/include/kapi/cpu.hpp b/kapi/include/kapi/cpu.hpp deleted file mode 100644 index deaf5cd..0000000 --- a/kapi/include/kapi/cpu.hpp +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef TEACHOS_KAPI_CPU_HPP -#define TEACHOS_KAPI_CPU_HPP - -#include <kapi/memory.hpp> - -#include <kstd/format> -#include <kstd/memory> - -#include <cstdint> - -namespace kapi::cpu -{ - - //! @addtogroup kapi-cpu - //! @{ - - //! An exception originating from the CPU directly. - //! - //! Exception generally model interrupts that are synchronous to the instruction stream. This means that they do not - //! originate from external hardware, but rather are a product of program execution. - struct exception - { - //! The type of the exception, which identifies the reason for it being raised. - enum class type : std::uint8_t - { - //! The reason for the exception is unknown or platform-specific - unknown, - //! A page fault occurred - page_fault, - //! A memory access (either in the data or instruction stream) violated it's alignment constraints. - alignment_fault, - //! A memory access (either in the data or instruction stream) violated it's permissions. - memory_access_fault, - //! An invalid instruction was present in the instruction stream. - illegal_instruction, - //! The preconditions for the execution of an instruction were not met. - privilege_violation, - //! An arithmetic error occurred. - arithmetic_error, - //! A breakpoint was hit in the instruction stream. - breakpoint, - //! The CPU is single-stepping through the instruction stream. - single_step, - }; - - //! The type of this exception. - type type{}; - - //! The value of the instruction pointer at the time this exception was raised. - kapi::memory::linear_address instruction_pointer{}; - - //! The memory address that caused this exception. - kapi::memory::linear_address access_address{}; - - //! Whether the page was present at the time of the exception. - bool is_present{}; - - //! Whether the exception was caused by a write access. - bool is_write_access{}; - - //! Whether the exception was caused by a user mode access. - bool is_user_mode{}; - }; - - //! @} - - //! @addtogroup kapi-cpu-kernel-defined - //! @{ - - //! Dispatch an exception to the appropriate handler. - //! - //! @param context The exception context. - //! @return Whether the exception was handled. - [[nodiscard]] auto dispatch(exception const & context) -> bool; - - //! @} - - //! @addtogroup kapi-cpu-platform-defined - //! @{ - - //! Halt the CPU. - //! - //! This function terminates execution of the kernel. - [[noreturn]] auto halt() -> void; - - //! Perform early CPU initialization. - //! - //! When this function returns, the CPU is in a state where interrupt could be enabled. This function must not enable - //! interrupts itself. - auto init() -> void; - - //! Discover the CPU topology of the platform and attach it to the given CPU bus. - //! - //! @return true iff. the CPU topology was discovered successfully, false otherwise. - auto discover_topology() -> bool; - - //! @} - -} // namespace kapi::cpu - -template<> -struct kstd::formatter<enum kapi::cpu::exception::type> -{ - constexpr auto parse(kstd::format_parse_context & ctx) -> decltype(ctx.begin()) - { - return ctx.begin(); - } - - constexpr auto format(enum kapi::cpu::exception::type type, kstd::format_context & ctx) const -> void - { - switch (type) - { - case kapi::cpu::exception::type::unknown: - return ctx.push("unknown"); - case kapi::cpu::exception::type::page_fault: - return ctx.push("page fault"); - case kapi::cpu::exception::type::alignment_fault: - return ctx.push("alignment fault"); - case kapi::cpu::exception::type::memory_access_fault: - return ctx.push("memory access fault"); - case kapi::cpu::exception::type::illegal_instruction: - return ctx.push("illegal instruction"); - case kapi::cpu::exception::type::privilege_violation: - return ctx.push("privilege violation"); - case kapi::cpu::exception::type::arithmetic_error: - return ctx.push("arithmetic error"); - case kapi::cpu::exception::type::breakpoint: - return ctx.push("breakpoint"); - case kapi::cpu::exception::type::single_step: - return ctx.push("single step"); - } - } -}; - -#endif diff --git a/kapi/include/kapi/devices.hpp b/kapi/include/kapi/devices.hpp deleted file mode 100644 index b597aa8..0000000 --- a/kapi/include/kapi/devices.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef TEACHOS_KAPI_DEVICES_HPP -#define TEACHOS_KAPI_DEVICES_HPP - -#include <kapi/devices/bus.hpp> // IWYU pragma: export -#include <kapi/devices/cpu.hpp> // IWYU pragma: export -#include <kapi/devices/device.hpp> // IWYU pragma: export -#include <kapi/devices/manager.hpp> // IWYU pragma: export - -namespace kapi::devices -{ - - //! @addtogroup kapi-devices-kernel-defined - //! @{ - - //! Initialize the kernel's device management subsystem. - auto init() -> void; - - //! Get the virtual system root bus. - //! - //! @warning This function will panic if the root bus has not been initialized. - //! - //! @return a reference to the root bus. - auto get_root_bus() -> bus &; - - //! @} - - //! @addtogroup kapi-devices-platform-defined - //! @{ - - //! Initialize the platform's device tree. - auto init_platform_devices() -> void; - - //! @} - -} // namespace kapi::devices - -#endif
\ No newline at end of file diff --git a/kapi/include/kapi/devices/bus.hpp b/kapi/include/kapi/devices/bus.hpp deleted file mode 100644 index 59f49f7..0000000 --- a/kapi/include/kapi/devices/bus.hpp +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef TEACHOS_KAPI_DEVICES_BUS_HPP -#define TEACHOS_KAPI_DEVICES_BUS_HPP - -// IWYU pragma: private, include <kapi/devices.hpp> - -#include <kapi/devices/device.hpp> - -#include <kstd/memory> -#include <kstd/print> -#include <kstd/string> -#include <kstd/vector> - -#include <atomic> -#include <cstddef> - -namespace kapi::devices -{ - - //! @addtogroup kapi-devices-kernel-defined - //! @{ - - //! A bus device that represents a logical/physical tree of devices and busses. - struct bus : device - { - //! Construct a bus with the given major number, minor number, and name. - //! - //! @param major The major number of the bus. - //! @param minor The minor number of the bus. - //! @param name The name of the bus. - bus(std::size_t major, std::size_t minor, kstd::string const & name); - - //! Initialize the bus and all of its children. - //! - //! @return true iff. the bus and all of its children are healthy, false otherwise. - auto init() -> bool final; - - //! Attach a child device to this bus. - //! - //! Whenever a device is attached to a bus, the bus takes sole ownership of the device. - //! - //! @param child The child device to attach. - auto add_child(kstd::unique_ptr<device> child) -> void; - - [[nodiscard]] auto children() const -> kstd::vector<kstd::observer_ptr<device>> const &; - - protected: - //! Probe the bus hardware state. - //! - //! @return true iff. the bus hardware is healthy, false otherwise. - auto virtual probe() -> bool; - - private: - kstd::vector<kstd::unique_ptr<device>> m_devices; - kstd::vector<kstd::observer_ptr<device>> m_observers; - std::atomic_flag m_init_was_called{}; - std::atomic_flag m_initialized{}; - }; - - //! @} - -} // namespace kapi::devices - -#endif
\ No newline at end of file diff --git a/kapi/include/kapi/devices/cpu.hpp b/kapi/include/kapi/devices/cpu.hpp deleted file mode 100644 index f8ff60c..0000000 --- a/kapi/include/kapi/devices/cpu.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef TEACHOS_KAPI_DEVICES_CPU_HPP -#define TEACHOS_KAPI_DEVICES_CPU_HPP - -#include <kapi/devices/bus.hpp> - -#include <cstddef> -#include <cstdint> - -namespace kapi::devices -{ - - //! A virtual CPU bus to host all CPUs in the system. - struct cpu final : kapi::devices::bus - { - //! A virtual CPU Core to host all core local devices. - struct core final : kapi::devices::bus - { - explicit core(std::size_t major_number, std::size_t minor_number, std::uint64_t hardware_id, bool is_bsp); - - [[nodiscard]] auto hardware_id() const -> std::uint64_t; - [[nodiscard]] auto is_bsp() const -> bool; - - private: - std::uint64_t m_hardware_id; - bool m_is_bsp; - }; - - //! Create a new CPU with the given major and minor numbers. - //! - //! @param major The major number of this CPU - //! @param minor The minor number of this CPU, identifying the physical CPU - cpu(std::size_t major, std::size_t minor); - }; - -} // namespace kapi::devices - -#endif
\ No newline at end of file diff --git a/kapi/include/kapi/devices/device.hpp b/kapi/include/kapi/devices/device.hpp deleted file mode 100644 index 70cf01f..0000000 --- a/kapi/include/kapi/devices/device.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef TEACH_OS_KAPI_DEVICES_DEVICE_HPP -#define TEACH_OS_KAPI_DEVICES_DEVICE_HPP - -// IWYU pragma: private, include <kapi/devices.hpp> - -#include <kstd/memory> -#include <kstd/string> - -#include <cstddef> - -namespace kapi::devices -{ - - //! @addtogroup kapi-devices-kernel-defined - //! @{ - - /** - * @brief Base device identified by a major, minor number and name. - */ - struct device - { - /** - * @brief Create a device identifier from @p major, @p minor and @p name. - * @param major Device major number. - * @param minor Device minor number. - * @param name Device name. - */ - device(size_t major, size_t minor, kstd::string const & name); - - /** - * @brief Virtual destructor for device. - */ - virtual ~device() = default; - - /** - * @brief Initialize the device. - * @return true on success, false otherwise. - */ - virtual auto init() -> bool = 0; - - /** - * @brief Returns the major number of the device. - * @return Device major number. - */ - [[nodiscard]] auto major() const -> size_t; - - /** - * @brief Returns the minor number of the device. - * @return Device minor number. - */ - [[nodiscard]] auto minor() const -> size_t; - - /** - * @brief Returns the name of the device. - * @return Device name. - */ - [[nodiscard]] auto name() const -> kstd::string const &; - - /** - * @brief Check if the device is a block device. - * @return true if this device is a block device, false otherwise. - */ - [[nodiscard]] virtual auto is_block_device() const -> bool; - - private: - friend struct bus; - - auto set_parent(kstd::observer_ptr<struct bus> parent) -> void; - - size_t m_major; - size_t m_minor; - kstd::string m_name; - kstd::observer_ptr<bus> m_parent; - }; - - //! @} - -} // namespace kapi::devices - -#endif
\ No newline at end of file diff --git a/kapi/include/kapi/devices/manager.hpp b/kapi/include/kapi/devices/manager.hpp deleted file mode 100644 index c9b90b4..0000000 --- a/kapi/include/kapi/devices/manager.hpp +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef TEACHOS_KAPI_DEVICES_MANAGER_HPP -#define TEACHOS_KAPI_DEVICES_MANAGER_HPP - -// IWYU pragma: private, include <kapi/devices.hpp> - -#include <kapi/devices/device.hpp> - -#include <kstd/memory> - -#include <cstddef> -#include <string_view> - -namespace kapi::devices -{ - - //! @addtogroup kapi-devices-kernel-defined - //! @{ - - //! Ask the kernel to allocate a new major number. - //! - //! @return a new, unused major number. - auto allocate_major_number() -> std::size_t; - - //! Register a new device with the kernel's device manager. - //! - //! @param device The device to register. - //! @return true if the device was registered successfully, false otherwise. - auto register_device(device & device) -> bool; - - //! Unregister a device from the kernel's device manager. - //! - //! @param device The device to unregister. - //! @return true if the device was unregistered successfully, false otherwise. - auto unregister_device(device & device) -> bool; - - //! Find a device by its major and minor numbers. - //! - //! @param major the major number of the device. - //! @param minor the minor number of the device. - //! @return a pointer to the device iff. the device was found, nullptr otherwise. - auto find_device(std::size_t major, std::size_t minor) -> kstd::observer_ptr<device>; - - //! Find a device by its name. - //! - //! @param name the name of the device. - //! @return a pointer to the device iff. the device was found, nullptr otherwise. - auto find_device(std::string_view name) -> kstd::observer_ptr<device>; - - //! @} - -} // namespace kapi::devices - -#endif
\ No newline at end of file diff --git a/kapi/include/kapi/filesystem.hpp b/kapi/include/kapi/filesystem.hpp deleted file mode 100644 index 94d42ce..0000000 --- a/kapi/include/kapi/filesystem.hpp +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef TEACHOS_KAPI_FILESYSTEM_HPP -#define TEACHOS_KAPI_FILESYSTEM_HPP - -#include <cstddef> -#include <string_view> - -#include <sys/types.h> - -namespace kapi::filesystem -{ - /** - @brief The kapi::filesystem namespace provides the interface for filesystem operations in the kernel. It includes - functions for mounting and unmounting filesystems, as well as basic file operations such as opening, closing, reading - from, and writing to files. The actual implementation of these functions is in the kernel's filesystem subsystem, - which will handle the specifics of different filesystem types and their interactions with the underlying storage - devices. - */ - - /** - @brief Mounts a filesystem from the specified @p source at the specified @p target path. - @param source The source device or filesystem to mount. - @param target The target mount point. - @return 0 on success, -1 on failure. - @qualifier kernel-defined - */ - auto mount(std::string_view source, std::string_view target) -> int; - - /** - @brief Unmounts a filesystem from the specified @p target path. - @param target The target mount point to unmount. - @return 0 on success, -1 on failure. - @qualifier kernel-defined - */ - auto umount(std::string_view target) -> int; - - /** - @brief Opens a file at the specified @p path. - @param path The path to the file to open. - @return A file descriptor on success, -1 on failure. - @qualifier kernel-defined - */ - auto open(std::string_view path) -> int; - - /** - @brief Closes a @p file_descriptor. - @param file_descriptor The file descriptor to close. - @return 0 on success, -1 on failure. - @qualifier kernel-defined - */ - auto close(int file_descriptor) -> int; - - /** - @brief Reads @p size bytes into @p buffer from a @p file_descriptor. - @param file_descriptor The file descriptor to read from. - @param buffer The buffer to store the read data. - @param size The number of bytes to read. - @return The number of bytes read on success, -1 on failure. - @qualifier kernel-defined - */ - auto read(int file_descriptor, void * buffer, size_t size) -> ssize_t; - - /** - @brief Writes @p size bytes from @p buffer to a @p file_descriptor. - @param file_descriptor The file descriptor to write to. - @param buffer The buffer containing the data to write. - @param size The number of bytes to write. - @return The number of bytes written on success, -1 on failure. - @qualifier kernel-defined - */ - auto write(int file_descriptor, void const * buffer, size_t size) -> ssize_t; -} // namespace kapi::filesystem - -#endif // TEACHOS_KAPI_FILESYSTEM_HPP
\ No newline at end of file diff --git a/kapi/include/kapi/interrupts.hpp b/kapi/include/kapi/interrupts.hpp deleted file mode 100644 index 4ba0684..0000000 --- a/kapi/include/kapi/interrupts.hpp +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef TEACHOS_KAPI_INTERRUPTS_HPP -#define TEACHOS_KAPI_INTERRUPTS_HPP - -#include <cstdint> - -namespace kapi::interrupts -{ - - //! @addtogroup kapi-interrupts - //! @{ - - //! A status that indicates whether an interrupt was handled by a handler. - enum class status : bool - { - //! The interrupt was not handled by any handler. - unhandled, - //! The interrupt was handled by at least one handler. - handled, - }; - - //! The interface for all interrupt handlers. - struct handler - { - virtual ~handler() = default; - - //! Handle an interrupt with the given IRQ number. - // - //! This function will be called by the kernel in an interrupt context. As such, the function should complete its - //! task quickly and must take care when acquiring globally shared locks. - //! - //! @param irq_number The identifier of the interrupt request that triggered the handler. - //! @return status::handled if the handler successfully handled the interrupt, status::unhandled otherwise. - virtual |
