mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kernel] Add a request IOPL syscall
Using the new ability to modify user rflags, add a syscall for a process to request its IOPL be changed.
This commit is contained in:
@@ -26,4 +26,10 @@ object system : kobject {
|
|||||||
param size size # Size of the area, in pages
|
param size size # Size of the area, in pages
|
||||||
param flags uint32 # Flags to apply to the created VMA
|
param flags uint32 # Flags to apply to the created VMA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Request the kernel change the IOPL for this process. The only values
|
||||||
|
# that make sense are 0 and 3.
|
||||||
|
method request_iopl {
|
||||||
|
param iopl uint # The IOPL to set for this process
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "j6/errors.h"
|
#include "j6/errors.h"
|
||||||
#include "j6/types.h"
|
#include "j6/types.h"
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
#include "device_manager.h"
|
#include "device_manager.h"
|
||||||
#include "frame_allocator.h"
|
#include "frame_allocator.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@@ -77,4 +78,17 @@ system_map_phys(j6_handle_t handle, j6_handle_t * area, uintptr_t phys, size_t s
|
|||||||
return j6_status_ok;
|
return j6_status_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
j6_status_t
|
||||||
|
system_request_iopl(j6_handle_t handle, unsigned iopl)
|
||||||
|
{
|
||||||
|
// TODO: check capabilities on sys handle
|
||||||
|
if (iopl != 0 && iopl != 3)
|
||||||
|
return j6_err_invalid_arg;
|
||||||
|
|
||||||
|
constexpr uint64_t mask = 3 << 12;
|
||||||
|
cpu_data &cpu = current_cpu();
|
||||||
|
cpu.rflags3 = (cpu.rflags3 & ~mask) | ((iopl << 12) & mask);
|
||||||
|
return j6_status_ok;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace syscalls
|
} // namespace syscalls
|
||||||
|
|||||||
Reference in New Issue
Block a user