| 838 | } |
| 839 | |
| 840 | long SysReadDir(regs64_t* r){ |
| 841 | int fd = SC_ARG0(r); |
| 842 | |
| 843 | if(fd >= static_cast<int>(Scheduler::GetCurrentProcess()->fileDescriptors.get_length())){ |
| 844 | return -EBADF; |
| 845 | } |
| 846 | |
| 847 | fs_dirent_t* direntPointer = (fs_dirent_t*)SC_ARG1(r); |
| 848 | |
| 849 | if(!Memory::CheckUsermodePointer(SC_ARG1(r), sizeof(fs_dirent_t), Scheduler::GetCurrentProcess()->addressSpace)){ |
| 850 | return -EFAULT; |
| 851 | } |
| 852 | |
| 853 | unsigned int count = SC_ARG2(r); |
| 854 | |
| 855 | if((Scheduler::GetCurrentProcess()->fileDescriptors[fd]->node->flags & FS_NODE_TYPE) != FS_NODE_DIRECTORY){ |
| 856 | return -ENOTDIR; |
| 857 | } |
| 858 | |
| 859 | DirectoryEntry tempent; |
| 860 | int ret = fs::ReadDir(Scheduler::GetCurrentProcess()->fileDescriptors[fd], &tempent, count); |
| 861 | |
| 862 | strcpy(direntPointer->name, tempent.name); |
| 863 | direntPointer->type = tempent.flags; |
| 864 | |
| 865 | return ret; |
| 866 | } |
| 867 | |
| 868 | long SysSetFsBase(regs64_t* r){ |
| 869 | asm volatile ("wrmsr" :: "a"(SC_ARG0(r) & 0xFFFFFFFF) /*Value low*/, "d"((SC_ARG0(r) >> 32) & 0xFFFFFFFF) /*Value high*/, "c"(0xC0000100) /*Set FS Base*/); |
nothing calls this directly
no test coverage detected