summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-07 12:05:51 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-07 12:05:51 +0100
commit981a3ae4b3afd241ba4c12fdf4cecb97c78bfb85 (patch)
tree0776ca1fcf5b7c19ec4599505e6e4cc7f18e56aa /Kernel
parent83172e6a4b6bb8762fbd460d3b70a8b3bd8c8149 (diff)
downloadserenity-981a3ae4b3afd241ba4c12fdf4cecb97c78bfb85.zip
Make VFS test environment build again.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Disk.cpp3
-rw-r--r--Kernel/Process.cpp17
-rw-r--r--Kernel/Process.h2
-rw-r--r--Kernel/Syscall.cpp2
4 files changed, 13 insertions, 11 deletions
diff --git a/Kernel/Disk.cpp b/Kernel/Disk.cpp
index 815f31b4eb..9bd00f1a2c 100644
--- a/Kernel/Disk.cpp
+++ b/Kernel/Disk.cpp
@@ -7,6 +7,7 @@
#include "IO.h"
#include "i386.h"
#include "PIC.h"
+#include <AK/Lock.h>
//#define DISK_DEBUG
@@ -55,7 +56,7 @@ static bool waitForInterrupt()
#endif
// FIXME: Add timeout.
while (!interrupted) {
- yield();
+ sched_yield();
}
#ifdef DISK_DEBUG
kprintf("disk: got interrupt!\n");
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 6501bb84e1..d41ac99284 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -388,7 +388,7 @@ int Process::exec(const String& path, Vector<String>&& arguments, Vector<String>
#endif
if (current == this)
- yield();
+ sched_yield();
return 0;
}
@@ -814,7 +814,7 @@ void Process::send_signal(int signal, Process* sender)
dbgprintf("signal: %s(%u) sent %d to %s(%u)\n", sender->name().characters(), sender->pid(), signal, name().characters(), pid());
if (sender == this) {
- yield();
+ sched_yield();
ASSERT_NOT_REACHED();
}
}
@@ -865,7 +865,7 @@ void Process::doHouseKeeping()
s_deadProcesses->clear();
}
-void yield()
+int sched_yield()
{
if (!current) {
kprintf( "PANIC: yield() with !current" );
@@ -876,10 +876,11 @@ void yield()
InterruptDisabler disabler;
if (!scheduleNewProcess())
- return;
+ return 1;
//kprintf("yield() jumping to new process: %x (%s)\n", current->farPtr().selector, current->name().characters());
switchNow();
+ return 0;
}
void switchNow()
@@ -1121,7 +1122,7 @@ ssize_t Process::sys$read(int fd, void* outbuf, size_t nread)
if (!descriptor->hasDataAvailableForRead()) {
m_fdBlockedOnRead = fd;
block(BlockedRead);
- yield();
+ sched_yield();
}
}
nread = descriptor->read((byte*)outbuf, nread);
@@ -1351,7 +1352,7 @@ pid_t Process::sys$waitpid(pid_t waitee, int* wstatus, int options)
m_waitee = waitee;
m_waiteeStatus = 0;
block(BlockedWait);
- yield();
+ sched_yield();
if (wstatus)
*wstatus = m_waiteeStatus;
return m_waitee;
@@ -1374,7 +1375,7 @@ void Process::block(Process::State state)
void block(Process::State state)
{
current->block(state);
- yield();
+ sched_yield();
}
void sleep(DWORD ticks)
@@ -1382,7 +1383,7 @@ void sleep(DWORD ticks)
ASSERT(current->state() == Process::Running);
current->setWakeupTime(system.uptime + ticks);
current->block(Process::BlockedSleep);
- yield();
+ sched_yield();
}
Process* Process::kernelProcess()
diff --git a/Kernel/Process.h b/Kernel/Process.h
index eb76f6b16e..0b6d27f461 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -284,7 +284,7 @@ static inline const char* toString(Process::State state)
return nullptr;
}
-extern void yield();
+extern int sched_yield();
extern bool scheduleNewProcess();
extern void switchNow();
extern void block(Process::State);
diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp
index 0a6acf8022..a6695c377f 100644
--- a/Kernel/Syscall.cpp
+++ b/Kernel/Syscall.cpp
@@ -48,7 +48,7 @@ static DWORD handle(RegisterDump& regs, DWORD function, DWORD arg1, DWORD arg2,
ASSERT_INTERRUPTS_ENABLED();
switch (function) {
case Syscall::SC_yield:
- yield();
+ sched_yield();
break;
case Syscall::SC_putch:
Console::the().putChar(arg1 & 0xff);