Skip to content

Commit

Permalink
Add a simple ELF binary called _test.o to the test fs.
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Oct 18, 2018
1 parent f67d695 commit 5b10846
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Kernel/Userspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

namespace Userspace {

int strlen(const char* str)
{
int len = 0;
while (*(str++))
++len;
return len;
}

int open(const char* path)
{
return DO_SYSCALL_A2(Syscall::PosixOpen, path, strlen(path));
Expand Down
Binary file modified Kernel/_fs_contents
Binary file not shown.
12 changes: 12 additions & 0 deletions Kernel/_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "Userspace.cpp"

using namespace Userspace;

int elf_entry()
{
int fd = open("/Banner.txt");
char buf[2048];
int nread = read(fd, buf, sizeof(buf));
buf[nread] = '\0';
return 0;
}

0 comments on commit 5b10846

Please sign in to comment.