@@ -57,8 +57,6 @@ char __isr_stack[SIGSTKSZ];
57
57
ucontext_t native_isr_context ;
58
58
ucontext_t * _native_cur_ctx , * _native_isr_ctx ;
59
59
60
- int * process_heap_address ;
61
-
62
60
volatile unsigned int _native_saved_eip ;
63
61
volatile int _native_sigpend ;
64
62
int _sig_pipefd [2 ];
@@ -318,32 +316,20 @@ void native_isr_entry(int sig, siginfo_t *info, void *context)
318
316
319
317
if (_native_in_syscall == 0 ) {
320
318
DEBUG ("\n\n\t\treturn to _native_sig_leave_tramp\n\n" );
321
- #ifdef __MACH__
319
+ /* disable interrupts in context */
322
320
isr_set_sigmask ((ucontext_t * )context );
323
321
_native_in_isr = 1 ;
322
+ #ifdef __MACH__
324
323
_native_saved_eip = ((ucontext_t * )context )-> uc_mcontext -> __ss .__eip ;
325
324
((ucontext_t * )context )-> uc_mcontext -> __ss .__eip = (unsigned int )& _native_sig_leave_tramp ;
326
325
#elif BSD
327
- _native_in_isr = 1 ;
328
326
_native_saved_eip = ((struct sigcontext * )context )-> sc_eip ;
329
327
((struct sigcontext * )context )-> sc_eip = (unsigned int )& _native_sig_leave_tramp ;
330
328
#else
331
- if (
332
- ((void * )(((ucontext_t * )context )-> uc_mcontext .gregs [REG_EIP ]))
333
- > ((void * )process_heap_address )
334
- ) {
335
- //printf("\n\033[36mEIP:\t%p\nHEAP:\t%p\nnot switching\n\n\033[0m", (void*)((ucontext_t *)context)->uc_mcontext.gregs[REG_EIP], (void*)process_heap_address);
336
- }
337
- else {
338
- /* disable interrupts in context */
339
- isr_set_sigmask ((ucontext_t * )context );
340
- _native_in_isr = 1 ;
341
- //printf("\n\033[31mEIP:\t%p\nHEAP:\t%p\ngo switching\n\n\033[0m", (void*)((ucontext_t *)context)->uc_mcontext.gregs[REG_EIP], (void*)process_heap_address);
342
- _native_saved_eip = ((ucontext_t * )context )-> uc_mcontext .gregs [REG_EIP ];
343
- ((ucontext_t * )context )-> uc_mcontext .gregs [REG_EIP ] = (unsigned int )& _native_sig_leave_tramp ;
344
- }
329
+ //printf("\n\033[31mEIP:\t%p\ngo switching\n\n\033[0m", (void*)((ucontext_t *)context)->uc_mcontext.gregs[REG_EIP]);
330
+ _native_saved_eip = ((ucontext_t * )context )-> uc_mcontext .gregs [REG_EIP ];
331
+ ((ucontext_t * )context )-> uc_mcontext .gregs [REG_EIP ] = (unsigned int )& _native_sig_leave_tramp ;
345
332
#endif
346
- // TODO: change sigmask?
347
333
}
348
334
else {
349
335
DEBUG ("\n\n\t\treturn to syscall\n\n" );
@@ -446,12 +432,6 @@ void native_interrupt_init(void)
446
432
struct sigaction sa ;
447
433
DEBUG ("XXX: native_interrupt_init()\n" );
448
434
449
- process_heap_address = malloc (sizeof (int ));
450
- if (process_heap_address == NULL ) {
451
- err (EXIT_FAILURE , "native_interrupt_init: malloc" );
452
- }
453
- free (process_heap_address );
454
-
455
435
VALGRIND_STACK_REGISTER (__isr_stack , __isr_stack + sizeof (__isr_stack ));
456
436
VALGRIND_DEBUG ("VALGRIND_STACK_REGISTER(%p, %p)\n" , __isr_stack , (void * )((int )__isr_stack + sizeof (__isr_stack )));
457
437
0 commit comments