Re: TMTask and 10.4, 10.4.1
- Subject: Re: TMTask and 10.4, 10.4.1
- From: Alice Hartley <email@hidden>
- Date: Thu, 26 May 2005 20:11:38 -0400
- Delivered-to: email@hidden
- Delivered-to: email@hidden
Here is some of the relevent code.
CARBON is defined, PMCL_OSX_NATIVE_KERNEL is defined.
void
cmain_vbl (TMTaskPtr task)
{
#ifdef PMCL_OSX_NATIVE_KERNEL
mach_port_t
current_thread_on_entry = TScurrent_mach_thread,
suspended_thread = (mach_port_t)0;
#endif
lock_binding_stack();
#ifdef PMCL_OSX_NATIVE_KERNEL
if ((current_thread_on_entry != ((mach_port_t) 0)) &&
(current_thread_on_entry != mach_thread_self())) {
if (thread_suspend(current_thread_on_entry) == KERN_SUCCESS) {
suspended_thread = current_thread_on_entry;
}
}
#endif
{
struct lispsymbol *interrupt_level_sym = &nrs_INTERRUPT_LEVEL;
int interrupt_level = (int) interrupt_level_sym->vcell;
LispObj tagged_il_sym = ((LispObj) interrupt_level_sym) + fulltag_misc;
if (interrupt_level == 0) {
nrs_INTERRUPT_LEVEL.vcell = 1<<fixnumshift;
}
else if ((tag_of(interrupt_level) == tag_fixnum) && /* This test may not be necessary */
(interrupt_level < 0)) {
struct special_binding *b;
LispObj b_value;
for (b = (special_binding *) lisp_global(DB_LINK); b != 0; b = b->link) {
if (((b->sym) == (lispsymbol *) tagged_il_sym)) {
if ((b_value = (b->value)) == 0) {
b->value = 1<<fixnumshift;
break;
}
else if (b_value == 1<<fixnumshift) {
break;
}
}
}
}
}
#ifdef PMCL_OSX_NATIVE_KERNEL
if (suspended_thread != ((mach_port_t) 0)) {
thread_resume(suspended_thread);
}
#endif
unlock_binding_stack();
/* Reenable the VBL */
#ifndef CARBON
task->vblCount = 1;
#else
PrimeTime((QElemPtr)task, 15);
#endif
}
void
lock_binding_stack()
{
#ifdef PMCL_OSX_NATIVE_KERNEL
lock_acquire(binding_stack_lock_set,0);
#endif
}
void
unlock_binding_stack()
{
#ifdef PMCL_OSX_NATIVE_KERNEL
lock_release(binding_stack_lock_set,0);
#endif
}
#ifdef PMCL_OSX_NATIVE_KERNEL
lock_set_t binding_stack_lock_set;
mach_port_t TScurrent_mach_thread = (mach_port_t) 0;
#endif
>> 0 pmcl-OSX-kernel 0x0069e410 cmain_vbl + 276
>> (pmcl-kernel.c:679)
>
>The crash seems to have occurred inside your cmain_vbl code, while
>accessing memory through r0 or r2. What's going on in that code,
>near line 679 of pmcl-kernel.c?
>
>--Dave
>
>On May 26, 2005, at 1:48 PM, Alice Hartley wrote:
>
>> Users of our application report the following crash:
>>
>> Exception: EXC_BAD_ACCESS (0x0001)
>> Codes: KERN_INVALID_ADDRESS (0x0001) at 0x81061505
>>
>>
>> Thread 2 Crashed:
>> 0 pmcl-OSX-kernel 0x0069e410 cmain_vbl + 276
>> (pmcl-kernel.c:679)
>> 1 ...ple.CoreServices.CarbonCore 0x90b738b4 TimerThread + 288
>> 2 libSystem.B.dylib 0x9002c3d4 _pthread_body + 96
>>
>>
>>
>> Thread 2 crashed with PPC Thread State:
>> srr0: 0x0069e410 srr1: 0x0000d030 vrsave: 0x00000000
>> cr: 0x20000008 xer: 0x00000000 lr: 0x0069e338 ctr: 0x9000a770
>> r0: 0x81061501 r1: 0xf0101d70 r2: 0x81061501 r3: 0x00000000
>> r4: 0x00000003 r5: 0x00000024 r6: 0x0000002c r7: 0x00002407
>> r8: 0x00000000 r9: 0x00000000 r10: 0x89d832be r11: 0xa0006c68
>> r12: 0x9000a770 r13: 0x00000000 r14: 0x00000000 r15: 0x00000000
>> r16: 0x00000000 r17: 0x00000000 r18: 0x00000000 r19: 0x00000000
>> r20: 0x00000000 r21: 0x00000000 r22: 0x00000000 r23: 0x00000000
>> r24: 0x00000000 r25: 0x00000000 r26: 0x00000000 r27: 0x00000000
>> r28: 0xa0b037a4 r29: 0x0069e2fc r30: 0xf0101d70 r31: 0x0069e314
>>
>> Another report:
>>
>>>> Exception: EXC_BAD_ACCESS (0x0001)
>>>> Codes: KERN_INVALID_ADDRESS (0x0001) at 0x81041505
>>>>
>>>> Thread 2 Crashed:
>>>> 0 pmcl-OSX-kernel 0x00621410 cmain_vbl + 276
>>>> (pmcl-kernel.c:660)
>>>> 1 ...ple.CoreServices.CarbonCore 0x90b738ac TimerThread + 288
>>>> 2 libSystem.B.dylib 0x9002c3b4 _pthread_body
>>>> + 96
>>>>
>>>> Thread 2 crashed with PPC Thread State:
>>>> srr0: 0x00621410 srr1: 0x0000d030 vrsave:
>>>> 0x00000000
>>>> cr: 0x80000002 xer: 0x00000000 lr: 0x00621338 ctr:
>>>> 0x9000a750
>>>> r0: 0x81041501 r1: 0xf0101d70 r2: 0x00000000 r3:
>>>> 0x00000000
>>>> r4: 0x00000003 r5: 0x00000024 r6: 0x0000002c r7:
>>>> 0x00002407
>>>> r8: 0x00000000 r9: 0x81041501 r10: 0xb0f66ec0 r11:
>>>> 0xa0006c68
>>>> r12: 0x9000a750 r13: 0x00000000 r14: 0x00000000 r15:
>>>> 0x00000000
>>>> r16: 0x00000000 r17: 0x00000000 r18: 0x00000000 r19:
>>>> 0x00000000
>>>> r20: 0x00000000 r21: 0x00000000 r22: 0x00000000 r23:
>>>> 0x00000000
>>>> r24: 0x00000000 r25: 0x00000000 r26: 0x00000000 r27:
>>>> 0x00000000
>>>> r28: 0xa0b0379c r29: 0x006212fc r30: 0xf0101d70 r31:
>>>> 0x00621314
>>>>
>>>>
>>
>> The crash occurs seldom, on the order of once a day. More likely to
>> happen after the machine has been idle for some time (several hours).
>>
>> Rumor has it that something changed in the implementation of TMTask
>> in 10.4
>>
>> Here is the code that sets it up.
>>
>> {
>> TMTask *q = (TMTask *) NewPtrClear(sizeof(TMTask));
>> /* cmain_descriptor = NewTimerProc(cmain_vbl); */
>> cmain_descriptor = (TimerUPP)NewTimerUPP(cmain_vbl);
>>
>> q->qType = 0; /* ?? */
>> q->tmAddr = cmain_descriptor;
>> q->tmCount = 1;
>> cmain_vblQ = q;
>> InsTime((QElem *) q);
>> PrimeTime((QElem *) q, 15);
>> }
>>
>> Any help would be much appreciated.
>> Thank you.
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Carbon-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/carbon-dev/email@hidden
>>
>> This email sent to email@hidden
>>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.