mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +00:00
Kernel: Replace "current" with Thread::current and Process::current
Suggested by Sergey. The currently running Thread and Process are now Thread::current and Process::current respectively. :^)
This commit is contained in:
parent
4f4af24b9d
commit
48f7c28a5c
37 changed files with 257 additions and 252 deletions
|
@ -141,14 +141,14 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, unsigned arg)
|
|||
switch (request) {
|
||||
case FB_IOCTL_GET_SIZE_IN_BYTES: {
|
||||
auto* out = (size_t*)arg;
|
||||
if (!current->process().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 (!current->process().validate_write_typed(index))
|
||||
if (!Process::current->validate_write_typed(index))
|
||||
return -EFAULT;
|
||||
*index = m_y_offset == 0 ? 0 : 1;
|
||||
return 0;
|
||||
|
@ -161,7 +161,7 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, unsigned arg)
|
|||
}
|
||||
case FB_IOCTL_GET_RESOLUTION: {
|
||||
auto* resolution = (FBResolution*)arg;
|
||||
if (!current->process().validate_write_typed(resolution))
|
||||
if (!Process::current->validate_write_typed(resolution))
|
||||
return -EFAULT;
|
||||
resolution->pitch = m_framebuffer_pitch;
|
||||
resolution->width = m_framebuffer_width;
|
||||
|
@ -170,7 +170,7 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, unsigned arg)
|
|||
}
|
||||
case FB_IOCTL_SET_RESOLUTION: {
|
||||
auto* resolution = (FBResolution*)arg;
|
||||
if (!current->process().validate_read_typed(resolution) || !current->process().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;
|
||||
|
|
|
@ -77,21 +77,21 @@ int MBVGADevice::ioctl(FileDescription&, unsigned request, unsigned arg)
|
|||
switch (request) {
|
||||
case FB_IOCTL_GET_SIZE_IN_BYTES: {
|
||||
auto* out = (size_t*)arg;
|
||||
if (!current->process().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 (!current->process().validate_write_typed(index))
|
||||
if (!Process::current->validate_write_typed(index))
|
||||
return -EFAULT;
|
||||
*index = 0;
|
||||
return 0;
|
||||
}
|
||||
case FB_IOCTL_GET_RESOLUTION: {
|
||||
auto* resolution = (FBResolution*)arg;
|
||||
if (!current->process().validate_write_typed(resolution))
|
||||
if (!Process::current->validate_write_typed(resolution))
|
||||
return -EFAULT;
|
||||
resolution->pitch = m_framebuffer_pitch;
|
||||
resolution->width = m_framebuffer_width;
|
||||
|
@ -100,7 +100,7 @@ int MBVGADevice::ioctl(FileDescription&, unsigned request, unsigned arg)
|
|||
}
|
||||
case FB_IOCTL_SET_RESOLUTION: {
|
||||
auto* resolution = (FBResolution*)arg;
|
||||
if (!current->process().validate_read_typed(resolution) || !current->process().validate_write_typed(resolution))
|
||||
if (!Process::current->validate_read_typed(resolution) || !Process::current->validate_write_typed(resolution))
|
||||
return -EFAULT;
|
||||
resolution->pitch = m_framebuffer_pitch;
|
||||
resolution->width = m_framebuffer_width;
|
||||
|
|
|
@ -184,7 +184,7 @@ void PATAChannel::wait_for_irq()
|
|||
{
|
||||
cli();
|
||||
enable_irq();
|
||||
current->wait_on(m_irq_queue);
|
||||
Thread::current->wait_on(m_irq_queue);
|
||||
disable_irq();
|
||||
}
|
||||
|
||||
|
@ -279,8 +279,8 @@ bool PATAChannel::ata_read_sectors_with_dma(u32 lba, u16 count, u8* outbuf, bool
|
|||
LOCKER(s_lock());
|
||||
#ifdef PATA_DEBUG
|
||||
kprintf("%s(%u): PATAChannel::ata_read_sectors_with_dma (%u x%u) -> %p\n",
|
||||
current->process().name().characters(),
|
||||
current->pid(), lba, count, outbuf);
|
||||
Process::current->name().characters(),
|
||||
Process::current->pid(), lba, count, outbuf);
|
||||
#endif
|
||||
|
||||
prdt().offset = m_dma_buffer_page->paddr();
|
||||
|
@ -352,8 +352,8 @@ bool PATAChannel::ata_write_sectors_with_dma(u32 lba, u16 count, const u8* inbuf
|
|||
LOCKER(s_lock());
|
||||
#ifdef PATA_DEBUG
|
||||
kprintf("%s(%u): PATAChannel::ata_write_sectors_with_dma (%u x%u) <- %p\n",
|
||||
current->process().name().characters(),
|
||||
current->pid(), lba, count, inbuf);
|
||||
Process::current->name().characters(),
|
||||
Process::current->pid(), lba, count, inbuf);
|
||||
#endif
|
||||
|
||||
prdt().offset = m_dma_buffer_page->paddr();
|
||||
|
@ -423,8 +423,8 @@ bool PATAChannel::ata_read_sectors(u32 start_sector, u16 count, u8* outbuf, bool
|
|||
LOCKER(s_lock());
|
||||
#ifdef PATA_DEBUG
|
||||
kprintf("%s(%u): PATAChannel::ata_read_sectors request (%u sector(s) @ %u into %p)\n",
|
||||
current->process().name().characters(),
|
||||
current->pid(),
|
||||
Process::current->name().characters(),
|
||||
Process::current->pid(),
|
||||
count,
|
||||
start_sector,
|
||||
outbuf);
|
||||
|
@ -481,8 +481,8 @@ bool PATAChannel::ata_write_sectors(u32 start_sector, u16 count, const u8* inbuf
|
|||
LOCKER(s_lock());
|
||||
#ifdef PATA_DEBUG
|
||||
kprintf("%s(%u): PATAChannel::ata_write_sectors request (%u sector(s) @ %u)\n",
|
||||
current->process().name().characters(),
|
||||
current->pid(),
|
||||
Process::current->name().characters(),
|
||||
Process::current->pid(),
|
||||
count,
|
||||
start_sector);
|
||||
#endif
|
||||
|
|
|
@ -171,7 +171,7 @@ void SB16::wait_for_irq()
|
|||
{
|
||||
cli();
|
||||
enable_irq();
|
||||
current->wait_on(m_irq_queue);
|
||||
Thread::current->wait_on(m_irq_queue);
|
||||
disable_irq();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue