Skip to content

Commit

Permalink
Address some lisp kernel compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
xrme committed Apr 23, 2024
1 parent 8086ea5 commit 9f2ae16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
15 changes: 9 additions & 6 deletions lisp-kernel/thread_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -1368,9 +1368,11 @@ shutdown_thread_tcr(void *arg)
if (tcr->flags & (1<<TCR_FLAG_BIT_FOREIGN)) {
LispObj callback_macptr = nrs_FOREIGN_THREAD_CONTROL.vcell,
callback_ptr = ((macptr *)ptr_from_lispobj(untag(callback_macptr)))->address;

int (*foreign_thread_control)(int) = (int (*)(int))callback_ptr;

tsd_set(lisp_global(TCR_KEY), TCR_TO_TSD(tcr));
((void (*)())ptr_from_lispobj(callback_ptr))(1);
foreign_thread_control(1);
//((void (*)(int))ptr_from_lispobj(callback_ptr))(1);
tsd_set(lisp_global(TCR_KEY), NULL);
}
#ifdef DARWIN
Expand Down Expand Up @@ -1847,6 +1849,7 @@ get_tcr(Boolean create)
if ((current == NULL) && create) {
LispObj callback_macptr = nrs_FOREIGN_THREAD_CONTROL.vcell,
callback_ptr = ((macptr *)ptr_from_lispobj(untag(callback_macptr)))->address;
int (*foreign_thread_control)(int) = (int (*)(int))callback_ptr;
int i, nbindwords = 0;
extern natural initial_stack_size;

Expand Down Expand Up @@ -1877,13 +1880,13 @@ get_tcr(Boolean create)
*(--current->save_vsp) = 0;
current->vs_area->active -= node_size;
}
nbindwords = ((int (*)())ptr_from_lispobj(callback_ptr))(-1);
nbindwords = foreign_thread_control(-1);
for (i = 0; i < nbindwords; i++) {
*(--current->save_vsp) = 0;
current->vs_area->active -= node_size;
}
TCR_AUX(current)->shutdown_count = 1;
((void (*)())ptr_from_lispobj(callback_ptr))(0);
foreign_thread_control(0);

}

Expand Down Expand Up @@ -2047,7 +2050,7 @@ create_thread_context_frame(mach_port_t, natural *, siginfo_t *, TCR*, native_th

Boolean mach_suspend_tcr(TCR *tcr)
{
thread_act_t thread = (thread_act_t)(tcr->native_thread_id);
mach_port_t thread = (mach_port_t)((intptr_t)tcr->native_thread_id);
kern_return_t kret = thread_suspend(thread);

if (kret == 0) {
Expand Down Expand Up @@ -2209,7 +2212,7 @@ resume_tcr(TCR *tcr)
Boolean mach_resume_tcr(TCR *tcr)
{
ExceptionInformation *xp = tcr->suspend_context;
mach_port_t thread = (mach_port_t)(tcr->native_thread_id);
mach_port_t thread = (mach_port_t)((intptr_t)(tcr->native_thread_id));
#if WORD_SIZE == 64
MCONTEXT_T mc = UC_MCONTEXT(xp);
#else
Expand Down
7 changes: 5 additions & 2 deletions lisp-kernel/x86-exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@ handle_alloc_trap(ExceptionInformation *xp, TCR *tcr, Boolean *notify)
return true;
}


int
callback_to_lisp (TCR * tcr, LispObj callback_macptr, ExceptionInformation *xp,
natural arg1, natural arg2, natural arg3, natural arg4, natural arg5)
Expand Down Expand Up @@ -712,8 +711,12 @@ callback_to_lisp (TCR * tcr, LispObj callback_macptr, ExceptionInformation *xp,
pointers (and at least should have called prepare_for_callback()).
*/
callback_ptr = ((macptr *)ptr_from_lispobj(untag(callback_macptr)))->address;
typedef int (*callback_fn_type)(ExceptionInformation *, natural, natural,
natural, natural, natural);
callback_fn_type callback_fn = (callback_fn_type)callback_ptr;

UNLOCK(lisp_global(EXCEPTION_LOCK), tcr);
delta = ((int (*)())callback_ptr) (xp, arg1, arg2, arg3, arg4, arg5);
delta = callback_fn(xp, arg1, arg2, arg3, arg4, arg5);
LOCK(lisp_global(EXCEPTION_LOCK), tcr);

#ifdef X8632
Expand Down

0 comments on commit 9f2ae16

Please sign in to comment.