#ifdef CONFIG_MARU
#include "../tizen/src/hw/maru_overlay.h"
#include "../tizen/src/hw/maru_brightness.h"
+#include "../tizen/src/maru_err_table.h"
#endif
/* output Bochs bios info messages */
return size;
}
-#ifdef CONFIG_MARU
-extern int start_simple_client(char* msg);
-#endif
-
static void load_linux(void *fw_cfg,
const char *kernel_filename,
const char *initrd_filename,
kernel_filename, strerror(errno));
#ifdef CONFIG_MARU
- const char _msg[] = "Kernel image file could not load from following path\n";
char* current_path = (char *)g_get_current_dir();
-
- int len = strlen(_msg) + strlen(current_path) + strlen(kernel_filename) + 3;
+ int len = strlen(current_path) + strlen(kernel_filename) + 2;
char* error_msg = g_malloc0(len * sizeof(char));
- snprintf(error_msg, len - 1, "%s%s/%s", _msg, current_path, kernel_filename);
+ snprintf(error_msg, len, "%s/%s", current_path, kernel_filename);
- start_simple_client(error_msg);
+ maru_register_exit_msg(MARU_EXIT_KERNEL_FILE_EXCEPTION, error_msg);
g_free(current_path);
g_free(error_msg);
fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name);
#ifdef CONFIG_MARU
- const char _msg[] = "Bios image file could not load from following path\n";
char* current_path = (char *)g_get_current_dir();
const char* _path = qemu_get_data_dir();
- int len = strlen(_msg) + strlen(current_path) + strlen(_path) + strlen(bios_name) + 4;
+ int len = strlen(current_path) + strlen(_path) + strlen(bios_name) + 3;
char* error_msg = g_malloc0(len * sizeof(char));
- snprintf(error_msg, len - 1, "%s%s/%s/%s", _msg, current_path, _path, bios_name);
+ snprintf(error_msg, len, "%s/%s/%s", current_path, _path, bios_name);
- start_simple_client(error_msg);
+ maru_register_exit_msg(MARU_EXIT_BIOS_FILE_EXCEPTION, error_msg);
g_free(current_path);
g_free(error_msg);
endif #CONFIG_WIN32
# maru loader
-obj-y += emulator.o emul_state.o option.o
+obj-y += emulator.o emul_state.o option.o maru_err_table.o
# maru display
obj-y += maru_sdl.o sdl_rotate.o maru_finger.o
#include "emul_state.h"
#include "qemu_socket.h"
#include "build_info.h"
+#include "maru_err_table.h"
#include <glib.h>
#include <glib/gstdio.h>
extract_info(qemu_argc, qemu_argv);
INFO("Emulator start !!!\n");
+ atexit(maru_atexit);
system_info();
INFO("Prepare running...\n");
--- /dev/null
+/*
+ * Error message
+ *
+ * Copyright (C) 2011, 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+#include "maru_err_table.h"
+#include <stdio.h>
+#include <string.h>
+
+
+/* This table must match the enum definition */
+static char _maru_string_table[][JAVA_MAX_COMMAND_LENGTH] = {
+ "", //MARU_EXIT_NORMAL
+ "Failed to allocate memory in qemu.", //MARU_EXIT_MEMORY_EXCEPTION
+ "Fail to load kernel file. Check if the file is corrupted or missing from the following path.\n\n", //MARU_EXIT_KERNEL_FILE_EXCEPTION
+ "Fail to load bios file. Check if the file is corrupted or missing from the following path.\n\n" //MARU_EXIT_BIOS_FILE_EXCEPTION
+ /* add here */
+};
+
+
+static int maru_exit_status = MARU_EXIT_NORMAL;
+static char maru_exit_msg[JAVA_MAX_COMMAND_LENGTH] = { 0, };
+
+void maru_register_exit_msg(int maru_exit_index, char* additional_msg)
+{
+ int len = 0;
+
+ maru_exit_status = maru_exit_index;
+
+ if (maru_exit_status != MARU_EXIT_NORMAL) {
+ len = strlen(_maru_string_table[maru_exit_status]) + strlen(additional_msg) + 1;
+ if (len >= JAVA_MAX_COMMAND_LENGTH) {
+ len = JAVA_MAX_COMMAND_LENGTH;
+ }
+
+ snprintf(maru_exit_msg, len, "%s%s", _maru_string_table[maru_exit_status], additional_msg);
+ } else {
+ len = strlen(additional_msg);
+ if (len >= JAVA_MAX_COMMAND_LENGTH) {
+ additional_msg[JAVA_MAX_COMMAND_LENGTH - 1] = '\0';
+ len = JAVA_MAX_COMMAND_LENGTH - 1;
+ }
+
+ strcpy(maru_exit_msg, additional_msg);
+ }
+}
+
+void maru_atexit(void)
+{
+ if (maru_exit_status != MARU_EXIT_NORMAL || strlen(maru_exit_msg) != 0) {
+ start_simple_client(maru_exit_msg);
+ }
+}
+
--- /dev/null
+/*
+ * Error message
+ *
+ * Copyright (C) 2011, 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+#ifndef __EMUL_ERR_TABLE_H__
+#define __EMUL_ERR_TABLE_H__
+
+#include "skin/maruskin_client.h"
+
+
+/* TODO: define macro for fair of definition */
+
+enum { //This enum must match the table definition
+ MARU_EXIT_NORMAL = 0,
+ MARU_EXIT_MEMORY_EXCEPTION,
+ MARU_EXIT_KERNEL_FILE_EXCEPTION,
+ MARU_EXIT_BIOS_FILE_EXCEPTION
+ /* add here */
+};
+
+
+void maru_register_exit_msg(int maru_exit_status, char* additional_msg);
+void maru_atexit(void);
+
+#endif /* __EMUL_ERR_TABLE_H__ */
MULTI_DEBUG_CHANNEL(qemu, maruskin_client);
-
#define SKIN_SERVER_READY_TIME 3 // second
#define SKIN_SERVER_SLEEP_TIME 10 // milli second
#define OPT_VM_PATH "vm.path"
#define OPT_NET_BASE_PORT "net.baseport"
-#define MAX_COMMAND 512
static int skin_argc;
static char** skin_argv;
static void* run_skin_client(void* arg)
{
- char cmd[MAX_COMMAND] = {0};
+ char cmd[JAVA_MAX_COMMAND_LENGTH] = { 0, };
char argv[256] = {0};
INFO("run skin client\n");
int start_simple_client(char* msg) {
int ret = 0;
- char cmd[MAX_COMMAND] = {0};
+ char cmd[JAVA_MAX_COMMAND_LENGTH] = { 0, };
INFO("run simple client\n");
#ifndef MARUSKIN_CLIENT_H_
#define MARUSKIN_CLIENT_H_
+#define JAVA_MAX_COMMAND_LENGTH 512
+
int start_skin_client(int argc, char* argv[]);
int start_simple_client(char* msg);