fix: move RTL-SDR to userspace
This commit is contained in:
1 parent
b1f1cfe32b
commit
5cd5c2e6be
35 files changed
+1922
-1592
No files matched your search
+37
-22
@@ -33,7 +33,7 @@
|
||||
#include "Window.hpp" // SYS_WINCREATE, SYS_WINDESTROY, SYS_WINPRESENT, SYS_WINPOLL, SYS_WINENUM, SYS_WINMAP, SYS_WINSENDEVENT, SYS_WINRESIZE, SYS_WINSETCURSOR, SYS_WINSETFLAGS, SYS_WINSETSCALE, SYS_WINGETSCALE
|
||||
#include "Audio.hpp" // SYS_AUDIOOPEN, SYS_AUDIOCLOSE, SYS_AUDIOWRITE, SYS_AUDIOCTL
|
||||
#include "BluetoothSyscall.hpp" // SYS_BTSCAN, SYS_BTCONNECT, SYS_BTDISCONNECT, SYS_BTLIST, SYS_BTINFO
|
||||
#include "Sdr.hpp" // SYS_SDR_COUNT, SYS_SDR_INFO, SYS_SDR_OPEN, SYS_SDR_CLOSE, SYS_SDR_START, SYS_SDR_STOP, SYS_SDR_READ, SYS_SDR_SETPARAM, SYS_SDR_GETPARAM
|
||||
#include "Usb.hpp" // generic process-owned USB interface access
|
||||
#include "WifiSyscall.hpp" // SYS_WIFI_SCAN, SYS_WIFI_INFO, SYS_WIFI_CONNECT, SYS_WIFI_DISCONNECT
|
||||
#include "IpcSyscall.hpp" // SYS_DUPHANDLE, SYS_WAIT_HANDLE, SYS_STREAM_CREATE, SYS_STREAM_READ, SYS_STREAM_WRITE, SYS_MAILBOX_CREATE, SYS_MAILBOX_SEND, SYS_MAILBOX_RECV, SYS_WAITSET_CREATE, SYS_WAITSET_ADD, SYS_WAITSET_REMOVE, SYS_WAITSET_WAIT, SYS_PROC_OPEN, SYS_SURFACE_CREATE, SYS_SURFACE_MAP, SYS_SURFACE_RESIZE
|
||||
#include "LibSyscall.hpp" // SYS_LOAD_LIB, SYS_UNLOAD_LIB, SYS_DLSYM
|
||||
@@ -420,26 +420,41 @@ namespace montauk::abi {
|
||||
return Sys_AudioList((AudioStreamInfo*)frame->arg1, (int)frame->arg2);
|
||||
case SYS_AUDIOWAIT:
|
||||
return Sys_AudioWait(frame->arg1, frame->arg2);
|
||||
case SYS_SDR_COUNT:
|
||||
return Sys_SdrCount();
|
||||
case SYS_SDR_INFO:
|
||||
if (!UserMemory::Writable<SdrDeviceInfo>(frame->arg2)) return -1;
|
||||
return Sys_SdrInfo((int)frame->arg1, (SdrDeviceInfo*)frame->arg2);
|
||||
case SYS_SDR_OPEN:
|
||||
return Sys_SdrOpen((int)frame->arg1);
|
||||
case SYS_SDR_CLOSE:
|
||||
return Sys_SdrClose((int)frame->arg1);
|
||||
case SYS_SDR_START:
|
||||
return Sys_SdrStart((int)frame->arg1);
|
||||
case SYS_SDR_STOP:
|
||||
return Sys_SdrStop((int)frame->arg1);
|
||||
case SYS_SDR_READ:
|
||||
if (!UserMemory::Range(frame->arg2, frame->arg3, true)) return -1;
|
||||
return Sys_SdrRead((int)frame->arg1, (uint8_t*)frame->arg2, (uint32_t)frame->arg3);
|
||||
case SYS_SDR_SETPARAM:
|
||||
return Sys_SdrSetParam((int)frame->arg1, (int)frame->arg2, frame->arg3);
|
||||
case SYS_SDR_GETPARAM:
|
||||
return Sys_SdrGetParam((int)frame->arg1, (int)frame->arg2);
|
||||
case SYS_USB_LIST: {
|
||||
if ((int64_t)frame->arg2 < 0) return USB_ERR_INVALID;
|
||||
uint64_t maxCount = frame->arg2 > 16 ? 16 : frame->arg2;
|
||||
if (!UserMemory::Range(frame->arg1,
|
||||
maxCount * sizeof(UsbInterfaceInfo), true)) return USB_ERR_INVALID;
|
||||
return Sys_UsbList((UsbInterfaceInfo*)frame->arg1, (int)maxCount);
|
||||
}
|
||||
case SYS_USB_CLAIM:
|
||||
if (frame->arg1 == 0 || frame->arg1 > 16 || frame->arg2 > 255)
|
||||
return USB_ERR_INVALID;
|
||||
return Sys_UsbClaim((uint8_t)frame->arg1, (uint8_t)frame->arg2);
|
||||
case SYS_USB_CLOSE:
|
||||
return Sys_UsbClose((int)frame->arg1);
|
||||
case SYS_USB_CONTROL: {
|
||||
if (!UserMemory::Readable<UsbControlRequest>(frame->arg2)) return USB_ERR_INVALID;
|
||||
UsbControlRequest request = *(const UsbControlRequest*)frame->arg2;
|
||||
if (frame->arg4 > 4096 || frame->arg4 != request.length) return USB_ERR_INVALID;
|
||||
bool deviceToHost = (request.requestType & 0x80) != 0;
|
||||
if (frame->arg4 != 0 &&
|
||||
!UserMemory::Range(frame->arg3, frame->arg4, deviceToHost)) return USB_ERR_INVALID;
|
||||
return Sys_UsbControl((int)frame->arg1, &request,
|
||||
(void*)frame->arg3, (uint32_t)frame->arg4);
|
||||
}
|
||||
case SYS_USB_BULK_IN_START:
|
||||
if (frame->arg2 > 0xffffffffULL || frame->arg3 > 0xffffffffULL)
|
||||
return USB_ERR_INVALID;
|
||||
return Sys_UsbBulkInStart((int)frame->arg1, (uint32_t)frame->arg2,
|
||||
(uint32_t)frame->arg3);
|
||||
case SYS_USB_BULK_IN_STOP:
|
||||
return Sys_UsbBulkInStop((int)frame->arg1);
|
||||
case SYS_USB_BULK_IN_READ:
|
||||
if (frame->arg3 > 0xffffffffULL) return USB_ERR_INVALID;
|
||||
if (!UserMemory::Range(frame->arg2, frame->arg3, true)) return USB_ERR_INVALID;
|
||||
return Sys_UsbBulkInRead((int)frame->arg1, (uint8_t*)frame->arg2,
|
||||
(uint32_t)frame->arg3);
|
||||
case SYS_POWERINFO:
|
||||
if (!UserMemory::Writable<PowerInfo>(frame->arg1)) return -1;
|
||||
return Sys_PowerInfo((PowerInfo*)frame->arg1);
|
||||
@@ -655,7 +670,7 @@ namespace montauk::abi {
|
||||
|
||||
Kt::KernelLogStream(Kt::OK, "Syscall") << "SYSCALL/SYSRET initialized (LSTAR="
|
||||
<< kcp::hex << (uint64_t)SyscallEntry << kcp::dec << ", "
|
||||
<< (SYS_TERMINAL_ATTACHED + 1) << " syscall slots)";
|
||||
<< (SYS_USB_BULK_IN_READ + 1) << " syscall slots)";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user