2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
8 #include <aros/asmcall.h>
9 #include <aros/debug.h>
11 #include <hardware/intbits.h>
12 #include <proto/exec.h>
13 #include <proto/hostlib.h>
15 #include "classbase.h"
19 * MacOS X x86 ABI says that stack must be aligned at 16 bytes boundary.
20 * Some functions crash if this condition is not met. For example, CFRunLoopRunInMode()
21 * crashes deeply inside UIKit (CATimeWithHostTime() function).
22 * We add also noinline because gcc loves to inline such short functions, consequently
23 * omitting stack realignment.
24 * Unfortunately we can't do this on Darwin side. Darwin gcc simply ignores
25 * force_align_arg_pointer attribute. :(
27 #define __stackalign __attribute__((force_align_arg_pointer, noinline))
29 #define __stackalign static inline
32 static AROS_INTH1(vblHandler
, struct UIKitBase
*,base
)
36 Signal(base
->eventTask
, base
->eventMask
);
42 __stackalign
void PollEvents(struct UIKitBase
*base
)
44 base
->iface
->PollEvents();
48 void EventTask(struct UIKitBase
*base
)
51 LONG signal
= AllocSignal(-1);
53 D(bug("[UIKit] Event poll task started, signal %d, base 0x%p\n", signal
, base
));
55 base
->eventMask
= 1 << signal
;
56 base
->eventInt
.is_Node
.ln_Name
= "Cocoa Touch events poll";
57 base
->eventInt
.is_Code
= (VOID_FUNC
)vblHandler
;
58 base
->eventInt
.is_Data
= base
;
60 AddIntServer(INTB_VERTB
, &base
->eventInt
);
64 sigset
= Wait(base
->eventMask
| SIGBREAKF_CTRL_C
);
66 if (sigset
& base
->eventMask
)
74 } while (!(sigset
& SIGBREAKF_CTRL_C
));
76 RemIntServer(INTB_VERTB
, &base
->eventInt
);