Changeset 15224


Ignore:
Timestamp:
Feb 21, 2012, 12:20:27 AM (7 years ago)
Author:
gb
Message:

lisp-kernel/androidarm/Makefile: use ndk-r7b, which allegedly produces better

debugging info than ndk-r7

lisp-kernel/androidarm/android_native_app_glue.c: reformat everything.

"native" Android apps don't use Java code to load native libraries and
therefore don't cause JNI_OnLoad() to be called, so we have to make
ANativeActivity_onCreate() do something which loads and initializes
the CCL image. (The "something" in question involves a call to
init_ccl_for_android()).

lisp-kernel/arm-spentry.s: fix typos/brainos in Android callouts.

lisp-kernel/pmcl-kernel.c: define init_lisp_for_android() and load/init the

image from there. (Note that this function currently waits for a debugger
to be attached; that's handy, but we should find some way to make it
optional.)

examples/android/native-activity.lisp: fix typos/brainos/type-errors.

Not sure if this really works, but it runs and doesn't crash.

Location:
trunk/source/lisp-kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/androidarm/Makefile

    r15211 r15224  
    1515
    1616LIBBASE = 0x04001000
    17 NDK = /usr/local/android-ndk-r7
     17NDK = /usr/local/android-ndk-r7b
    1818UNAME_S = $(shell uname -s)
    1919ifeq ($(UNAME_S),Linux)
  • trunk/source/lisp-kernel/androidarm/android_native_app_glue.c

    r15205 r15224  
    192192}
    193193
    194 static void process_cmd(struct android_app* app, struct android_poll_source* source) {
    195     int8_t cmd = android_app_read_cmd(app);
    196     android_app_pre_exec_cmd(app, cmd);
    197     if (app->onAppCmd != NULL) app->onAppCmd(app, cmd);
    198     android_app_post_exec_cmd(app, cmd);
    199 }
    200 
    201 static void* android_app_entry(void* param) {
    202     struct android_app* android_app = (struct android_app*)param;
    203 
    204     android_app->config = AConfiguration_new();
    205     AConfiguration_fromAssetManager(android_app->config, android_app->activity->assetManager);
    206 
    207     print_cur_config(android_app);
    208 
    209     android_app->cmdPollSource.id = LOOPER_ID_MAIN;
    210     android_app->cmdPollSource.app = android_app;
    211     android_app->cmdPollSource.process = process_cmd;
    212     android_app->inputPollSource.id = LOOPER_ID_INPUT;
    213     android_app->inputPollSource.app = android_app;
    214     android_app->inputPollSource.process = process_input;
    215 
    216     ALooper* looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS);
    217     ALooper_addFd(looper, android_app->msgread, LOOPER_ID_MAIN, ALOOPER_EVENT_INPUT, NULL,
    218             &android_app->cmdPollSource);
    219     android_app->looper = looper;
    220 
    221     pthread_mutex_lock(&android_app->mutex);
    222     android_app->running = 1;
    223     pthread_cond_broadcast(&android_app->cond);
    224     pthread_mutex_unlock(&android_app->mutex);
    225 
    226     android_main(android_app);
    227 
    228     android_app_destroy(android_app);
    229     return NULL;
     194static void process_cmd(struct android_app* app, struct android_poll_source* source)
     195{
     196  int8_t cmd = android_app_read_cmd(app);
     197  android_app_pre_exec_cmd(app, cmd);
     198  if (app->onAppCmd != NULL) app->onAppCmd(app, cmd);
     199  android_app_post_exec_cmd(app, cmd);
     200}
     201
     202static void*
     203android_app_entry(void* param)
     204{
     205  struct android_app* android_app = (struct android_app*)param;
     206
     207  android_app->config = AConfiguration_new();
     208  AConfiguration_fromAssetManager(android_app->config, android_app->activity->assetManager);
     209
     210  print_cur_config(android_app);
     211
     212  android_app->cmdPollSource.id = LOOPER_ID_MAIN;
     213  android_app->cmdPollSource.app = android_app;
     214  android_app->cmdPollSource.process = process_cmd;
     215  android_app->inputPollSource.id = LOOPER_ID_INPUT;
     216  android_app->inputPollSource.app = android_app;
     217  android_app->inputPollSource.process = process_input;
     218
     219  ALooper* looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS);
     220  ALooper_addFd(looper, android_app->msgread, LOOPER_ID_MAIN, ALOOPER_EVENT_INPUT, NULL,
     221                &android_app->cmdPollSource);
     222  android_app->looper = looper;
     223
     224  pthread_mutex_lock(&android_app->mutex);
     225  android_app->running = 1;
     226  pthread_cond_broadcast(&android_app->cond);
     227  pthread_mutex_unlock(&android_app->mutex);
     228
     229  android_main(android_app);
     230
     231  android_app_destroy(android_app);
     232  return NULL;
    230233}
    231234
     
    234237// --------------------------------------------------------------------
    235238
    236 static struct android_app* android_app_create(ANativeActivity* activity,
    237         void* savedState, size_t savedStateSize) {
    238     struct android_app* android_app = (struct android_app*)malloc(sizeof(struct android_app));
    239     memset(android_app, 0, sizeof(struct android_app));
    240     android_app->activity = activity;
    241 
    242     pthread_mutex_init(&android_app->mutex, NULL);
    243     pthread_cond_init(&android_app->cond, NULL);
    244 
    245     if (savedState != NULL) {
    246         android_app->savedState = malloc(savedStateSize);
    247         android_app->savedStateSize = savedStateSize;
    248         memcpy(android_app->savedState, savedState, savedStateSize);
    249     }
    250 
    251     int msgpipe[2];
    252     if (pipe(msgpipe)) {
    253         LOGI("could not create pipe: %s", strerror(errno));
    254     }
    255     android_app->msgread = msgpipe[0];
    256     android_app->msgwrite = msgpipe[1];
    257 
    258     pthread_attr_t attr;
    259     pthread_attr_init(&attr);
    260     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
    261     pthread_create(&android_app->thread, &attr, android_app_entry, android_app);
    262 
    263     // Wait for thread to start.
    264     pthread_mutex_lock(&android_app->mutex);
    265     while (!android_app->running) {
    266         pthread_cond_wait(&android_app->cond, &android_app->mutex);
    267     }
    268     pthread_mutex_unlock(&android_app->mutex);
    269 
    270     return android_app;
    271 }
    272 
    273 static void android_app_write_cmd(struct android_app* android_app, int8_t cmd) {
    274     if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) {
    275         LOGI("Failure writing android_app cmd: %s\n", strerror(errno));
    276     }
    277 }
    278 
    279 static void android_app_set_input(struct android_app* android_app, AInputQueue* inputQueue) {
    280     pthread_mutex_lock(&android_app->mutex);
    281     android_app->pendingInputQueue = inputQueue;
    282     android_app_write_cmd(android_app, APP_CMD_INPUT_CHANGED);
    283     while (android_app->inputQueue != android_app->pendingInputQueue) {
    284         pthread_cond_wait(&android_app->cond, &android_app->mutex);
    285     }
    286     pthread_mutex_unlock(&android_app->mutex);
    287 }
    288 
    289 static void android_app_set_window(struct android_app* android_app, ANativeWindow* window) {
    290     pthread_mutex_lock(&android_app->mutex);
    291     if (android_app->pendingWindow != NULL) {
    292         android_app_write_cmd(android_app, APP_CMD_TERM_WINDOW);
    293     }
    294     android_app->pendingWindow = window;
    295     if (window != NULL) {
    296         android_app_write_cmd(android_app, APP_CMD_INIT_WINDOW);
    297     }
    298     while (android_app->window != android_app->pendingWindow) {
    299         pthread_cond_wait(&android_app->cond, &android_app->mutex);
    300     }
    301     pthread_mutex_unlock(&android_app->mutex);
    302 }
    303 
    304 static void android_app_set_activity_state(struct android_app* android_app, int8_t cmd) {
    305     pthread_mutex_lock(&android_app->mutex);
    306     android_app_write_cmd(android_app, cmd);
    307     while (android_app->activityState != cmd) {
    308         pthread_cond_wait(&android_app->cond, &android_app->mutex);
    309     }
    310     pthread_mutex_unlock(&android_app->mutex);
    311 }
    312 
    313 static void android_app_free(struct android_app* android_app) {
    314     pthread_mutex_lock(&android_app->mutex);
    315     android_app_write_cmd(android_app, APP_CMD_DESTROY);
    316     while (!android_app->destroyed) {
    317         pthread_cond_wait(&android_app->cond, &android_app->mutex);
    318     }
    319     pthread_mutex_unlock(&android_app->mutex);
    320 
    321     close(android_app->msgread);
    322     close(android_app->msgwrite);
    323     pthread_cond_destroy(&android_app->cond);
    324     pthread_mutex_destroy(&android_app->mutex);
    325     free(android_app);
    326 }
    327 
    328 static void onDestroy(ANativeActivity* activity) {
    329     LOGI("Destroy: %p\n", activity);
    330     android_app_free((struct android_app*)activity->instance);
    331 }
    332 
    333 static void onStart(ANativeActivity* activity) {
    334     LOGI("Start: %p\n", activity);
    335     android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_START);
    336 }
    337 
    338 static void onResume(ANativeActivity* activity) {
    339     LOGI("Resume: %p\n", activity);
    340     android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_RESUME);
    341 }
    342 
    343 static void* onSaveInstanceState(ANativeActivity* activity, size_t* outLen) {
    344     struct android_app* android_app = (struct android_app*)activity->instance;
    345     void* savedState = NULL;
    346 
    347     LOGI("SaveInstanceState: %p\n", activity);
    348     pthread_mutex_lock(&android_app->mutex);
    349     android_app->stateSaved = 0;
    350     android_app_write_cmd(android_app, APP_CMD_SAVE_STATE);
    351     while (!android_app->stateSaved) {
    352         pthread_cond_wait(&android_app->cond, &android_app->mutex);
    353     }
    354 
    355     if (android_app->savedState != NULL) {
    356         savedState = android_app->savedState;
    357         *outLen = android_app->savedStateSize;
    358         android_app->savedState = NULL;
    359         android_app->savedStateSize = 0;
    360     }
    361 
    362     pthread_mutex_unlock(&android_app->mutex);
    363 
    364     return savedState;
    365 }
    366 
    367 static void onPause(ANativeActivity* activity) {
     239static struct android_app*
     240android_app_create(ANativeActivity* activity,
     241        void* savedState, size_t savedStateSize)
     242{
     243  struct android_app* android_app = (struct android_app*)malloc(sizeof(struct android_app));
     244  memset(android_app, 0, sizeof(struct android_app));
     245  android_app->activity = activity;
     246
     247  pthread_mutex_init(&android_app->mutex, NULL);
     248  pthread_cond_init(&android_app->cond, NULL);
     249
     250  if (savedState != NULL) {
     251    android_app->savedState = malloc(savedStateSize);
     252    android_app->savedStateSize = savedStateSize;
     253    memcpy(android_app->savedState, savedState, savedStateSize);
     254  }
     255
     256  int msgpipe[2];
     257  if (pipe(msgpipe)) {
     258    LOGI("could not create pipe: %s", strerror(errno));
     259  }
     260  android_app->msgread = msgpipe[0];
     261  android_app->msgwrite = msgpipe[1];
     262
     263  pthread_attr_t attr;
     264  pthread_attr_init(&attr);
     265  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
     266  pthread_create(&android_app->thread, &attr, android_app_entry, android_app);
     267
     268  // Wait for thread to start.
     269  pthread_mutex_lock(&android_app->mutex);
     270  while (!android_app->running) {
     271    pthread_cond_wait(&android_app->cond, &android_app->mutex);
     272  }
     273  pthread_mutex_unlock(&android_app->mutex);
     274
     275  return android_app;
     276}
     277
     278static void
     279android_app_write_cmd(struct android_app* android_app, int8_t cmd)
     280{
     281  if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) {
     282    LOGI("Failure writing android_app cmd: %s\n", strerror(errno));
     283  }
     284}
     285
     286static void
     287android_app_set_input(struct android_app* android_app, AInputQueue* inputQueue)
     288{
     289  pthread_mutex_lock(&android_app->mutex);
     290  android_app->pendingInputQueue = inputQueue;
     291  android_app_write_cmd(android_app, APP_CMD_INPUT_CHANGED);
     292  while (android_app->inputQueue != android_app->pendingInputQueue) {
     293    pthread_cond_wait(&android_app->cond, &android_app->mutex);
     294  }
     295  pthread_mutex_unlock(&android_app->mutex);
     296}
     297
     298static void
     299android_app_set_window(struct android_app* android_app, ANativeWindow* window)
     300{
     301  pthread_mutex_lock(&android_app->mutex);
     302  if (android_app->pendingWindow != NULL) {
     303    android_app_write_cmd(android_app, APP_CMD_TERM_WINDOW);
     304  }
     305  android_app->pendingWindow = window;
     306  if (window != NULL) {
     307    android_app_write_cmd(android_app, APP_CMD_INIT_WINDOW);
     308  }
     309  while (android_app->window != android_app->pendingWindow) {
     310    pthread_cond_wait(&android_app->cond, &android_app->mutex);
     311  }
     312  pthread_mutex_unlock(&android_app->mutex);
     313}
     314
     315static void
     316android_app_set_activity_state(struct android_app* android_app, int8_t cmd)
     317{
     318  pthread_mutex_lock(&android_app->mutex);
     319  android_app_write_cmd(android_app, cmd);
     320  while (android_app->activityState != cmd) {
     321    pthread_cond_wait(&android_app->cond, &android_app->mutex);
     322  }
     323  pthread_mutex_unlock(&android_app->mutex);
     324}
     325
     326static void
     327android_app_free(struct android_app* android_app)
     328{
     329  pthread_mutex_lock(&android_app->mutex);
     330  android_app_write_cmd(android_app, APP_CMD_DESTROY);
     331  while (!android_app->destroyed) {
     332    pthread_cond_wait(&android_app->cond, &android_app->mutex);
     333  }
     334  pthread_mutex_unlock(&android_app->mutex);
     335
     336  close(android_app->msgread);
     337  close(android_app->msgwrite);
     338  pthread_cond_destroy(&android_app->cond);
     339  pthread_mutex_destroy(&android_app->mutex);
     340  free(android_app);
     341}
     342
     343static void
     344onDestroy(ANativeActivity* activity)
     345{
     346  LOGI("Destroy: %p\n", activity);
     347  android_app_free((struct android_app*)activity->instance);
     348}
     349
     350static void
     351onStart(ANativeActivity* activity)
     352{
     353  LOGI("Start: %p\n", activity);
     354  android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_START);
     355}
     356
     357static void
     358onResume(ANativeActivity* activity)
     359{
     360  LOGI("Resume: %p\n", activity);
     361  android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_RESUME);
     362}
     363
     364static void*
     365onSaveInstanceState(ANativeActivity* activity, size_t* outLen)
     366{
     367  struct android_app* android_app = (struct android_app*)activity->instance;
     368  void* savedState = NULL;
     369
     370  LOGI("SaveInstanceState: %p\n", activity);
     371  pthread_mutex_lock(&android_app->mutex);
     372  android_app->stateSaved = 0;
     373  android_app_write_cmd(android_app, APP_CMD_SAVE_STATE);
     374  while (!android_app->stateSaved) {
     375    pthread_cond_wait(&android_app->cond, &android_app->mutex);
     376  }
     377
     378  if (android_app->savedState != NULL) {
     379    savedState = android_app->savedState;
     380    *outLen = android_app->savedStateSize;
     381    android_app->savedState = NULL;
     382    android_app->savedStateSize = 0;
     383  }
     384
     385  pthread_mutex_unlock(&android_app->mutex);
     386
     387  return savedState;
     388}
     389
     390static void
     391onPause(ANativeActivity* activity) {
    368392    LOGI("Pause: %p\n", activity);
    369393    android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_PAUSE);
    370394}
    371395
    372 static void onStop(ANativeActivity* activity) {
     396static void
     397onStop(ANativeActivity* activity) {
    373398    LOGI("Stop: %p\n", activity);
    374399    android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_STOP);
    375400}
    376401
    377 static void onConfigurationChanged(ANativeActivity* activity) {
     402static void
     403onConfigurationChanged(ANativeActivity* activity) {
    378404    struct android_app* android_app = (struct android_app*)activity->instance;
    379405    LOGI("ConfigurationChanged: %p\n", activity);
     
    381407}
    382408
    383 static void onLowMemory(ANativeActivity* activity) {
    384     struct android_app* android_app = (struct android_app*)activity->instance;
    385     LOGI("LowMemory: %p\n", activity);
    386     android_app_write_cmd(android_app, APP_CMD_LOW_MEMORY);
    387 }
    388 
    389 static void onWindowFocusChanged(ANativeActivity* activity, int focused) {
    390     LOGI("WindowFocusChanged: %p -- %d\n", activity, focused);
    391     android_app_write_cmd((struct android_app*)activity->instance,
    392             focused ? APP_CMD_GAINED_FOCUS : APP_CMD_LOST_FOCUS);
    393 }
    394 
    395 static void onNativeWindowCreated(ANativeActivity* activity, ANativeWindow* window) {
    396     LOGI("NativeWindowCreated: %p -- %p\n", activity, window);
    397     android_app_set_window((struct android_app*)activity->instance, window);
    398 }
    399 
    400 static void onNativeWindowDestroyed(ANativeActivity* activity, ANativeWindow* window) {
    401     LOGI("NativeWindowDestroyed: %p -- %p\n", activity, window);
    402     android_app_set_window((struct android_app*)activity->instance, NULL);
    403 }
    404 
    405 static void onInputQueueCreated(ANativeActivity* activity, AInputQueue* queue) {
    406     LOGI("InputQueueCreated: %p -- %p\n", activity, queue);
    407     android_app_set_input((struct android_app*)activity->instance, queue);
    408 }
    409 
    410 static void onInputQueueDestroyed(ANativeActivity* activity, AInputQueue* queue) {
    411     LOGI("InputQueueDestroyed: %p -- %p\n", activity, queue);
    412     android_app_set_input((struct android_app*)activity->instance, NULL);
    413 }
    414 
    415 void ANativeActivity_onCreate(ANativeActivity* activity,
    416         void* savedState, size_t savedStateSize) {
    417     LOGI("Creating: %p\n", activity);
    418     activity->callbacks->onDestroy = onDestroy;
    419     activity->callbacks->onStart = onStart;
    420     activity->callbacks->onResume = onResume;
    421     activity->callbacks->onSaveInstanceState = onSaveInstanceState;
    422     activity->callbacks->onPause = onPause;
    423     activity->callbacks->onStop = onStop;
    424     activity->callbacks->onConfigurationChanged = onConfigurationChanged;
    425     activity->callbacks->onLowMemory = onLowMemory;
    426     activity->callbacks->onWindowFocusChanged = onWindowFocusChanged;
    427     activity->callbacks->onNativeWindowCreated = onNativeWindowCreated;
    428     activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed;
    429     activity->callbacks->onInputQueueCreated = onInputQueueCreated;
    430     activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed;
    431 
    432     activity->instance = android_app_create(activity, savedState, savedStateSize);
    433 }
     409static void
     410onLowMemory(ANativeActivity* activity)
     411{
     412  struct android_app* android_app = (struct android_app*)activity->instance;
     413  LOGI("LowMemory: %p\n", activity);
     414  android_app_write_cmd(android_app, APP_CMD_LOW_MEMORY);
     415}
     416
     417static void
     418onWindowFocusChanged(ANativeActivity* activity, int focused)
     419{
     420  LOGI("WindowFocusChanged: %p -- %d\n", activity, focused);
     421  android_app_write_cmd((struct android_app*)activity->instance,
     422                        focused ? APP_CMD_GAINED_FOCUS : APP_CMD_LOST_FOCUS);
     423}
     424
     425static void
     426onNativeWindowCreated(ANativeActivity* activity, ANativeWindow* window)
     427{
     428  LOGI("NativeWindowCreated: %p -- %p\n", activity, window);
     429  android_app_set_window((struct android_app*)activity->instance, window);
     430}
     431
     432static void
     433onNativeWindowDestroyed(ANativeActivity* activity, ANativeWindow* window)
     434{
     435  LOGI("NativeWindowDestroyed: %p -- %p\n", activity, window);
     436  android_app_set_window((struct android_app*)activity->instance, NULL);
     437}
     438
     439static void
     440onInputQueueCreated(ANativeActivity* activity, AInputQueue* queue)
     441{
     442  LOGI("InputQueueCreated: %p -- %p\n", activity, queue);
     443  android_app_set_input((struct android_app*)activity->instance, queue);
     444}
     445
     446static void
     447onInputQueueDestroyed(ANativeActivity* activity, AInputQueue* queue)
     448{
     449  LOGI("InputQueueDestroyed: %p -- %p\n", activity, queue);
     450  android_app_set_input((struct android_app*)activity->instance, NULL);
     451}
     452
     453void
     454ANativeActivity_onCreate(ANativeActivity* activity,
     455        void* savedState, size_t savedStateSize)
     456{
     457  extern Boolean init_ccl_for_android(ANativeActivity *);
     458
     459  if (!init_ccl_for_android(activity)) {
     460    _exit(1);
     461  }
     462 
     463  LOGI("Creating: %p\n", activity);
     464  activity->callbacks->onDestroy = onDestroy;
     465  activity->callbacks->onStart = onStart;
     466  activity->callbacks->onResume = onResume;
     467  activity->callbacks->onSaveInstanceState = onSaveInstanceState;
     468  activity->callbacks->onPause = onPause;
     469  activity->callbacks->onStop = onStop;
     470  activity->callbacks->onConfigurationChanged = onConfigurationChanged;
     471  activity->callbacks->onLowMemory = onLowMemory;
     472  activity->callbacks->onWindowFocusChanged = onWindowFocusChanged;
     473  activity->callbacks->onNativeWindowCreated = onNativeWindowCreated;
     474  activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed;
     475  activity->callbacks->onInputQueueCreated = onInputQueueCreated;
     476  activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed;
     477
     478  activity->instance = android_app_create(activity, savedState, savedStateSize);
     479}
  • trunk/source/lisp-kernel/arm-spentry.s

    r15217 r15224  
    43714371local_label(loop):
    43724372        __(ref_nrs_value(arg_z,toplcatch))
    4373         __(bl _SPmkcatch1v)     /* preserves nfn, at the moment */
     4373        __(bl _SPmkcatch1v)
    43744374        __(b local_label(test)) /* cleanup address, not really a branch */
    43754375        __(ldr nfn,[vsp,#0])
     
    44744474        __(ldr allocptr,[rcontext,#tcr.save_allocptr])
    44754475        __(ref_nrs_function(nfn,restore_lisp_pointers))
    4476         __(extract_fulltag(imm0,nfn))
     4476        __(extract_subtag(imm0,nfn))
    44774477        __(cmp imm0,#subtag_function)
    44784478        __(bne local_label(fail))
     
    44804480        __(bl _SPmkcatch1v)
    44814481        __(b local_label(fail)) /* cleanup address */
     4482        __(ref_nrs_function(nfn,restore_lisp_pointers))
    44824483        __(set_nargs(0))
    44834484        __(bl _SPfuncall)
  • trunk/source/lisp-kernel/pmcl-kernel.c

    r15217 r15224  
    26022602JavaVM *android_vm = NULL;
    26032603
    2604 jint
    2605 JNI_OnLoad(JavaVM *vm, void *unused)
     2604void
     2605wait_for_debugger()
     2606{
     2607  volatile Boolean ready = false;
     2608
     2609  __android_log_print(ANDROID_LOG_INFO,"nativeCCL","waiting for debugger");
     2610  do {
     2611    sleep(1);
     2612  } while(!ready);
     2613
     2614 
     2615
     2616Boolean
     2617init_ccl_for_android(ANativeActivity *activity)
    26062618{
    26072619  extern int page_size;
     
    26142626    ;
    26152627  TCR *tcr;
    2616   BytePtr stack_base, current_sp = (BytePtr) current_stack_pointer();
    2617  
    2618 #if 1
    2619   sleep(100);
    2620 #endif
    2621   android_vm = vm;
    2622 
     2628  BytePtr stack_base, current_sp;
     2629  char **argv;
     2630
     2631  wait_for_debugger();
     2632  android_vm = activity->vm;
     2633
     2634  current_sp = (BytePtr) current_stack_pointer();
    26232635  page_size = getpagesize();
    26242636 
    26252637  if (!check_arm_cpu()) {
    26262638    __android_log_print(ANDROID_LOG_FATAL,"nativeCCL","CPU doesn't support required features");
    2627       return -1;
     2639    return false;
    26282640  }
    26292641  main_thread_pid = getpid();
     
    26682680
    26692681  exception_init();
    2670 
     2682  argv = (char**)(malloc (sizeof (char *)));
     2683  argv[0] = NULL;
    26712684  lisp_global(IMAGE_NAME) = ptr_to_lispobj(ensure_real_path(image_name));
    26722685  lisp_global(KERNEL_PATH) = ptr_to_lispobj(real_executable_name);
    2673   lisp_global(ARGV) = (LispObj)NULL;
     2686  lisp_global(ARGV) = ptr_to_lispobj(argv);
    26742687  lisp_global(KERNEL_IMPORTS) = (LispObj)import_ptrs_base;
    26752688
     
    27072720
    27082721  if (init_lisp(TCR_TO_TSD(tcr)) == 0) {
    2709     return JNI_VERSION_1_6;
    2710   }
    2711   return -1;
     2722    return true;
     2723  }
     2724  return false;
    27122725}
    27132726
     
    27242737android_main(struct android_app* state)
    27252738{
    2726   TCR *tcr = new_tcr(DEFAULT_INITIAL_STACK_SIZE, MIN_TSTACK_SIZE);
     2739  TCR *tcr;
    27272740  JNIEnv *env;
    27282741
     2742  tcr = new_tcr(DEFAULT_INITIAL_STACK_SIZE, MIN_TSTACK_SIZE);
    27292743  thread_init_tcr(tcr, current_stack_pointer,DEFAULT_INITIAL_STACK_SIZE);
    27302744  (*android_vm)->AttachCurrentThread(android_vm, &env, NULL);
Note: See TracChangeset for help on using the changeset viewer.