1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:17:34 +00:00

Get rid of #ifdef SERENITY. We're past that phase of bootstrapping.

This commit is contained in:
Andreas Kling 2019-01-17 01:41:36 +01:00
parent 5605295d00
commit b5c76d7559
14 changed files with 1 additions and 95 deletions

View file

@ -1,16 +1,10 @@
#pragma once
#ifdef SERENITY
#ifdef KERNEL
#include <Kernel/kassert.h>
#else
#include <LibC/assert.h>
#endif
#else
#include <assert.h>
#define ASSERT(x) assert(x)
#define ASSERT_NOT_REACHED() assert(false)
#endif
namespace AK {

View file

@ -1,48 +1,32 @@
#pragma once
#ifdef SERENITY
#ifdef KERNEL
#include <Kernel/StdLib.h>
#else
#include <LibC/stdlib.h>
#include <LibC/string.h>
#endif
#else
#include <cstring>
#include <cstdlib>
#include <utility>
#endif
#include <AK/Types.h>
ALWAYS_INLINE void fast_dword_copy(dword* dest, const dword* src, size_t count)
{
#ifdef SERENITY
asm volatile(
"rep movsl\n"
: "=S"(src), "=D"(dest), "=c"(count)
: "S"(src), "D"(dest), "c"(count)
: "memory"
);
#else
memcpy(dest, src, count * sizeof(dword));
#endif
}
ALWAYS_INLINE void fast_dword_fill(dword* dest, dword value, size_t count)
{
#ifdef SERENITY
asm volatile(
"rep stosl\n"
: "=D"(dest), "=c"(count)
: "D"(dest), "c"(count), "a"(value)
: "memory"
);
#else
for (size_t i = 0; x <= count; ++x) {
dest[i] = value;
}
#endif
}
namespace AK {

View file

@ -26,11 +26,7 @@ template<typename T>
struct Traits<T*> {
static unsigned hash(const T* p)
{
#ifdef SERENITY
return intHash((dword)p);
#else
return intHash((unsigned long long)p & 0xffffffff);
#endif
}
static void dump(const T* p) { kprintf("%p", p); }
};

View file

@ -11,7 +11,6 @@ private:
#define AK_MAKE_ETERNAL
#endif
#ifdef SERENITY
#ifdef KERNEL
#include <Kernel/kmalloc.h>
#else
@ -30,20 +29,3 @@ void* kmalloc_eternal(size_t) MALLOC_ATTR;
inline void* operator new(size_t, void* p) { return p; }
inline void* operator new[](size_t, void* p) { return p; }
#endif
#else
#include <new>
#include "Types.h"
extern "C" {
void* kcalloc(size_t nmemb, size_t size);
void* kmalloc(size_t size) MALLOC_ATTR;
void kfree(void* ptr);
void* krealloc(void* ptr, size_t size);
void* kmalloc_eternal(size_t) MALLOC_ATTR;
}
#endif

View file

@ -1,9 +1,3 @@
#pragma once
#ifdef SERENITY
#include <Kernel/kstdio.h>
#else
#include <cstdio>
#define kprintf printf
#define ksprintf sprintf
#endif

View file

@ -1,10 +1,3 @@
#pragma once
#ifdef SERENITY
#include <Kernel/ktime.h>
#else
#include <time.h>
#define ktime time
#define klocaltime localtime
#endif