Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
sim: Add new syscall: rmdir()
Browse files Browse the repository at this point in the history
  • Loading branch information
mbitsnbites committed Jan 7, 2022
1 parent 55dcb13 commit 298170e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sim/syscalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ void syscalls_t::call(const uint32_t routine_no, std::array<uint32_t, 32>& regs)
regs[2] = static_cast<uint32_t>(result >> 32);
}
break;

case routine_t::RMDIR:
regs[1] = static_cast<uint32_t>(sim_rmdir(path_to_host(regs[1]).c_str()));
break;
}
}

Expand Down Expand Up @@ -431,3 +435,10 @@ unsigned long long syscalls_t::sim_gettimemicros(void) {
#endif
}

int syscalls_t::sim_rmdir(const char *pathname) {
#if defined(_WIN32)
return ::_rmdir(pathname);
#else
return ::rmdir(pathname);
#endif
}
2 changes: 2 additions & 0 deletions sim/syscalls.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class syscalls_t {
UNLINK = 12,
WRITE = 13,
GETTIMEMICROS = 14,
RMDIR = 15,
LAST_
};

Expand Down Expand Up @@ -99,6 +100,7 @@ class syscalls_t {
int sim_unlink(const char *pathname);
int sim_write(int fd, const char *buf, int nbytes);
unsigned long long sim_gettimemicros(void);
int sim_rmdir(const char *pathname);

ram_t& m_ram;

Expand Down

0 comments on commit 298170e

Please sign in to comment.