Changeset cc4c1fe4 in rtems
- Timestamp:
- 04/22/96 16:44:54 (27 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- a155b3c
- Parents:
- 96981e3a
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/score/cpu/unix/cpu.c
r96981e3a rcc4c1fe4 47 47 #include <sys/shm.h> 48 48 #include <sys/sem.h> 49 #include <string.h> /* memset */ 49 50 50 51 #ifndef SA_RESTART … … 181 182 * HACK - set the _SYSTEM_ID to 0x20c so that setjmp/longjmp 182 183 * will handle the full 32 floating point registers. 183 *184 * NOTE: Is this a bug in HPUX9?185 184 */ 186 185 … … 195 194 * get default values to use in _CPU_Context_Initialize() 196 195 */ 196 197 198 (void) memset( 199 &_CPU_Context_Default_with_ISRs_enabled, 200 0, 201 sizeof(Context_Control) 202 ); 203 (void) memset( 204 &_CPU_Context_Default_with_ISRs_disabled, 205 0, 206 sizeof(Context_Control) 207 ); 197 208 198 209 _CPU_ISR_Set_level( 0 ); … … 383 394 */ 384 395 385 _stack_low = ( (unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT);396 _stack_low = (unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT - 1; 386 397 _stack_low &= ~(CPU_STACK_ALIGNMENT - 1); 387 398 388 _stack_high = ( (unsigned32)(_stack_base) + _size);399 _stack_high = (unsigned32)(_stack_base) + _size; 389 400 _stack_high &= ~(CPU_STACK_ALIGNMENT - 1); 390 401 391 _the_size = _size & ~(CPU_STACK_ALIGNMENT - 1); 402 if (_stack_high > _stack_low) 403 _the_size = _stack_high - _stack_low; 404 else 405 _the_size = _stack_low - _stack_high; 392 406 393 407 /* … … 400 414 source = &_CPU_Context_Default_with_ISRs_disabled; 401 415 402 memcpy(_the_context, source, sizeof(Context_Control) ); /* sizeof(jmp_buf)); */ 416 memcpy( 417 _the_context, 418 source, 419 sizeof(Context_Control) /* sizeof(jmp_buf)); */ 420 ); 403 421 404 422 addr = (unsigned32 *)_the_context; … … 412 430 * bit 30 in 24 off of newp. If bit 30 is set then 413 431 * we are using shared libraries and the jump address 414 * is at what 24 off of newp points to so shove that 415 * into 24 off of newp instead. 432 * points to the pointer, so we put that into rp instead. 416 433 */ 417 434 418 435 if (jmp_addr & 0x40000000) { 419 436 jmp_addr &= 0xfffffffc; 420 *(addr + RP_OFF) = (unsigned32)*(unsigned32 *)jmp_addr;437 *(addr + RP_OFF) = *(unsigned32 *)jmp_addr; 421 438 } 422 439 #elif defined(sparc) … … 651 668 default: 652 669 { 653 /* 654 * We avoid using the stdio section of the library. 655 * The following is generally safe. 656 */ 657 658 buffer[ 0 ] = (sig_num >> 4) + 0x30; 659 buffer[ 1 ] = (sig_num & 0xf) + 0x30; 660 buffer[ 2 ] = '\n'; 661 662 write( 2, "Stray signal 0x", 12 ); 663 write( 2, buffer, 3 ); 670 /* 671 * We avoid using the stdio section of the library. 672 * The following is generally safe 673 */ 674 675 int digit; 676 int number = sig_num; 677 int len = 0; 678 679 digit = number / 100; 680 number %= 100; 681 if (digit) buffer[len++] = '0' + digit; 682 683 digit = number / 10; 684 number %= 10; 685 if (digit || len) buffer[len++] = '0' + digit; 686 687 digit = number; 688 buffer[len++] = '0' + digit; 689 690 buffer[ len++ ] = '\n'; 691 692 write( 2, "Stray signal ", 13 ); 693 write( 2, buffer, len ); 694 664 695 } 665 696 } … … 683 714 case SIGSEGV: 684 715 case SIGTERM: 685 716 _CPU_Fatal_error(0x100 + sig_num); 686 717 } 687 718 } … … 742 773 */ 743 774 775 (void) memset(&act, 0, sizeof(act)); 744 776 act.sa_handler = SIG_IGN; 745 777 746 778 sigaction(SIGALRM, &act, 0); 747 779 748 new.it_value.tv_sec = 0; 749 new.it_value.tv_usec = 0; 750 780 (void) memset(&new, 0, sizeof(new)); 751 781 setitimer(ITIMER_REAL, &new, 0); 752 782 } -
c/src/exec/score/cpu/unix/cpu.h
r96981e3a rcc4c1fe4 442 442 * Doing it this way avoids conflicts between the native stuff and the 443 443 * RTEMS stuff. 444 */ 444 * 445 * NOTE: 446 * hpux9 setjmp is optimized for the case where the setjmp buffer 447 * is 8 byte aligned. In a RISC world, this seems likely to enable 448 * 8 byte copies, especially for the float registers. 449 * So we always align them on 8 byte boundaries. 450 */ 451 452 #ifdef __GNUC__ 453 #define CONTEXT_STRUCTURE_ALIGNMENT __attribute__ ((aligned (8))) 454 #else 455 #define CONTEXT_STRUCTURE_ALIGNMENT 456 #endif 457 445 458 typedef struct { 446 char Area[ CPU_CONTEXT_SIZE_IN_BYTES ] ;459 char Area[ CPU_CONTEXT_SIZE_IN_BYTES ] CONTEXT_STRUCTURE_ALIGNMENT; 447 460 } Context_Control; 448 461 … … 456 469 /* 457 470 * The following table contains the information required to configure 458 * the XXX processor specific parameters. 459 * 460 * NOTE: The interrupt_stack_size field is required if 461 * CPU_ALLOCATE_INTERRUPT_STACK is defined as TRUE. 462 * 463 * The pretasking_hook, predriver_hook, and postdriver_hook, 464 * and the do_zero_of_workspace fields are required on ALL CPUs. 471 * the UNIX Simulator specific parameters. 465 472 */ 466 473 … … 473 480 unsigned32 interrupt_stack_size; 474 481 unsigned32 extra_mpci_receive_server_stack; 482 void * (*stack_allocate_hook)( unsigned32 ); 483 void (*stack_free_hook)( void* ); 484 /* end of required fields */ 475 485 } rtems_cpu_table; 476 486 -
cpukit/score/cpu/unix/cpu.c
r96981e3a rcc4c1fe4 47 47 #include <sys/shm.h> 48 48 #include <sys/sem.h> 49 #include <string.h> /* memset */ 49 50 50 51 #ifndef SA_RESTART … … 181 182 * HACK - set the _SYSTEM_ID to 0x20c so that setjmp/longjmp 182 183 * will handle the full 32 floating point registers. 183 *184 * NOTE: Is this a bug in HPUX9?185 184 */ 186 185 … … 195 194 * get default values to use in _CPU_Context_Initialize() 196 195 */ 196 197 198 (void) memset( 199 &_CPU_Context_Default_with_ISRs_enabled, 200 0, 201 sizeof(Context_Control) 202 ); 203 (void) memset( 204 &_CPU_Context_Default_with_ISRs_disabled, 205 0, 206 sizeof(Context_Control) 207 ); 197 208 198 209 _CPU_ISR_Set_level( 0 ); … … 383 394 */ 384 395 385 _stack_low = ( (unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT);396 _stack_low = (unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT - 1; 386 397 _stack_low &= ~(CPU_STACK_ALIGNMENT - 1); 387 398 388 _stack_high = ( (unsigned32)(_stack_base) + _size);399 _stack_high = (unsigned32)(_stack_base) + _size; 389 400 _stack_high &= ~(CPU_STACK_ALIGNMENT - 1); 390 401 391 _the_size = _size & ~(CPU_STACK_ALIGNMENT - 1); 402 if (_stack_high > _stack_low) 403 _the_size = _stack_high - _stack_low; 404 else 405 _the_size = _stack_low - _stack_high; 392 406 393 407 /* … … 400 414 source = &_CPU_Context_Default_with_ISRs_disabled; 401 415 402 memcpy(_the_context, source, sizeof(Context_Control) ); /* sizeof(jmp_buf)); */ 416 memcpy( 417 _the_context, 418 source, 419 sizeof(Context_Control) /* sizeof(jmp_buf)); */ 420 ); 403 421 404 422 addr = (unsigned32 *)_the_context; … … 412 430 * bit 30 in 24 off of newp. If bit 30 is set then 413 431 * we are using shared libraries and the jump address 414 * is at what 24 off of newp points to so shove that 415 * into 24 off of newp instead. 432 * points to the pointer, so we put that into rp instead. 416 433 */ 417 434 418 435 if (jmp_addr & 0x40000000) { 419 436 jmp_addr &= 0xfffffffc; 420 *(addr + RP_OFF) = (unsigned32)*(unsigned32 *)jmp_addr;437 *(addr + RP_OFF) = *(unsigned32 *)jmp_addr; 421 438 } 422 439 #elif defined(sparc) … … 651 668 default: 652 669 { 653 /* 654 * We avoid using the stdio section of the library. 655 * The following is generally safe. 656 */ 657 658 buffer[ 0 ] = (sig_num >> 4) + 0x30; 659 buffer[ 1 ] = (sig_num & 0xf) + 0x30; 660 buffer[ 2 ] = '\n'; 661 662 write( 2, "Stray signal 0x", 12 ); 663 write( 2, buffer, 3 ); 670 /* 671 * We avoid using the stdio section of the library. 672 * The following is generally safe 673 */ 674 675 int digit; 676 int number = sig_num; 677 int len = 0; 678 679 digit = number / 100; 680 number %= 100; 681 if (digit) buffer[len++] = '0' + digit; 682 683 digit = number / 10; 684 number %= 10; 685 if (digit || len) buffer[len++] = '0' + digit; 686 687 digit = number; 688 buffer[len++] = '0' + digit; 689 690 buffer[ len++ ] = '\n'; 691 692 write( 2, "Stray signal ", 13 ); 693 write( 2, buffer, len ); 694 664 695 } 665 696 } … … 683 714 case SIGSEGV: 684 715 case SIGTERM: 685 716 _CPU_Fatal_error(0x100 + sig_num); 686 717 } 687 718 } … … 742 773 */ 743 774 775 (void) memset(&act, 0, sizeof(act)); 744 776 act.sa_handler = SIG_IGN; 745 777 746 778 sigaction(SIGALRM, &act, 0); 747 779 748 new.it_value.tv_sec = 0; 749 new.it_value.tv_usec = 0; 750 780 (void) memset(&new, 0, sizeof(new)); 751 781 setitimer(ITIMER_REAL, &new, 0); 752 782 }
Note: See TracChangeset
for help on using the changeset viewer.