vr->num = num;
vr->desc = p;
vr->avail = p + num*sizeof(struct vring_desc);
- vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(__virtio16)
+ vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16)
+ align-1) & ~(align - 1));
}
targetos=$hostos
else
# FIXME
- targetos="CROSS_MINGW";
+ case "$CROSS_PREFIX" in
+ x86_64*)
+ targetos="CROSS_MINGW64";
+ ;;
+ *)
+ targetos="CROSS_MINGW32";
+ ;;
+ esac
fi
if [ -z "$TIZEN_SDK_DEV_PATH" ] ; then
# append common options
CONFIGURE_APPEND="
--target-list=$EMUL_TARGET_LIST
+ --enable-werror
--enable-maru
--enable-yagl
--enable-curl
--disable-xen
$CONFIGURE_APPEND"
+CONFIGURE_APPEND_WIN="
+ --extra-ldflags=-static-libgcc
+ --extra-ldflags=-static-libstdc++
+ --audio-drv-list=dsound
+ --winver=0x0600
+ --enable-sdl
+ --enable-hax"
+
# append platform specific options
case $targetos in
Linux*)
CONFIGURE_APPEND="
- --enable-werror
--extra-ldflags=-rdynamic
--audio-drv-list=alsa
--enable-sdl
$CONFIGURE_APPEND
"
;;
-CROSS_MINGW*)
+CROSS_MINGW32*)
CONFIGURE_APPEND="
--cross-prefix=${CROSS_PREFIX}-
- --enable-werror
- --extra-ldflags=-static-libgcc
- --extra-ldflags=-static-libstdc++
--extra-ldflags=-Wl,--large-address-aware
- --audio-drv-list=dsound
- --winver=0x0600
- --enable-sdl
- --enable-hax
+ $CONFIGURE_APPEND_WIN
+ $CONFIGURE_APPEND
+"
+;;
+CROSS_MINGW64*)
+CONFIGURE_APPEND="
+ --cross-prefix=${CROSS_PREFIX}-
+ --with-sdlabi=2.0
+ $CONFIGURE_APPEND_WIN
$CONFIGURE_APPEND
"
+# we use SDL2 for Win64
+# SDL2 will be applied to Win32 soon
;;
MINGW*)
CONFIGURE_APPEND="
--cc=gcc
--cxx=g++
- --enable-werror
- --extra-ldflags=-static-libgcc
- --extra-ldflags=-static-libstdc++
--extra-ldflags=-Wl,--large-address-aware
- --audio-drv-list=dsound
- --winver=0x0600
- --enable-sdl
- --enable-hax
+ $CONFIGURE_APPEND_WIN
$CONFIGURE_APPEND
"
+# Do not support building Win64 binary on Windows now
;;
Darwin*)
CONFIGURE_APPEND="
--cc=clang
--cxx=clang
- --enable-werror
--extra-cflags=-mmacosx-version-min=10.7
--extra-cflags=-Wno-error=deprecated-declarations
--extra-ldflags=-lstdc++
#ifdef CONFIG_SDL
/* Gets the version of the dynamically linked SDL library */
+ const SDL_version *sdl_linked;
+# if (SDL_MAJOR_VERSION == 2)
+ SDL_version linked;
+ SDL_GetVersion(&linked);
+ sdl_linked = &linked;
+# else
+ sdl_linked = SDL_Linked_Version();
+# endif
LOG_INFO("* Host SDL version : %d.%d.%d\n",
- SDL_Linked_Version()->major,
- SDL_Linked_Version()->minor,
- SDL_Linked_Version()->patch);
+ sdl_linked->major,
+ sdl_linked->minor,
+ sdl_linked->patch);
#endif
print_system_info_os();
static char** skin_argv;
#ifdef CONFIG_WIN32
-static char* JAVA_EXEFILE_PATH = NULL;
+static const char* JAVA_EXEFILE_PATH = NULL;
#endif
static void *run_skin_client(void *arg)
is_netclient_tap_attached() ? "true" : "false");
int tap_opt_len = (int)strlen(tap_enabled);
+ get_java_path(&JAVA_EXEFILE_PATH);
#ifdef CONFIG_WIN32
- /* find java path in 64bit windows */
- JAVA_EXEFILE_PATH = malloc(JAVA_MAX_COMMAND_LENGTH);
- memset(JAVA_EXEFILE_PATH, 0, JAVA_MAX_COMMAND_LENGTH);
- if (is_wow64()) {
- INFO("This process is running under WOW64.\n");
- if (!get_java_path(&JAVA_EXEFILE_PATH)) {
- strcpy(JAVA_EXEFILE_PATH, "java");
- }
- } else {
- strcpy(JAVA_EXEFILE_PATH, "java");
- }
-
char const* bin_dir = get_bin_path();
int bin_len = strlen(bin_dir);
char bin_dir_win[bin_len];
#ifdef CONFIG_WIN32
/* for 64bit windows */
- free(JAVA_EXEFILE_PATH);
JAVA_EXEFILE_PATH = NULL;
//WinExec( cmd, SW_SHOW );
INFO("run simple client\n");
+ get_java_path(&JAVA_EXEFILE_PATH);
#ifdef CONFIG_WIN32
- /* find java path in 64bit windows */
- JAVA_EXEFILE_PATH = malloc(JAVA_MAX_COMMAND_LENGTH);
- memset(JAVA_EXEFILE_PATH, 0, JAVA_MAX_COMMAND_LENGTH);
- if (is_wow64()) {
- INFO("This process is running under WOW64.\n");
- if (!get_java_path(&JAVA_EXEFILE_PATH)) {
- strcpy(JAVA_EXEFILE_PATH, "java");
- }
- } else {
- strcpy(JAVA_EXEFILE_PATH, "java");
- }
-
char const* bin_dir = get_bin_path();
int bin_dir_len = strlen(bin_dir);
char bin_dir_win[bin_dir_len];
INFO("command for swt : %s\n", cmd);
#ifdef CONFIG_WIN32
- /* for 64bit windows */
- free(JAVA_EXEFILE_PATH);
- JAVA_EXEFILE_PATH=0;
+ JAVA_EXEFILE_PATH = NULL;
ret = WinExec(cmd, SW_SHOW);
#else
QString command;
QStringList arguments;
-#ifdef CONFIG_WIN32
- char *path = (char *)malloc(JAVA_MAX_COMMAND_LENGTH);
- memset(path, 0, sizeof(char) * JAVA_MAX_COMMAND_LENGTH);
- if (is_wow64()) {
- arguments << "-d64";
+ /* find java path */
+ const char *path;
- if (get_java_path(&path)) {
- command = QString::fromLocal8Bit(path);
- } else {
- showMsgBox(QMessageBox::Warning, MSG_INVALID_JAVA_PATH);
- free(path);
- return;
- }
+ get_java_path(&path);
+
+ if (path) {
+ command = QString::fromLocal8Bit(path);
} else {
- command = "javaw.exe";
+ // can not enter here...
+ showMsgBox(QMessageBox::Warning, MSG_INVALID_JAVA_PATH);
+ return;
}
- free(path);
-#else
- command = "java";
-#endif
+#if defined(__x86_64__) || defined(_WIN64)
+ arguments << "-d64";
+#endif
#ifdef CONFIG_DARWIN
/* SWT Display must be created on main thread due to Cocoa restrictions */
arguments << "-XstartOnFirstThread";
}
-static HMODULE get_module_handle(DWORD dwAddress)
+static HMODULE get_module_handle(void *dwAddress)
{
MEMORY_BASIC_INFORMATION Buffer;
return VirtualQuery((LPCVOID) dwAddress, &Buffer, sizeof(Buffer))
if (!pContext) {
__asm__ __volatile__ ("movl %%ebp, %0" : "=m" (pTopFrame));
} else {
+#ifdef _WIN64
+ pTopFrame = (void *)((PCONTEXT)pContext)->Rbp;
+#else
pTopFrame = (void *)((PCONTEXT)pContext)->Ebp;
+#endif
}
if (pTopFrame == NULL) {
ERR("\nBacktrace Dump Start :\n");
if (pContext) {
memset(module_buf, 0, sizeof(module_buf));
- hModule = get_module_handle((DWORD)((PCONTEXT)pContext)->Eip);
+#ifdef _WIN64
+ hModule = get_module_handle((void *)((PCONTEXT)pContext)->Rip);
+#else
+ hModule = get_module_handle((void *)((PCONTEXT)pContext)->Eip);
+#endif
if (hModule) {
if (!GetModuleFileNameA(hModule, module_buf, sizeof(module_buf))) {
memset(module_buf, 0, sizeof(module_buf));
}
}
+#ifdef _WIN64
+ ERR("[%02d]Addr = 0x%p : %s\n", nCount, ((PCONTEXT)pContext)->Rip, get_filename_from_path(module_buf));
+#else
ERR("[%02d]Addr = 0x%p : %s\n", nCount, ((PCONTEXT)pContext)->Eip, get_filename_from_path(module_buf));
+#endif
nCount++;
}
}
memset(module_buf, 0, sizeof(module_buf));
- hModule = get_module_handle((DWORD)currentFrame.pReturnAddr);
+ hModule = get_module_handle(currentFrame.pReturnAddr);
if (hModule) {
if (!GetModuleFileNameA(hModule, module_buf, sizeof(module_buf))) {
memset(module_buf, 0, sizeof(module_buf));
pExceptionRecord = pExceptionInfo->ExceptionRecord;
memset(module_buf, 0, sizeof(module_buf));
- hModule = get_module_handle((DWORD)pExceptionRecord->ExceptionAddress);
+ hModule = get_module_handle(pExceptionRecord->ExceptionAddress);
if(hModule){
if(!GetModuleFileNameA(hModule, module_buf, sizeof(module_buf))){
memset(module_buf, 0, sizeof(module_buf));
}
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
-int is_wow64(void)
+
+#ifndef _WIN64
+static int is_wow64(void)
{
int result = 0;
LPFN_ISWOW64PROCESS fnIsWow64Process;
return result;
}
+#endif
/* Gets the JavaHome path from the windows registry.
Must call the RegOpenKeyEx by using the following flag.
For details, "http://stackoverflow.com/questions/10533421/
accessing-64-bit-registry-from-32-bit-application" */
#define MY_KEY_WOW64_64KEY 0x0100
-static char wow64_java_path[PATH_MAX];
-bool get_java_path(char **java_path)
+void get_java_path_win32(const char **java_path)
{
+#ifdef _WIN64
+ *java_path = "javaw.exe";
+#else
LONG res;
HKEY hKey;
char strKey[PATH_MAX] = {0};
char strVersion[PATH_MAX] = {0};
char strJavaHome[PATH_MAX] = {0};
DWORD dwBufLen = PATH_MAX;
+ static char wow64_java_path[PATH_MAX];
+
+ // we should try it no matter what happens
+ *java_path = "javaw.exe";
+
+ if (!is_wow64()) {
+ return;
+ }
if (wow64_java_path[0] != '\0') {
- g_strlcpy(*java_path, wow64_java_path, PATH_MAX);
- return true;
+ *java_path = wow64_java_path;
+ return;
}
g_strlcpy(strKey, "SOFTWARE\\JavaSoft\\Java Runtime Environment", PATH_MAX);
PATH_MAX);
if (dwBufLen == 0) {
WARN("There is no JavaHome\n");
- return false;
+ // try it with "javaw.exe"
+ return;
}
}
- g_sprintf(*java_path, "\"%s\\bin\\javaw.exe\"", strJavaHome);
- g_strlcpy(wow64_java_path, *java_path, PATH_MAX);
+ g_sprintf(wow64_java_path, "\"%s\\bin\\javaw.exe\"", strJavaHome);
INFO("JavaHome: %s\n", wow64_java_path);
- return true;
+
+ *java_path = wow64_java_path;
+#endif
}
#include <curl/curl.h>
#include <string.h>
-
#ifndef CONFIG_WIN32
MULTI_DEBUG_CHANNEL(emulator, osutil);
static sdcard_info info;
#endif
char* lock_file; /* reserved for future use */
} sdcard_info;
+
#ifndef CONFIG_WIN32
bool make_sdcard_lock_posix(char *sdcard);
int remove_sdcard_lock_posix(char *sdcard);
#else
-int is_wow64(void);
-bool get_java_path(char **java_path);
+void get_java_path_win32(const char **java_path);
#endif
void print_system_info_os(void);
+int get_number_of_processors(void);
static inline int get_timeofday(char *buf, size_t size)
{
return ret + g_snprintf(buf + ret, size - ret, ".%03ld", (long)tv.tv_usec/1000);
}
-int get_number_of_processors(void);
+static inline void get_java_path(const char **java_path)
+{
+#ifdef CONFIG_WIN32
+ get_java_path_win32(java_path);
+#else
+ *java_path = "java";
+#endif
+}
#endif // __OS_UTIL_H__
static void socket_close_handler( void* _fd )
{
- int fd = (int)_fd;
+ int fd = (int)(uintptr_t)_fd;
int ret;
char buff[64];
shutdown( fd, SD_BOTH );
/* we want to drain the socket before closing it */
- qemu_set_fd_handler( fd, socket_close_handler, NULL, (void*)fd );
+ qemu_set_fd_handler( fd, socket_close_handler, NULL, (void*)(uintptr_t)fd );
errno = old_errno;
}