From d0a41190b6f74b7f3734b9e87f6f7fc61969efe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 21 Oct 2007 13:45:47 +0000 Subject: [PATCH] Made our kernel-emu a bit more complete. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22634 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/add-ons/kernel/kernelland_emu.cpp | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/tests/add-ons/kernel/kernelland_emu.cpp b/src/tests/add-ons/kernel/kernelland_emu.cpp index 5f87262003..11004bd598 100644 --- a/src/tests/add-ons/kernel/kernelland_emu.cpp +++ b/src/tests/add-ons/kernel/kernelland_emu.cpp @@ -697,6 +697,39 @@ devfs_publish_partition(const char *path, const partition_info *info) } +extern "C" int32 +atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst) +{ +#if __INTEL__ + int32 oldValue; + asm volatile("lock; cmpxchg %%ecx, (%%edx)" + : "=a" (oldValue) : "a" (testAgainst), "c" (newValue), "d" (value)); + return oldValue; +#else +#warn "atomic_test_and_set() won't work correctly!" + int32 oldValue = *value; + if (oldValue == testAgainst) + *value = newValue; + + return oldValue; +#endif +} + + +extern "C" int +add_debugger_command(char *name, int (*func)(int, char **), char *desc) +{ + return B_OK; +} + + +extern "C" int +remove_debugger_command(char * name, int (*func)(int, char **)) +{ + return B_OK; +} + + extern "C" void panic(const char *format, ...) { @@ -728,6 +761,19 @@ dprintf(const char *format,...) } +extern "C" void +kprintf(const char *format,...) +{ + va_list args; + va_start(args, format); + printf("\33[35m"); + vprintf(format, args); + printf("\33[0m"); + fflush(stdout); + va_end(args); +} + + extern "C" void dump_block(const char *buffer, int size, const char *prefix) {