1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

Kernel: Turn Thread::current and Process::current into functions

This allows us to query the current thread and process on a
per processor basis
This commit is contained in:
Tom 2020-06-28 15:34:31 -06:00 committed by Andreas Kling
parent cdc78515b6
commit 16783bd14d
39 changed files with 518 additions and 369 deletions

View file

@ -198,14 +198,14 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, FlatPtr arg)
switch (request) {
case FB_IOCTL_GET_SIZE_IN_BYTES: {
auto* out = (size_t*)arg;
if (!Process::current->validate_write_typed(out))
if (!Process::current()->validate_write_typed(out))
return -EFAULT;
*out = framebuffer_size_in_bytes();
return 0;
}
case FB_IOCTL_GET_BUFFER: {
auto* index = (int*)arg;
if (!Process::current->validate_write_typed(index))
if (!Process::current()->validate_write_typed(index))
return -EFAULT;
*index = m_y_offset == 0 ? 0 : 1;
return 0;
@ -218,7 +218,7 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, FlatPtr arg)
}
case FB_IOCTL_GET_RESOLUTION: {
auto* resolution = (FBResolution*)arg;
if (!Process::current->validate_write_typed(resolution))
if (!Process::current()->validate_write_typed(resolution))
return -EFAULT;
resolution->pitch = m_framebuffer_pitch;
resolution->width = m_framebuffer_width;
@ -227,7 +227,7 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, FlatPtr arg)
}
case FB_IOCTL_SET_RESOLUTION: {
auto* resolution = (FBResolution*)arg;
if (!Process::current->validate_read_typed(resolution) || !Process::current->validate_write_typed(resolution))
if (!Process::current()->validate_read_typed(resolution) || !Process::current()->validate_write_typed(resolution))
return -EFAULT;
if (resolution->width > MAX_RESOLUTION_WIDTH || resolution->height > MAX_RESOLUTION_HEIGHT)
return -EINVAL;