genode/repos/libports/src/lib/qt5/patches/qtwebkit_genode.patch

427 lines
14 KiB
Diff

qtwebkit_genode.patch
diff --git a/qtwebkit/Source/JavaScriptCore/assembler/ARMAssembler.h b/qtwebkit/Source/JavaScriptCore/assembler/ARMAssembler.h
index 19db71d..9cbe4e3 100644
--- a/qtwebkit/Source/JavaScriptCore/assembler/ARMAssembler.h
+++ b/qtwebkit/Source/JavaScriptCore/assembler/ARMAssembler.h
@@ -29,9 +29,14 @@
#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL)
+#if OS(GENODE)
+#include <cpu/cache.h>
+#endif
+
#include "AssemblerBufferWithConstantPool.h"
#include "JITCompilationEffort.h"
#include <wtf/Assertions.h>
+
namespace JSC {
typedef uint32_t ARMWord;
@@ -1069,6 +1074,8 @@ namespace JSC {
UNUSED_PARAM(size);
#elif OS(QNX)
msync(code, size, MS_INVALIDATE_ICACHE);
+#elif OS(GENODE)
+ Genode::cache_coherent((Genode::addr_t)code, size);
#else
#error "The cacheFlush support is missing on this platform."
#endif
diff --git a/qtwebkit/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp b/qtwebkit/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp
index ca0fa21..782aabf 100644
--- a/qtwebkit/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp
+++ b/qtwebkit/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp
@@ -65,7 +65,8 @@ static bool isVFPPresent()
}
#endif
-#if (COMPILER(RVCT) && defined(__TARGET_FPU_VFP)) || (COMPILER(GCC) && defined(__VFP_FP__))
+#if (COMPILER(RVCT) && defined(__TARGET_FPU_VFP)) || \
+ (COMPILER(GCC) && defined(__VFP_FP__) && !defined(__SOFTFP__))
return true;
#else
return false;
diff --git a/qtwebkit/Source/JavaScriptCore/dfg/DFGOperations.cpp b/qtwebkit/Source/JavaScriptCore/dfg/DFGOperations.cpp
index 1305c0a..9af93c0 100644
--- a/qtwebkit/Source/JavaScriptCore/dfg/DFGOperations.cpp
+++ b/qtwebkit/Source/JavaScriptCore/dfg/DFGOperations.cpp
@@ -1796,6 +1796,7 @@ namespace JSC {
#if COMPILER(GCC) && CPU(X86_64)
asm (
+".text" "\n" \
".globl " SYMBOL_STRING(getHostCallReturnValue) "\n"
HIDE_SYMBOL(getHostCallReturnValue) "\n"
SYMBOL_STRING(getHostCallReturnValue) ":" "\n"
diff --git a/qtwebkit/Source/JavaScriptCore/jit/ExecutableAllocator.h b/qtwebkit/Source/JavaScriptCore/jit/ExecutableAllocator.h
index 42e1f95..369f3a8 100644
--- a/qtwebkit/Source/JavaScriptCore/jit/ExecutableAllocator.h
+++ b/qtwebkit/Source/JavaScriptCore/jit/ExecutableAllocator.h
@@ -105,7 +105,15 @@ class DemandExecutableAllocator;
#if CPU(ARM) || CPU(MIPS)
static const size_t fixedExecutableMemoryPoolSize = 16 * 1024 * 1024;
#elif CPU(X86_64) && !CPU(X32)
+#if OS(GENODE)
+/*
+ * Genode's 'mmap()' implementation currently does not support on-demand
+ * allocation of physical memory and tries to allocate the whole amount at once.
+ */
+static const size_t fixedExecutableMemoryPoolSize = 32 * 1024 * 1024;
+#else
static const size_t fixedExecutableMemoryPoolSize = 1024 * 1024 * 1024;
+#endif
#else
static const size_t fixedExecutableMemoryPoolSize = 32 * 1024 * 1024;
#endif
diff --git a/qtwebkit/Source/WTF/wtf/Assertions.cpp b/qtwebkit/Source/WTF/wtf/Assertions.cpp
index 1b2091f..15d1d03 100644
--- a/qtwebkit/Source/WTF/wtf/Assertions.cpp
+++ b/qtwebkit/Source/WTF/wtf/Assertions.cpp
@@ -75,6 +75,10 @@
#include <BlackBerryPlatformLog.h>
#endif
+#if OS(GENODE)
+#include <base/log.h>
+#endif
+
extern "C" {
WTF_ATTRIBUTE_PRINTF(1, 0)
@@ -341,6 +345,11 @@ void WTFCrash()
if (globalHook)
globalHook();
+#if OS(GENODE)
+ Genode::error("WebKit CRASH in '", WTF_PRETTY_FUNCTION, "'");
+ Genode::error(" in ", __FILE__, ":", __LINE__);
+#endif /* OS(GENODE) */
+
WTFReportBacktrace();
*(int *)(uintptr_t)0xbbadbeef = 0;
// More reliable, but doesn't say BBADBEEF.
diff --git a/qtwebkit/Source/WTF/wtf/FastMalloc.cpp b/qtwebkit/Source/WTF/wtf/FastMalloc.cpp
index 82fbd25..9791492 100644
--- a/qtwebkit/Source/WTF/wtf/FastMalloc.cpp
+++ b/qtwebkit/Source/WTF/wtf/FastMalloc.cpp
@@ -111,7 +111,7 @@
#endif
// Use a background thread to periodically scavenge memory to release back to the system
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || OS(GENODE)
#define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 0
#else
#define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 1
diff --git a/qtwebkit/Source/WTF/wtf/InlineASM.h b/qtwebkit/Source/WTF/wtf/InlineASM.h
index 2dc40ef..aeb9ac6 100644
--- a/qtwebkit/Source/WTF/wtf/InlineASM.h
+++ b/qtwebkit/Source/WTF/wtf/InlineASM.h
@@ -64,12 +64,12 @@
#elif OS(AIX)
// IBM's own file format
#define HIDE_SYMBOL(name) ".lglobl " #name
-#elif OS(LINUX) \
+#elif (OS(LINUX) \
|| OS(FREEBSD) \
|| OS(OPENBSD) \
|| OS(SOLARIS) \
|| (OS(HPUX) && CPU(IA64)) \
- || OS(NETBSD)
+ || OS(NETBSD)) \
// ELF platform
#define HIDE_SYMBOL(name) ".hidden " #name
#else
diff --git a/qtwebkit/Source/WTF/wtf/OSAllocatorPosix.cpp b/qtwebkit/Source/WTF/wtf/OSAllocatorPosix.cpp
index fb24cd9..db2ec31 100644
--- a/qtwebkit/Source/WTF/wtf/OSAllocatorPosix.cpp
+++ b/qtwebkit/Source/WTF/wtf/OSAllocatorPosix.cpp
@@ -33,6 +33,10 @@
#include <sys/mman.h>
#include <wtf/Assertions.h>
+#if OS(GENODE)
+#include <base/log.h>
+#endif
+
namespace WTF {
#if CPU(MIPS)
@@ -156,8 +160,12 @@ void* OSAllocator::reserveAndCommit(size_t bytes, Usage usage, bool writable, bo
result = 0;
else
#endif
+#if OS(GENODE)
+ Genode::error("WTF::OSAllocator::reserveAndCommit(): mmap() failed");
+#endif
CRASH();
}
+#if !OS(GENODE)
if (result && includesGuardPages) {
// We use mmap to remap the guardpages rather than using mprotect as
// mprotect results in multiple references to the code region. This
@@ -166,6 +174,7 @@ void* OSAllocator::reserveAndCommit(size_t bytes, Usage usage, bool writable, bo
mmap(result, pageSize(), PROT_NONE, MAP_FIXED | MAP_PRIVATE | MAP_ANON, fd, 0);
mmap(static_cast<char*>(result) + bytes - pageSize(), pageSize(), PROT_NONE, MAP_FIXED | MAP_PRIVATE | MAP_ANON, fd, 0);
}
+#endif /* OS(GENODE) */
return result;
}
@@ -224,9 +233,20 @@ void OSAllocator::decommit(void* address, size_t bytes)
void OSAllocator::releaseDecommitted(void* address, size_t bytes)
{
+#if OS(GENODE)
+ /*
+ * 'releaseDecommitted()' sometimes gets called with a start address
+ * different than the one returned by 'mmap()' to release only a part of the
+ * allocated memory. This feature is currently not supported by Genode's
+ * 'munmap()' implementation, so we don't crash on purpose if the result of
+ * 'munmap()' is -1.
+ */
+ munmap(address, bytes);
+#else
int result = munmap(address, bytes);
if (result == -1)
CRASH();
+#endif /* OS(GENODE) */
}
} // namespace WTF
diff --git a/qtwebkit/Source/WTF/wtf/OSRandomSource.cpp b/qtwebkit/Source/WTF/wtf/OSRandomSource.cpp
index 2495abf..7f05661 100644
--- a/qtwebkit/Source/WTF/wtf/OSRandomSource.cpp
+++ b/qtwebkit/Source/WTF/wtf/OSRandomSource.cpp
@@ -29,6 +29,10 @@
#include <stdint.h>
#include <stdlib.h>
+#if OS(GENODE)
+#include <base/log.h>
+#endif /* OS(GENODE) */
+
#if OS(UNIX)
#include <fcntl.h>
#include <unistd.h>
@@ -43,6 +47,10 @@ namespace WTF {
void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length)
{
+#if OS(GENODE)
+ Genode::warning("cryptographicallyRandomValuesFromOS(): no strong source of randomness available");
+ return;
+#endif /* OS(GENODE) */
#if OS(UNIX)
int fd = open("/dev/urandom", O_RDONLY, 0);
if (fd < 0)
diff --git a/qtwebkit/Source/WTF/wtf/Platform.h b/qtwebkit/Source/WTF/wtf/Platform.h
index 562840c..89a1919 100644
--- a/qtwebkit/Source/WTF/wtf/Platform.h
+++ b/qtwebkit/Source/WTF/wtf/Platform.h
@@ -498,6 +498,12 @@
#endif
+/* OS(GENODE) */
+#ifdef __GENODE__
+/* Note: WTF_OS_FREEBSD is defined, too */
+#define WTF_OS_GENODE 1
+#endif
+
/* Operating environments */
/* FIXME: these are all mixes of OS, operating environment and policy choices. */
@@ -650,6 +656,11 @@
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_TIME_H 1
#define WTF_USE_PTHREADS 1
+
+#elif OS(GENODE)
+#define HAVE_ERRNO_H 1
+#define HAVE_SYS_TIME_H 1
+
#endif /* OS(UNIX) */
#if OS(UNIX) && !OS(ANDROID) && !OS(QNX)
@@ -672,7 +683,7 @@
#endif
#endif
-#if !OS(WINDOWS) && !OS(SOLARIS) && !OS(ANDROID)
+#if !OS(WINDOWS) && !OS(SOLARIS) && !OS(ANDROID) && !OS(GENODE)
#define HAVE_TM_GMTOFF 1
#define HAVE_TM_ZONE 1
#define HAVE_TIMEGM 1
@@ -719,7 +730,7 @@
#if PLATFORM(QT)
/* We must not customize the global operator new and delete for the Qt port. */
#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
-#if !OS(UNIX)
+#if !OS(UNIX) || OS(GENODE)
#define USE_SYSTEM_MALLOC 1
#endif
#endif
@@ -838,7 +849,7 @@
#define ENABLE_DFG_JIT 1
#endif
/* Enable the DFG JIT on ARM, MIPS and SH4. */
-#if CPU(ARM_TRADITIONAL) || CPU(MIPS) || CPU(SH4)
+#if (CPU(ARM_TRADITIONAL) || CPU(MIPS) || CPU(SH4)) && !OS(GENODE)
#define ENABLE_DFG_JIT 1
#endif
#endif
@@ -914,7 +925,7 @@
#define ENABLE_REGEXP_TRACING 0
/* Yet Another Regex Runtime - turned on by default for JIT enabled ports. */
-#if !defined(ENABLE_YARR_JIT) && !ENABLE(LLINT_C_LOOP) && !(OS(QNX) && PLATFORM(QT))
+#if !defined(ENABLE_YARR_JIT) && !ENABLE(LLINT_C_LOOP) && !(OS(QNX) && PLATFORM(QT)) && !OS(GENODE)
#define ENABLE_YARR_JIT 1
/* Setting this flag compares JIT results with interpreter results. */
diff --git a/qtwebkit/Source/WTF/wtf/StackBounds.cpp b/qtwebkit/Source/WTF/wtf/StackBounds.cpp
index 061cae7..04d012c 100644
--- a/qtwebkit/Source/WTF/wtf/StackBounds.cpp
+++ b/qtwebkit/Source/WTF/wtf/StackBounds.cpp
@@ -44,6 +44,10 @@
#include <string.h>
#include <sys/procfs.h>
+#elif OS(GENODE)
+
+#include <base/thread.h>
+
#elif OS(UNIX)
#include <pthread.h>
@@ -124,6 +128,15 @@ void StackBounds::initialize()
#endif
}
+#elif OS(GENODE)
+
+void StackBounds::initialize()
+{
+ Genode::Thread::Stack_info stack_info = Genode::Thread::mystack();
+ m_bound = (void*)stack_info.base;
+ m_origin = (void*)stack_info.top;
+}
+
#elif OS(UNIX)
void StackBounds::initialize()
diff --git a/qtwebkit/Source/WTF/wtf/TCSystemAlloc.cpp b/qtwebkit/Source/WTF/wtf/TCSystemAlloc.cpp
index ae67918..6d7b69a 100644
--- a/qtwebkit/Source/WTF/wtf/TCSystemAlloc.cpp
+++ b/qtwebkit/Source/WTF/wtf/TCSystemAlloc.cpp
@@ -49,6 +49,11 @@
#include <sys/mman.h>
#endif
+#if OS(GENODE)
+#include <base/stdint.h>
+#include <util/misc_math.h>
+#endif
+
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
@@ -370,6 +375,21 @@ void* TCMalloc_SystemAlloc(size_t size, size_t *actual_size, size_t alignment) {
}
#endif
+#if OS(GENODE)
+ if (actual_size)
+ *actual_size = size;
+
+ void* real_address = malloc(sizeof(Genode::addr_t) + size + alignment);
+ Genode::addr_t address = reinterpret_cast<Genode::addr_t>(real_address);
+ address += sizeof(Genode::addr_t);
+ address = Genode::align_addr(address, Genode::log2(alignment));
+ address -= sizeof(Genode::addr_t);
+ *(Genode::addr_t*)address = (Genode::addr_t)real_address;
+ address += sizeof(Genode::addr_t);
+
+ return (void*)address;;
+#endif
+
// nothing worked - reset failure flags and try again
devmem_failure = false;
sbrk_failure = false;
diff --git a/qtwebkit/Source/WebCore/inspector/front-end/InspectorBackendCommands.qrc b/qtwebkit/Source/WebCore/inspector/front-end/InspectorBackendCommands.qrc
index 5b1488b..22df481 100644
--- a/qtwebkit/Source/WebCore/inspector/front-end/InspectorBackendCommands.qrc
+++ b/qtwebkit/Source/WebCore/inspector/front-end/InspectorBackendCommands.qrc
@@ -1,6 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/webkit/inspector">
- <file>InspectorBackendCommands.js</file>
+ <file>../../../../../../qtwebkit/Source/WebCore/generated/InspectorBackendCommands.js</file>
</qresource>
</RCC>
diff --git a/qtwebkit/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/qtwebkit/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
index b2c8d48..caeb3ec 100644
--- a/qtwebkit/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
+++ b/qtwebkit/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
@@ -18,6 +18,8 @@
*/
#include "config.h"
+
+#if ENABLE(VIDEO)
#include "MediaPlayerPrivateQt.h"
#include "Frame.h"
@@ -666,3 +668,4 @@ PlatformMedia MediaPlayerPrivateQt::platformMedia() const
} // namespace WebCore
#include "moc_MediaPlayerPrivateQt.cpp"
+#endif /* ENABLE(VIDEO) */
diff --git a/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h b/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
index 647c4ef..ec4a645 100644
--- a/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
+++ b/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
@@ -65,6 +65,7 @@ public Q_SLOTS:
#endif
public:
void initConnections();
+ void init(const KURL& url);
QTcpSocket* m_socket;
SocketStreamHandle* m_streamHandle;
};
diff --git a/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp b/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
index cd71190..4f8a7b9 100644
--- a/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
+++ b/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
@@ -58,6 +58,19 @@ SocketStreamHandlePrivate::SocketStreamHandlePrivate(SocketStreamHandle* streamH
return;
initConnections();
+ }
+
+/*
+ * This code was factored out from the constructor, because its execution can
+ * end up in 'SocketStreamHandle::platformSend()', which needs the
+ * 'SocketStreamHandle::m_p' member, which gets initialized only after the
+ * constructor returned.
+ *
+ * Genode issue #1677
+ */
+void SocketStreamHandlePrivate::init(const KURL& url)
+{
+ bool isSecure = url.protocolIs("wss");
unsigned int port = url.hasPort() ? url.port() : (isSecure ? 443 : 80);
@@ -188,6 +201,7 @@ SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient
{
LOG(Network, "SocketStreamHandle %p new client %p", this, m_client);
m_p = new SocketStreamHandlePrivate(this, url);
+ m_p->init(url);
}
SocketStreamHandle::SocketStreamHandle(QTcpSocket* socket, SocketStreamHandleClient* client)