[Yellowstone] Try to spawn the teton process from disk.

This commit is contained in:
Drew Galbraith 2023-11-09 12:55:44 -08:00
parent 9e05b3b3dd
commit 0e99189dba
7 changed files with 61 additions and 4 deletions

View File

@ -1,6 +1,7 @@
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
add_subdirectory(denali)
add_subdirectory(teton)
add_subdirectory(victoriafalls)
add_subdirectory(yellowstone)

20
sys/teton/CMakeLists.txt Normal file
View File

@ -0,0 +1,20 @@
add_executable(teton
teton.cpp
)
target_include_directories(teton
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(teton
glacier
mammoth
yellowstone_yunq
)
set_target_properties(teton PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${BASE_COMPILE_FLAGS}"
LINK_FLAGS "${CMAKE_EXE_LINK_FLAGS} ${BASE_LINK_FLAGS}"
)
install(TARGETS teton)

15
sys/teton/teton.cpp Normal file
View File

@ -0,0 +1,15 @@
#include <mammoth/debug.h>
#include <mammoth/init.h>
uint64_t main(uint64_t init_port) {
ParseInitPort(init_port);
dbgln("Teton Starting");
// 1. Set up framebuffer.
// 2. Parse a font file.
// 3. Write a line to the screen.
return 0;
}

View File

@ -22,14 +22,19 @@ glcr::ErrorCode VFSServer::HandleOpenFile(const OpenFileRequest& request,
ASSIGN_OR_RETURN(auto files, driver_.ReadDirectory(2));
for (uint64_t i = 1; i < path_tokens.size() - 1; i++) {
for (uint64_t j = 0; j < files.size(); j++) {
bool found_token = false;
for (uint64_t j = 0; j < files.size() && !found_token; j++) {
if (path_tokens.at(i) ==
glcr::StringView(files.at(j).name, files.at(j).name_len)) {
ASSIGN_OR_RETURN(files, driver_.ReadDirectory(files.at(j).inode));
found_token = true;
}
}
dbgln("Directory '{}' not found.", glcr::String(path_tokens.at(i)).cstr());
return glcr::NOT_FOUND;
if (!found_token) {
dbgln("Directory '{}' not found.",
glcr::String(path_tokens.at(i)).cstr());
return glcr::NOT_FOUND;
}
}
uint64_t inode_num;

View File

@ -1,4 +1,5 @@
#include <glacier/string/str_format.h>
#include <glacier/string/str_split.h>
#include <mammoth/debug.h>
#include <mammoth/endpoint_client.h>
#include <mammoth/init.h>
@ -47,6 +48,21 @@ uint64_t main(uint64_t port_cap) {
glcr::String file(reinterpret_cast<const char*>(filemem.vaddr()),
response.size());
glcr::Vector<glcr::StringView> files = glcr::StrSplit(file, '\n');
for (uint64_t i = 0; i < files.size(); i++) {
if (!files[i].empty()) {
dbgln("Starting {}", files[i]);
OpenFileRequest req;
req.set_path(glcr::StrFormat("/bin/{}", files[i]));
OpenFileResponse resp;
check(vfs_client->OpenFile(req, resp));
ASSIGN_OR_RETURN(YellowstoneClient client3, server->CreateClient());
check(SpawnProcess(resp.memory(), client3.Capability()));
}
}
dbgln("Test: '{}'", file.cstr());
check(server_thread.Join());

BIN
sysroot/bin/teton Executable file

Binary file not shown.

View File

@ -1 +1 @@
A
teton