Changeset 208b5f5 in mainline
- Timestamp:
- 2013-12-29T14:32:55Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4c14b88, 6fa9a99d, 9be30cdf, aacdb8e
- Parents:
- 2a13328
- Files:
-
- 13 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc32/src/ambapp.c
r2a13328 r208b5f5 110 110 amba_devices[0].device_id = GAISLER_APBUART; 111 111 amba_devices[0].version = 1; 112 amba_devices[0].irq = 2;112 amba_devices[0].irq = 3; 113 113 amba_devices[0].bars[0].start = 0x80000100; 114 114 amba_devices[0].bars[0].size = 0x100; -
boot/arch/sparc32/src/asm.S
r2a13328 r208b5f5 46 46 boot_pt: 47 47 .space PTL0_ENTRIES * PTL0_ENTRY_SIZE 48 48 49 boot_ctx_table: 49 50 .space 4 -
kernel/arch/sparc32/include/arch/asm.h
r2a13328 r208b5f5 161 161 pil = psr.pil; 162 162 163 psr.pil = 0x00; 164 psr_write(psr.value); 165 166 return pil; 167 } 168 169 NO_TRACE static inline ipl_t interrupts_disable(void) 170 { 171 psr_reg_t psr; 172 psr.value = psr_read(); 173 174 ipl_t pil; 175 pil = psr.pil; 176 163 177 psr.pil = 0x0f; 164 178 psr_write(psr.value); … … 167 181 } 168 182 169 NO_TRACE static inline ipl_t interrupts_disable(void)170 {171 psr_reg_t psr;172 psr.value = psr_read();173 174 ipl_t pil;175 pil = psr.pil;176 177 psr.pil = 0;178 psr_write(psr.value);179 180 return pil;181 }182 183 183 NO_TRACE static inline void interrupts_restore(ipl_t ipl) 184 184 { … … 200 200 psr_reg_t psr; 201 201 psr.value = psr_read(); 202 return psr.pil == 0;202 return (psr.pil == 0x0f); 203 203 } 204 204 -
kernel/arch/sparc32/include/arch/atomic.h
r2a13328 r208b5f5 37 37 38 38 #include <typedefs.h> 39 #include <arch/asm.h> 39 40 #include <arch/barrier.h> 40 41 #include <preemption.h> … … 47 48 REQUIRES(val->count < ATOMIC_COUNT_MAX) 48 49 { 49 // FIXME TODO 50 // FIXME: Isn't there any intrinsic atomic operation? 51 ipl_t ipl = interrupts_disable(); 50 52 val->count++; 53 interrupts_restore(ipl); 51 54 } 52 55 … … 56 59 REQUIRES(val->count > ATOMIC_COUNT_MIN) 57 60 { 58 // FIXME TODO 61 // FIXME: Isn't there any intrinsic atomic operation? 62 ipl_t ipl = interrupts_disable(); 59 63 val->count--; 64 interrupts_restore(ipl); 60 65 } 61 66 … … 65 70 REQUIRES(val->count < ATOMIC_COUNT_MAX) 66 71 { 67 // FIXME TODO72 // FIXME: Isn't there any intrinsic atomic operation? 68 73 74 ipl_t ipl = interrupts_disable(); 69 75 atomic_count_t prev = val->count; 70 76 71 77 val->count++; 78 interrupts_restore(ipl); 72 79 return prev; 73 80 } … … 78 85 REQUIRES(val->count > ATOMIC_COUNT_MIN) 79 86 { 80 // FIXME TODO87 // FIXME: Isn't there any intrinsic atomic operation? 81 88 89 ipl_t ipl = interrupts_disable(); 82 90 atomic_count_t prev = val->count; 83 91 84 92 val->count--; 93 interrupts_restore(ipl); 85 94 return prev; 86 95 } … … 93 102 REQUIRES_EXTENT_MUTABLE(val) 94 103 { 95 // FIXME TODO 104 atomic_count_t prev; 105 volatile uintptr_t ptr = (uintptr_t) &val->count; 96 106 97 atomic_count_t prev = val->count; 98 val->count = 1; 107 asm volatile ( 108 "ldstub [%[ptr]] %[prev]\n" 109 : [prev] "=r" (prev) 110 : [ptr] "r" (ptr) 111 : "memory" 112 ); 113 99 114 return prev; 100 115 } … … 104 119 REQUIRES_EXTENT_MUTABLE(val) 105 120 { 106 // FIXME TODO121 atomic_count_t tmp1 = 0; 107 122 108 do { 109 while (val->count); 110 } while (test_and_set(val)); 123 volatile uintptr_t ptr = (uintptr_t) &val->count; 124 125 preemption_disable(); 126 127 asm volatile ( 128 "0:\n" 129 "ldstub %0, %1\n" 130 "tst %1\n" 131 "be 2f\n" 132 "nop\n" 133 "1:\n" 134 "ldub %0, %1\n" 135 "tst %1\n" 136 "bne 1b\n" 137 "nop\n" 138 "ba,a 0b\n" 139 "2:\n" 140 : "+m" (*((atomic_count_t *) ptr)), 141 "+r" (tmp1) 142 : "r" (0) 143 ); 144 145 /* 146 * Prevent critical section code from bleeding out this way up. 147 */ 148 CS_ENTER_BARRIER(); 111 149 } 112 150 -
kernel/arch/sparc32/include/arch/barrier.h
r2a13328 r208b5f5 36 36 #define KERN_sparc32_BARRIER_H_ 37 37 38 // FIXME TODO 38 /* 39 * Provisions are made to prevent compiler from reordering instructions itself. 40 */ 39 41 40 #define CS_ENTER_BARRIER() 41 #define CS_LEAVE_BARRIER() 42 #define CS_ENTER_BARRIER() \ 43 asm volatile ( \ 44 "stbar\n" \ 45 ::: "memory" \ 46 ) 42 47 43 #define memory_barrier() 44 #define read_barrier() 45 #define write_barrier() 48 #define CS_LEAVE_BARRIER() \ 49 asm volatile ( \ 50 "stbar\n" \ 51 ::: "memory" \ 52 ) 53 54 #define memory_barrier() \ 55 asm volatile ( \ 56 "stbar\n" \ 57 ::: "memory" \ 58 ) 59 60 #define read_barrier() \ 61 asm volatile ( \ 62 "stbar\n" \ 63 ::: "memory" \ 64 ) 65 66 #define write_barrier() \ 67 asm volatile ( \ 68 "stbar\n" \ 69 ::: "memory" \ 70 ) 46 71 47 72 #define smc_coherence(addr) -
kernel/arch/sparc32/include/arch/mm/page.h
r2a13328 r208b5f5 71 71 /* Page table sizes for each level. */ 72 72 #define PTL0_FRAMES_ARCH 1 73 #define PTL1_FRAMES_ARCH 073 #define PTL1_FRAMES_ARCH 1 74 74 #define PTL2_FRAMES_ARCH 1 75 75 #define PTL3_FRAMES_ARCH 1 -
kernel/arch/sparc32/src/context.S
r2a13328 r208b5f5 51 51 subcc %g1, 1, %g1 52 52 bg 1b 53 54 save %sp, -64, %sp 53 save %sp, -64, %sp 55 54 56 55 mov 7, %g1 … … 58 57 subcc %g1, 1, %g1 59 58 bg 1b 60 61 restore 59 restore 62 60 63 61 CONTEXT_SAVE_ARCH_CORE %o0 … … 88 86 subcc %g1, 1, %g1 89 87 bg 1b 90 91 save %sp, -64, %sp 88 save %sp, -64, %sp 92 89 93 90 mov 7, %g1 … … 95 92 subcc %g1, 1, %g1 96 93 bg 1b 97 98 restore 94 restore 99 95 100 96 CONTEXT_RESTORE_ARCH_CORE %o0 -
kernel/arch/sparc32/src/debug/stacktrace.c
r2a13328 r208b5f5 65 65 bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev) 66 66 { 67 uint 64_t *stack = (void *) ctx->fp;67 uint32_t *stack = (void *) ctx->fp; 68 68 alloc_window_and_flush(); 69 69 *prev = stack[FRAME_OFFSET_FP_PREV]; … … 73 73 bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra) 74 74 { 75 uint 64_t *stack = (void *) ctx->fp;75 uint32_t *stack = (void *) ctx->fp; 76 76 alloc_window_and_flush(); 77 77 *ra = stack[FRAME_OFFSET_RA]; -
kernel/arch/sparc32/src/machine/leon3/leon3.c
r2a13328 r208b5f5 120 120 grlib_irqmp_clear(&machine.irqmp, irqnum); 121 121 122 irq_t *irq = irq_dispatch_and_lock( irqnum);122 irq_t *irq = irq_dispatch_and_lock(exc); 123 123 if (irq) { 124 124 irq->handler(irq); … … 140 140 static void leon3_input_init(void) 141 141 { 142 #if 0143 142 grlib_uart_t *scons_inst; 144 143 … … 158 157 } 159 158 } 160 #endif161 159 } 162 160 -
kernel/arch/sparc32/src/mm/tlb.c
r2a13328 r208b5f5 32 32 33 33 #include <mm/tlb.h> 34 #include <arch/arch.h> 34 35 #include <arch/mm/asid.h> 36 #include <arch/mm/as.h> 37 #include <arch/mm/page.h> 35 38 #include <arch/asm.h> 36 39 #include <typedefs.h> … … 38 41 void tlb_invalidate_all(void) 39 42 { 43 asi_u32_write(ASI_MMUCACHE, 0, 1); 44 asi_u32_write(ASI_MMUFLUSH, 0x400, 1); 40 45 } 41 46 -
kernel/arch/sparc32/src/sparc32.c
r2a13328 r208b5f5 55 55 char memcpy_from_uspace_failover_address; 56 56 char memcpy_to_uspace_failover_address; 57 57 58 static bootinfo_t machine_bootinfo; 58 59 … … 104 105 void arch_post_smp_init(void) 105 106 { 107 machine_input_init(); 106 108 } 107 109 -
kernel/arch/sparc32/src/trap_table.S
r2a13328 r208b5f5 165 165 save 166 166 167 ldd [%sp + 168 ldd [%sp + 167 ldd [%sp + 0], %l0 168 ldd [%sp + 8], %l2 169 169 ldd [%sp + 16], %l4 170 170 ldd [%sp + 24], %l6 … … 430 430 nop 431 431 432 433 432 1: 434 433 /* Rotate WIM on bit LEFT, we have 8 windows */ … … 442 441 mov %g0, %wim 443 442 nop; nop; nop 444 443 445 444 /* Kernel: */ 446 445 restore … … 563 562 mov %psr, %l0 564 563 or %l0, (1 << 5), %l0 564 or %l0, 0xf00, %l0 565 565 mov %l0, %psr 566 566 nop … … 568 568 nop 569 569 nop 570 571 /* Get UWB address */572 ## switch_to_invalid %g5, %g6573 ## mov %l6, %g1574 ## switch_back %g5, %g6575 570 576 571 /* Flush windows to stack */ … … 582 577 add %sp, 128, %o1 583 578 584 /* Return from handler */579 /* Return from handler (leave PIL disabled) */ 585 580 ld [%sp + 92], %l1 586 581 ld [%sp + 96], %l2 587 582 ld [%sp + 100], %l0 583 or %l0, 0xf00, %l0 588 584 mov %l0, %psr 589 585 nop … … 653 649 ld [%sp + 116], %g4 654 650 ld [%sp + 120], %g7 651 655 652 mov %l3, %sp 656 653 b 10f … … 659 656 9: 660 657 inline_restore_kernel 658 661 659 ld [%sp + 104], %g1 662 660 ld [%sp + 108], %g2 … … 664 662 ld [%sp + 116], %g4 665 663 ld [%sp + 120], %g7 664 665 /* Restore old sp */ 666 add %sp, 128, %sp 666 667 667 668 10: … … 716 717 switch_back %g5, %g6 717 718 mov %g7, %sp 718 ## mov %sp, %fp719 719 720 720 5: … … 733 733 st %l0, [%sp + 120] 734 734 735 /* Enable traps */735 /* Enable traps (without PIL) */ 736 736 mov %psr, %l0 737 737 or %l0, (1 << 5), %l0 738 or %l0, 0xf00, %l0 738 739 mov %l0, %psr 739 740 nop … … 747 748 748 749 /* Jump to actual subroutine */ 749 mov %g2, %o0750 750 call irq_exception 751 751 add %sp, 128, %o1 752 752 753 /* Return from handler */753 /* Return from handler (leave PIL disabled) */ 754 754 ld [%sp + 92], %l1 755 755 ld [%sp + 96], %l2 756 756 ld [%sp + 100], %l0 757 or %l0, 0xf00, %l0 757 758 mov %l0, %psr 758 759 nop … … 766 767 * and save uwb address for future use. 767 768 */ 768 if_from_kernel 6f769 if_from_kernel 9f 769 770 switch_to_invalid %g5, %g6 770 771 clr %l7 … … 797 798 ba 0b 798 799 nop 799 800 800 801 /* 801 802 * We've restored all user space windows. Now time to … … 815 816 switch_back %g5, %g6 816 817 817 /* If next window is invalid, do inline restore */ 818 6: 819 get_wim_number %g6 820 get_cwp %g7 821 inc %g7 822 and %g7, 0x7, %g7 823 cmp %g6, %g7 824 bne 8f 825 826 if_from_kernel 7f 827 828 inline_restore_uspace %g1 829 switch_to_invalid %g5, %g6 830 mov %g1, %l6 831 switch_back %g5, %g6 832 b 8f 833 nop 834 835 7: 836 inline_restore_kernel 837 838 8: 818 mov %sp, %l3 819 sub %g2, 128, %sp 839 820 ld [%sp + 104], %g1 840 821 ld [%sp + 108], %g2 … … 842 823 ld [%sp + 116], %g4 843 824 ld [%sp + 120], %g7 825 826 mov %l3, %sp 827 b 10f 828 nop 829 830 9: 831 inline_restore_kernel 832 833 ld [%sp + 104], %g1 834 ld [%sp + 108], %g2 835 ld [%sp + 112], %g3 836 ld [%sp + 116], %g4 837 ld [%sp + 120], %g7 838 839 /* Restore old sp */ 840 add %sp, 128, %sp 841 842 10: 844 843 jmp %l1 845 844 rett %l2 … … 892 891 switch_back %g5, %g6 893 892 mov %g7, %sp 894 ## 893 ## mov %sp, %fp 895 894 896 895 5: … … 909 908 st %l0, [%sp + 120] 910 909 911 /* Enable traps */910 /* Enable traps (without PIL) */ 912 911 mov %psr, %l0 913 912 or %l0, (1 << 5), %l0 913 or %l0, 0xf00, %l0 914 914 mov %l0, %psr 915 915 nop … … 933 933 mov %i5, %o5 934 934 935 /* Return from handler */935 /* Return from handler (with PIL disabled) */ 936 936 ld [%sp + 92], %l1 937 937 ld [%sp + 96], %l2 … … 940 940 mov %psr, %l1 941 941 and %l1, 0xf, %l1 942 or %l1, 0x00000f00, %l1 942 943 and %l0, 0xfffffff0, %l0 943 944 or %l0, %l1, %l0 … … 1009 1010 ld [%sp + 116], %g4 1010 1011 ld [%sp + 120], %g7 1012 1011 1013 mov %l1, %sp 1014 nop 1015 nop 1016 nop 1017 1012 1018 jmp %l2 1013 1019 rett %l2 + 4 … … 1035 1041 #define INTERRUPT(_vector, _priority) \ 1036 1042 .org trap_table + _vector * TRAP_ENTRY_SIZE; \ 1037 mov %psr, %l0 ; \ 1038 mov _priority, %g2 ; \ 1043 mov _priority, %o0 ; \ 1039 1044 b interrupt_trap ; \ 1045 nop ; 1040 1046 nop ; 1041 1047 -
kernel/genarch/src/drivers/grlib/irqmp.c
r2a13328 r208b5f5 44 44 PAGE_NOT_CACHEABLE); 45 45 46 /* Clear all pending interrupts */ 47 pio_write_32(&irqc->regs->clear, 0xffffffff); 48 46 49 /* Mask all interrupts */ 47 pio_write_32((void *) irqc->regs + GRLIB_IRQMP_MASK_OFFSET, 0 x8);50 pio_write_32((void *) irqc->regs + GRLIB_IRQMP_MASK_OFFSET, 0); 48 51 } 49 52 … … 62 65 void grlib_irqmp_clear(grlib_irqmp_t *irqc, unsigned int inum) 63 66 { 64 inum++;65 67 pio_write_32(&irqc->regs->clear, (1 << inum)); 66 68 } … … 71 73 GRLIB_IRQMP_MASK_OFFSET); 72 74 73 src++;74 75 mask &= ~(1 << src); 75 76 76 pio_write_32((void *) irqc->regs + GRLIB_IRQMP_MASK_OFFSET, mask); 77 77 } … … 82 82 GRLIB_IRQMP_MASK_OFFSET); 83 83 84 src++;85 84 mask |= (1 << src); 86 87 85 pio_write_32((void *) irqc->regs + GRLIB_IRQMP_MASK_OFFSET, mask); 88 86 } -
uspace/lib/c/arch/sparc32/include/libarch/tls.h
r2a13328 r208b5f5 47 47 static inline void __tcb_set(tcb_t *tcb) 48 48 { 49 asm volatile (49 asm volatile ( 50 50 "mov %0, %%g7\n" 51 51 :: "r" (tcb) … … 58 58 void *retval; 59 59 60 asm volatile (60 asm volatile ( 61 61 "mov %%g7, %0\n" 62 62 : "=r" (retval) -
uspace/lib/c/arch/sparc32/src/entry.s
r2a13328 r208b5f5 49 49 subcc %g1, 1, %g1 50 50 bg 1b 51 save %sp, -64, %sp51 save %sp, -64, %sp 52 52 53 53 mov 7, %g1
Note:
See TracChangeset
for help on using the changeset viewer.