#include "sysemu/sysemu.h"
#include "trace.h"
#include "qemu/sockets.h"
+#include "qemu/error-report.h"
#include <sys/mman.h>
#include <libgen.h>
#include <setjmp.h>
void *qemu_oom_check(void *ptr)
{
-#ifdef CONFIG_MARU
- const char _msg[] = "Failed to allocate memory in qemu.";
- char cmd[JAVA_MAX_COMMAND_LENGTH] = { 0, };
- int len;
-#endif
-
if (ptr == NULL) {
- fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno));
-#ifdef CONFIG_MARU
- len = strlen(JAVA_EXEFILE_PATH) + strlen(JAVA_EXEOPTION) +
- strlen(JAR_SKINFILE) + strlen(JAVA_SIMPLEMODE_OPTION) +
- strlen(_msg) + 7;
- if (len > JAVA_MAX_COMMAND_LENGTH) {
- len = JAVA_MAX_COMMAND_LENGTH;
- }
-
- snprintf(cmd, len, "%s %s %s %s=\"%s\"",
- JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE, JAVA_SIMPLEMODE_OPTION, _msg);
- if (system(cmd) == -1) {
- fprintf(stderr, "failed to execute this command: %s\n", cmd);
- }
-#endif
+// CONFIG_MARU MODIFICATION
+ //fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno));
+ error_report("Failed to allocate memory: %s", strerror(errno));
abort();
}
return ptr;
#include "qemu/main-loop.h"
#include "trace.h"
#include "qemu/sockets.h"
+#include "qemu/error-report.h"
/* this must come after including "trace.h" */
#include <shlobj.h>
void *qemu_oom_check(void *ptr)
{
-#ifdef CONFIG_MARU
- const char _msg[] = "Failed to allocate memory in qemu.";
- char cmd[JAVA_MAX_COMMAND_LENGTH] = { 0, };
- char *JAVA_EXEFILE_PATH = NULL;
- int len, ret;
-#endif
-
if (ptr == NULL) {
- fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError());
-#ifdef CONFIG_MARU
- JAVA_EXEFILE_PATH = malloc(JAVA_MAX_COMMAND_LENGTH);
- if (!JAVA_EXEFILE_PATH) {
- // TODO: print error message.
- return ptr;
- }
-
- memset(JAVA_EXEFILE_PATH, 0, JAVA_MAX_COMMAND_LENGTH);
- if (is_wow64()) {
- if (!get_java_path(&JAVA_EXEFILE_PATH)) {
- strcpy(JAVA_EXEFILE_PATH, "java");
- }
- } else {
- strcpy(JAVA_EXEFILE_PATH, "java");
- }
- len = strlen(JAVA_EXEFILE_PATH) + strlen(JAVA_EXEOPTION) +
- strlen(JAR_SKINFILE) + strlen(JAVA_SIMPLEMODE_OPTION) +
- strlen(_msg) + 7;
- if (len > JAVA_MAX_COMMAND_LENGTH) {
- len = JAVA_MAX_COMMAND_LENGTH;
- }
-
- snprintf(cmd, len, "%s %s %s %s=\"%s\"",
- JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE,
- JAVA_SIMPLEMODE_OPTION, _msg);
- ret = WinExec(cmd, SW_SHOW);
- if (ret < 32) {
- // TODO: error handling...
- }
-
- /* for 64bit windows */
- free(JAVA_EXEFILE_PATH);
- JAVA_EXEFILE_PATH=0;
-#endif
+// CONFIG_MARU MODIFICATION
+ //fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError());
+ error_report("Failed to allocate memory: %lu", GetLastError());
abort();
}
return ptr;