Compare commits
3 Commits
a46694d0f7
...
b7a962cc26
Author | SHA1 | Date |
---|---|---|
|
b7a962cc26 | |
|
5fb9fa6ae6 | |
|
7989c9d616 |
|
@ -1,4 +1,3 @@
|
||||||
add_subdirectory(glacier)
|
add_subdirectory(glacier)
|
||||||
add_subdirectory(libc)
|
add_subdirectory(libc)
|
||||||
add_subdirectory(libcxx)
|
|
||||||
add_subdirectory(mammoth)
|
add_subdirectory(mammoth)
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
add_library(cxx STATIC
|
|
||||||
src/new.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(cxx
|
|
||||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
target_link_libraries(cxx
|
|
||||||
c
|
|
||||||
zion_lib
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(cxx PROPERTIES
|
|
||||||
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${BASE_COMPILE_FLAGS}")
|
|
|
@ -1,34 +0,0 @@
|
||||||
/* vim: syntax=cpp */
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "cstdint"
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
using ptrdiff_t = uint64_t;
|
|
||||||
using size_t = uint64_t;
|
|
||||||
// FIXME: I don't understand what this does.
|
|
||||||
using max_align_t = uint64_t;
|
|
||||||
using nullptr_t = decltype(nullptr);
|
|
||||||
|
|
||||||
enum class byte : unsigned char {};
|
|
||||||
|
|
||||||
// byte type operations
|
|
||||||
template<class IntType>
|
|
||||||
constexpr byte& operator<<=(byte& b, IntType shift) noexcept;
|
|
||||||
template<class IntType>
|
|
||||||
constexpr byte operator<<(byte b, IntType shift) noexcept;
|
|
||||||
template<class IntType>
|
|
||||||
constexpr byte& operator>>=(byte& b, IntType shift) noexcept;
|
|
||||||
template<class IntType>
|
|
||||||
constexpr byte operator>>(byte b, IntType shift) noexcept;
|
|
||||||
constexpr byte& operator|=(byte& l, byte r) noexcept;
|
|
||||||
constexpr byte operator|(byte l, byte r) noexcept;
|
|
||||||
constexpr byte& operator&=(byte& l, byte r) noexcept;
|
|
||||||
constexpr byte operator&(byte l, byte r) noexcept;
|
|
||||||
constexpr byte& operator^=(byte& l, byte r) noexcept;
|
|
||||||
constexpr byte operator^(byte l, byte r) noexcept;
|
|
||||||
constexpr byte operator~(byte b) noexcept;
|
|
||||||
template<class IntType>
|
|
||||||
constexpr IntType to_integer(byte b) noexcept;
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
/* vim: syntax=cpp */
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
|
@ -1,69 +0,0 @@
|
||||||
/* vim: syntax=cpp */
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "cstddef"
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
// storage allocation errors
|
|
||||||
class bad_alloc;
|
|
||||||
class bad_array_new_length;
|
|
||||||
|
|
||||||
struct destroying_delete_t {
|
|
||||||
explicit destroying_delete_t() = default;
|
|
||||||
};
|
|
||||||
inline constexpr destroying_delete_t destroying_delete{};
|
|
||||||
|
|
||||||
// global operator new control
|
|
||||||
enum class align_val_t : size_t {};
|
|
||||||
|
|
||||||
struct nothrow_t { explicit nothrow_t() = default; };
|
|
||||||
extern const nothrow_t nothrow;
|
|
||||||
|
|
||||||
using new_handler = void (*)();
|
|
||||||
new_handler get_new_handler() noexcept;
|
|
||||||
new_handler set_new_handler(new_handler new_p) noexcept;
|
|
||||||
|
|
||||||
// pointer optimization barrier
|
|
||||||
template<class T> [[nodiscard]] constexpr T* launder(T* p) noexcept;
|
|
||||||
|
|
||||||
// hardware interference size
|
|
||||||
// inline constexpr size_t hardware_destructive_interference_size =
|
|
||||||
// /* implementation-defined */;
|
|
||||||
// inline constexpr size_t hardware_constructive_interference_size =
|
|
||||||
// /* implementation-defined */;
|
|
||||||
}
|
|
||||||
|
|
||||||
// storage allocation and deallocation
|
|
||||||
[[nodiscard]] void* operator new(std::size_t size);
|
|
||||||
[[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignment);
|
|
||||||
[[nodiscard]] void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
|
|
||||||
[[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignment,
|
|
||||||
const std::nothrow_t&) noexcept;
|
|
||||||
|
|
||||||
void operator delete(void* ptr) noexcept;
|
|
||||||
void operator delete(void* ptr, std::size_t size) noexcept;
|
|
||||||
void operator delete(void* ptr, std::align_val_t alignment) noexcept;
|
|
||||||
void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
|
|
||||||
void operator delete(void* ptr, const std::nothrow_t&) noexcept;
|
|
||||||
void operator delete(void* ptr, std::align_val_t alignment,
|
|
||||||
const std::nothrow_t&) noexcept;
|
|
||||||
|
|
||||||
[[nodiscard]] void* operator new[](std::size_t size);
|
|
||||||
[[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment);
|
|
||||||
[[nodiscard]] void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
|
|
||||||
[[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment,
|
|
||||||
const std::nothrow_t&) noexcept;
|
|
||||||
|
|
||||||
void operator delete[](void* ptr) noexcept;
|
|
||||||
void operator delete[](void* ptr, std::size_t size) noexcept;
|
|
||||||
void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
|
|
||||||
void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
|
|
||||||
void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
|
|
||||||
void operator delete[](void* ptr, std::align_val_t alignment,
|
|
||||||
const std::nothrow_t&) noexcept;
|
|
||||||
|
|
||||||
[[nodiscard]] void* operator new (std::size_t size, void* ptr) noexcept;
|
|
||||||
[[nodiscard]] void* operator new[](std::size_t size, void* ptr) noexcept;
|
|
||||||
void operator delete (void* ptr, void*) noexcept;
|
|
||||||
void operator delete[](void* ptr, void*) noexcept;
|
|
|
@ -1,8 +0,0 @@
|
||||||
#include "new"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
[[nodiscard]] void* operator new(std::size_t size) { return malloc(size); }
|
|
||||||
[[nodiscard]] void* operator new[](std::size_t size) { return malloc(size); }
|
|
||||||
|
|
||||||
void operator delete(void*, std::size_t) {}
|
|
|
@ -5,8 +5,10 @@ add_library(mammoth_lib STATIC
|
||||||
src/endpoint_server.cpp
|
src/endpoint_server.cpp
|
||||||
src/init.cpp
|
src/init.cpp
|
||||||
src/memory_region.cpp
|
src/memory_region.cpp
|
||||||
|
src/new.cpp
|
||||||
src/process.cpp
|
src/process.cpp
|
||||||
src/port.cpp
|
src/port_client.cpp
|
||||||
|
src/port_server.cpp
|
||||||
src/thread.cpp
|
src/thread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <glacier/status/error_or.h>
|
|
||||||
#include <glacier/string/string.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <zcall.h>
|
|
||||||
|
|
||||||
// FIXME: Split send and receive.
|
|
||||||
class Port {
|
|
||||||
public:
|
|
||||||
static glcr::ErrorOr<Port> Create();
|
|
||||||
Port(uint64_t port_cap);
|
|
||||||
|
|
||||||
glcr::ErrorCode RecvCap(uint64_t* num_bytes, char* msg, uint64_t* cap);
|
|
||||||
z_err_t PollForIntCap(uint64_t* msg, uint64_t* cap);
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
z_err_t WriteMessage(const T& obj, uint64_t cap);
|
|
||||||
|
|
||||||
glcr::ErrorCode WriteString(glcr::String str, uint64_t cap);
|
|
||||||
|
|
||||||
// FIXME: We can't create error_ors of ints
|
|
||||||
glcr::ErrorCode Duplicate(uint64_t* new_cap);
|
|
||||||
|
|
||||||
private:
|
|
||||||
uint64_t port_cap_;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
z_err_t Port::WriteMessage(const T& obj, uint64_t cap) {
|
|
||||||
return ZPortSend(port_cap_, sizeof(obj), &obj, 1, &cap);
|
|
||||||
}
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <glacier/status/error_or.h>
|
||||||
|
#include <glacier/string/string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <zcall.h>
|
||||||
|
|
||||||
|
class PortClient {
|
||||||
|
public:
|
||||||
|
static PortClient AdoptPort(z_cap_t port_cap);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
z_err_t WriteMessage(const T& obj, z_cap_t cap);
|
||||||
|
|
||||||
|
glcr::ErrorCode WriteString(glcr::String str, z_cap_t cap);
|
||||||
|
|
||||||
|
z_cap_t cap() { return port_cap_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
z_cap_t port_cap_;
|
||||||
|
|
||||||
|
PortClient(z_cap_t port_cap);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
z_err_t PortClient::WriteMessage(const T& obj, z_cap_t cap) {
|
||||||
|
return ZPortSend(port_cap_, sizeof(obj), &obj, 1, &cap);
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <glacier/status/error_or.h>
|
||||||
|
#include <ztypes.h>
|
||||||
|
|
||||||
|
#include "mammoth/port_client.h"
|
||||||
|
|
||||||
|
class PortServer {
|
||||||
|
public:
|
||||||
|
static glcr::ErrorOr<PortServer> Create();
|
||||||
|
static PortServer AdoptCap(z_cap_t cap);
|
||||||
|
|
||||||
|
glcr::ErrorOr<PortClient> CreateClient();
|
||||||
|
|
||||||
|
glcr::ErrorCode RecvCap(uint64_t* num_bytes, char* msg, uint64_t* cap);
|
||||||
|
glcr::ErrorCode PollForIntCap(uint64_t* msg, uint64_t* cap);
|
||||||
|
|
||||||
|
z_cap_t cap() { return port_cap_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
z_cap_t port_cap_;
|
||||||
|
|
||||||
|
PortServer(z_cap_t cap);
|
||||||
|
};
|
|
@ -4,7 +4,7 @@
|
||||||
#include <ztypes.h>
|
#include <ztypes.h>
|
||||||
|
|
||||||
#include "mammoth/debug.h"
|
#include "mammoth/debug.h"
|
||||||
#include "mammoth/port.h"
|
#include "mammoth/port_server.h"
|
||||||
|
|
||||||
uint64_t gSelfProcCap = 0;
|
uint64_t gSelfProcCap = 0;
|
||||||
uint64_t gSelfVmasCap = 0;
|
uint64_t gSelfVmasCap = 0;
|
||||||
|
@ -15,7 +15,7 @@ uint64_t gBootDenaliVmmoCap = 0;
|
||||||
uint64_t gBootVictoriaFallsVmmoCap = 0;
|
uint64_t gBootVictoriaFallsVmmoCap = 0;
|
||||||
|
|
||||||
z_err_t ParseInitPort(uint64_t init_port_cap) {
|
z_err_t ParseInitPort(uint64_t init_port_cap) {
|
||||||
Port port(init_port_cap);
|
PortServer port = PortServer::AdoptCap(init_port_cap);
|
||||||
z_err_t ret;
|
z_err_t ret;
|
||||||
uint64_t init_sig, init_cap;
|
uint64_t init_sig, init_cap;
|
||||||
while ((ret = port.PollForIntCap(&init_sig, &init_cap)) != glcr::EMPTY) {
|
while ((ret = port.PollForIntCap(&init_sig, &init_cap)) != glcr::EMPTY) {
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
[[nodiscard]] void* operator new(uint64_t size) { return malloc(size); }
|
||||||
|
[[nodiscard]] void* operator new[](uint64_t size) { return malloc(size); }
|
||||||
|
|
||||||
|
void operator delete(void*, uint64_t) {}
|
|
@ -1,45 +0,0 @@
|
||||||
#include "mammoth/port.h"
|
|
||||||
|
|
||||||
#include <glacier/status/error.h>
|
|
||||||
#include <zcall.h>
|
|
||||||
|
|
||||||
#include "mammoth/debug.h"
|
|
||||||
|
|
||||||
glcr::ErrorOr<Port> Port::Create() {
|
|
||||||
z_cap_t port;
|
|
||||||
RET_ERR(ZPortCreate(&port));
|
|
||||||
return Port(port);
|
|
||||||
}
|
|
||||||
Port::Port(uint64_t port_cap) : port_cap_(port_cap) {}
|
|
||||||
|
|
||||||
glcr::ErrorCode Port::RecvCap(uint64_t *num_bytes, char *msg, uint64_t *cap) {
|
|
||||||
uint64_t caps = 1;
|
|
||||||
RET_ERR(ZPortRecv(port_cap_, num_bytes, reinterpret_cast<uint8_t *>(msg),
|
|
||||||
&caps, cap));
|
|
||||||
|
|
||||||
if (caps != 1) {
|
|
||||||
return glcr::FAILED_PRECONDITION;
|
|
||||||
}
|
|
||||||
return glcr::OK;
|
|
||||||
}
|
|
||||||
z_err_t Port::PollForIntCap(uint64_t *msg, uint64_t *cap) {
|
|
||||||
uint64_t bytes = sizeof(uint64_t);
|
|
||||||
uint64_t caps = 1;
|
|
||||||
RET_ERR(ZPortPoll(port_cap_, &bytes, reinterpret_cast<uint8_t *>(msg), &caps,
|
|
||||||
cap));
|
|
||||||
|
|
||||||
if (bytes != sizeof(uint64_t)) {
|
|
||||||
return glcr::FAILED_PRECONDITION;
|
|
||||||
}
|
|
||||||
if (caps != 1) {
|
|
||||||
return glcr::FAILED_PRECONDITION;
|
|
||||||
}
|
|
||||||
return glcr::OK;
|
|
||||||
}
|
|
||||||
glcr::ErrorCode Port::WriteString(glcr::String str, uint64_t cap) {
|
|
||||||
return ZPortSend(port_cap_, str.length() + 1, str.cstr(), 1, &cap);
|
|
||||||
}
|
|
||||||
|
|
||||||
glcr::ErrorCode Port::Duplicate(uint64_t *new_cap) {
|
|
||||||
return ZCapDuplicate(port_cap_, new_cap);
|
|
||||||
}
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include "mammoth/port_client.h"
|
||||||
|
|
||||||
|
#include <glacier/status/error.h>
|
||||||
|
#include <zcall.h>
|
||||||
|
|
||||||
|
#include "mammoth/debug.h"
|
||||||
|
|
||||||
|
PortClient PortClient::AdoptPort(z_cap_t cap) { return PortClient(cap); }
|
||||||
|
PortClient::PortClient(z_cap_t port_cap) : port_cap_(port_cap) {}
|
||||||
|
|
||||||
|
glcr::ErrorCode PortClient::WriteString(glcr::String str, z_cap_t cap) {
|
||||||
|
return ZPortSend(port_cap_, str.length() + 1, str.cstr(), 1, &cap);
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
#include "mammoth/port_server.h"
|
||||||
|
|
||||||
|
#include <zcall.h>
|
||||||
|
|
||||||
|
glcr::ErrorOr<PortServer> PortServer::Create() {
|
||||||
|
z_cap_t port;
|
||||||
|
RET_ERR(ZPortCreate(&port));
|
||||||
|
return PortServer(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
PortServer PortServer::AdoptCap(z_cap_t cap) { return PortServer(cap); }
|
||||||
|
|
||||||
|
PortServer::PortServer(z_cap_t port_cap) : port_cap_(port_cap) {}
|
||||||
|
|
||||||
|
glcr::ErrorOr<PortClient> PortServer::CreateClient() {
|
||||||
|
// FIXME: Restrict permissions.
|
||||||
|
z_cap_t new_port;
|
||||||
|
RET_ERR(ZCapDuplicate(port_cap_, &new_port));
|
||||||
|
return PortClient::AdoptPort(new_port);
|
||||||
|
}
|
||||||
|
|
||||||
|
glcr::ErrorCode PortServer::RecvCap(uint64_t *num_bytes, char *msg,
|
||||||
|
uint64_t *cap) {
|
||||||
|
uint64_t caps = 1;
|
||||||
|
RET_ERR(ZPortRecv(port_cap_, num_bytes, reinterpret_cast<uint8_t *>(msg),
|
||||||
|
&caps, cap));
|
||||||
|
|
||||||
|
if (caps != 1) {
|
||||||
|
return glcr::FAILED_PRECONDITION;
|
||||||
|
}
|
||||||
|
return glcr::OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
z_err_t PortServer::PollForIntCap(uint64_t *msg, uint64_t *cap) {
|
||||||
|
uint64_t bytes = sizeof(uint64_t);
|
||||||
|
uint64_t caps = 1;
|
||||||
|
RET_ERR(ZPortPoll(port_cap_, &bytes, reinterpret_cast<uint8_t *>(msg), &caps,
|
||||||
|
cap));
|
||||||
|
|
||||||
|
if (bytes != sizeof(uint64_t)) {
|
||||||
|
return glcr::FAILED_PRECONDITION;
|
||||||
|
}
|
||||||
|
if (caps != 1) {
|
||||||
|
return glcr::FAILED_PRECONDITION;
|
||||||
|
}
|
||||||
|
return glcr::OK;
|
||||||
|
}
|
|
@ -6,7 +6,8 @@
|
||||||
#include "mammoth/debug.h"
|
#include "mammoth/debug.h"
|
||||||
#include "mammoth/endpoint_server.h"
|
#include "mammoth/endpoint_server.h"
|
||||||
#include "mammoth/init.h"
|
#include "mammoth/init.h"
|
||||||
#include "mammoth/port.h"
|
#include "mammoth/port_client.h"
|
||||||
|
#include "mammoth/port_server.h"
|
||||||
|
|
||||||
#define MAM_PROC_DEBUG 0
|
#define MAM_PROC_DEBUG 0
|
||||||
|
|
||||||
|
@ -105,14 +106,13 @@ glcr::ErrorCode SpawnProcessFromElfRegion(uint64_t program,
|
||||||
#if MAM_PROC_DEBUG
|
#if MAM_PROC_DEBUG
|
||||||
dbgln("Port Create");
|
dbgln("Port Create");
|
||||||
#endif
|
#endif
|
||||||
RET_ERR(ZPortCreate(&port_cap));
|
ASSIGN_OR_RETURN(PortServer server, PortServer::Create());
|
||||||
uint64_t port_cap_donate;
|
ASSIGN_OR_RETURN(PortClient pclient, server.CreateClient());
|
||||||
RET_ERR(ZCapDuplicate(port_cap, &port_cap_donate));
|
|
||||||
|
|
||||||
#if MAM_PROC_DEBUG
|
#if MAM_PROC_DEBUG
|
||||||
dbgln("Spawn");
|
dbgln("Spawn");
|
||||||
#endif
|
#endif
|
||||||
RET_ERR(ZProcessSpawn(gSelfProcCap, port_cap_donate, &proc_cap, &as_cap,
|
RET_ERR(ZProcessSpawn(gSelfProcCap, server.cap(), &proc_cap, &as_cap,
|
||||||
&foreign_port_id));
|
&foreign_port_id));
|
||||||
|
|
||||||
uint64_t entry_point = LoadElfProgram(program, as_cap);
|
uint64_t entry_point = LoadElfProgram(program, as_cap);
|
||||||
|
@ -123,10 +123,9 @@ glcr::ErrorCode SpawnProcessFromElfRegion(uint64_t program,
|
||||||
uint64_t thread_cap;
|
uint64_t thread_cap;
|
||||||
RET_ERR(ZThreadCreate(proc_cap, &thread_cap));
|
RET_ERR(ZThreadCreate(proc_cap, &thread_cap));
|
||||||
|
|
||||||
Port p(port_cap);
|
RET_ERR(pclient.WriteMessage<uint64_t>(Z_INIT_SELF_PROC, proc_cap));
|
||||||
RET_ERR(p.WriteMessage<uint64_t>(Z_INIT_SELF_PROC, proc_cap));
|
RET_ERR(pclient.WriteMessage<uint64_t>(Z_INIT_SELF_VMAS, as_cap));
|
||||||
RET_ERR(p.WriteMessage<uint64_t>(Z_INIT_SELF_VMAS, as_cap));
|
RET_ERR(pclient.WriteMessage<uint64_t>(Z_INIT_ENDPOINT, client.GetCap()));
|
||||||
RET_ERR(p.WriteMessage<uint64_t>(Z_INIT_ENDPOINT, client.GetCap()));
|
|
||||||
|
|
||||||
#if MAM_PROC_DEBUG
|
#if MAM_PROC_DEBUG
|
||||||
dbgln("Thread start");
|
dbgln("Thread start");
|
||||||
|
|
|
@ -26,14 +26,14 @@ parted -s $dev mklabel gpt mkpart EFI fat32 1MiB 10MiB mkpart ext2 10MiB 100% se
|
||||||
mkfs.fat -F 12 "${dev}p1"
|
mkfs.fat -F 12 "${dev}p1"
|
||||||
mke2fs "${dev}p2"
|
mke2fs "${dev}p2"
|
||||||
|
|
||||||
limine-deploy "${dev}"
|
limine bios-install "${dev}"
|
||||||
|
|
||||||
mkdir -p efi/
|
mkdir -p efi/
|
||||||
mount "${dev}p1" efi/
|
mount "${dev}p1" efi/
|
||||||
|
|
||||||
mkdir -p efi/EFI/BOOT
|
mkdir -p efi/EFI/BOOT
|
||||||
cp /usr/share/limine/BOOTX64.EFI efi/EFI/BOOT
|
cp /usr/share/limine/BOOTX64.EFI efi/EFI/BOOT
|
||||||
cp /usr/share/limine/limine.sys efi/
|
cp /usr/share/limine/limine-bios.sys efi/
|
||||||
cp ../zion/boot/limine.cfg efi/
|
cp ../zion/boot/limine.cfg efi/
|
||||||
cp zion/zion efi/
|
cp zion/zion efi/
|
||||||
mkdir -p efi/sys
|
mkdir -p efi/sys
|
||||||
|
|
|
@ -12,7 +12,6 @@ target_include_directories(denali
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/include")
|
"${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||||
|
|
||||||
target_link_libraries(denali
|
target_link_libraries(denali
|
||||||
cxx
|
|
||||||
glacier
|
glacier
|
||||||
mammoth_lib
|
mammoth_lib
|
||||||
yellowstonestub
|
yellowstonestub
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <mammoth/debug.h>
|
#include <mammoth/debug.h>
|
||||||
#include <mammoth/endpoint_server.h>
|
#include <mammoth/endpoint_server.h>
|
||||||
#include <mammoth/init.h>
|
#include <mammoth/init.h>
|
||||||
#include <mammoth/port.h>
|
#include <mammoth/port_client.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <yellowstone.h>
|
#include <yellowstone.h>
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ uint64_t main(uint64_t init_port_cap) {
|
||||||
check(resp_cap_or.error());
|
check(resp_cap_or.error());
|
||||||
}
|
}
|
||||||
auto resp_cap = resp_cap_or.value();
|
auto resp_cap = resp_cap_or.value();
|
||||||
Port notify(resp_cap.second());
|
PortClient notify = PortClient::AdoptPort(resp_cap.second());
|
||||||
|
|
||||||
ASSIGN_OR_RETURN(EndpointServer endpoint, EndpointServer::Create());
|
ASSIGN_OR_RETURN(EndpointServer endpoint, EndpointServer::Create());
|
||||||
ASSIGN_OR_RETURN(EndpointClient client, endpoint.CreateClient());
|
ASSIGN_OR_RETURN(EndpointClient client, endpoint.CreateClient());
|
||||||
|
|
|
@ -8,7 +8,6 @@ add_executable(yellowstone
|
||||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
target_link_libraries(yellowstone
|
target_link_libraries(yellowstone
|
||||||
cxx
|
|
||||||
mammoth_lib
|
mammoth_lib
|
||||||
glacier
|
glacier
|
||||||
libdenali
|
libdenali
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
#include "hw/gpt.h"
|
#include "hw/gpt.h"
|
||||||
#include "include/yellowstone.h"
|
#include "include/yellowstone.h"
|
||||||
|
|
||||||
// FIXME: This linkage was missing :(
|
|
||||||
void* operator new[](uint64_t size) { return malloc(size); }
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void ServerThreadBootstrap(void* yellowstone) {
|
void ServerThreadBootstrap(void* yellowstone) {
|
||||||
|
@ -34,11 +32,11 @@ glcr::ErrorCode HandleDenaliRegistration(z_cap_t endpoint_cap) {
|
||||||
|
|
||||||
glcr::ErrorOr<YellowstoneServer> YellowstoneServer::Create() {
|
glcr::ErrorOr<YellowstoneServer> YellowstoneServer::Create() {
|
||||||
ASSIGN_OR_RETURN(EndpointServer server, EndpointServer::Create());
|
ASSIGN_OR_RETURN(EndpointServer server, EndpointServer::Create());
|
||||||
ASSIGN_OR_RETURN(Port port, Port::Create());
|
ASSIGN_OR_RETURN(PortServer port, PortServer::Create());
|
||||||
return YellowstoneServer(server, port);
|
return YellowstoneServer(server, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
YellowstoneServer::YellowstoneServer(EndpointServer server, Port port)
|
YellowstoneServer::YellowstoneServer(EndpointServer server, PortServer port)
|
||||||
: server_(server), register_port_(port) {}
|
: server_(server), register_port_(port) {}
|
||||||
|
|
||||||
Thread YellowstoneServer::RunServer() {
|
Thread YellowstoneServer::RunServer() {
|
||||||
|
@ -63,9 +61,12 @@ void YellowstoneServer::ServerThread() {
|
||||||
break;
|
break;
|
||||||
case kYellowstoneGetRegistration: {
|
case kYellowstoneGetRegistration: {
|
||||||
dbgln("Yellowstone::GetRegistration");
|
dbgln("Yellowstone::GetRegistration");
|
||||||
uint64_t reg_cap;
|
auto client_or = register_port_.CreateClient();
|
||||||
check(register_port_.Duplicate(®_cap));
|
if (!client_or.ok()) {
|
||||||
|
check(client_or.error());
|
||||||
|
}
|
||||||
YellowstoneGetRegistrationResp resp;
|
YellowstoneGetRegistrationResp resp;
|
||||||
|
uint64_t reg_cap = client_or.value().cap();
|
||||||
check(ZReplyPortSend(reply_port_cap, sizeof(resp), &resp, 1, ®_cap));
|
check(ZReplyPortSend(reply_port_cap, sizeof(resp), &resp, 1, ®_cap));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <glacier/status/error_or.h>
|
#include <glacier/status/error_or.h>
|
||||||
#include <mammoth/endpoint_server.h>
|
#include <mammoth/endpoint_server.h>
|
||||||
#include <mammoth/port.h>
|
#include <mammoth/port_server.h>
|
||||||
#include <mammoth/thread.h>
|
#include <mammoth/thread.h>
|
||||||
|
|
||||||
class YellowstoneServer {
|
class YellowstoneServer {
|
||||||
|
@ -19,7 +19,7 @@ class YellowstoneServer {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EndpointServer server_;
|
EndpointServer server_;
|
||||||
Port register_port_;
|
PortServer register_port_;
|
||||||
|
|
||||||
static const uint64_t kBufferSize = 128;
|
static const uint64_t kBufferSize = 128;
|
||||||
uint8_t server_buffer_[kBufferSize];
|
uint8_t server_buffer_[kBufferSize];
|
||||||
|
@ -29,5 +29,5 @@ class YellowstoneServer {
|
||||||
z_cap_t denali_cap_ = 0;
|
z_cap_t denali_cap_ = 0;
|
||||||
z_cap_t victoria_falls_cap_ = 0;
|
z_cap_t victoria_falls_cap_ = 0;
|
||||||
|
|
||||||
YellowstoneServer(EndpointServer server, Port port);
|
YellowstoneServer(EndpointServer server, PortServer port);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue