- Timestamp:
- 2005-09-11T12:48:42Z (21 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8e3fb24c
- Parents:
- 8491c48
- Location:
- arch/mips
- Files:
-
- 2 added
- 12 edited
-
Makefile.inc (modified) (7 diffs)
-
_link.ld.in (modified) (2 diffs)
-
include/byteorder.h (modified) (2 diffs)
-
include/console.h (modified) (1 diff)
-
include/drivers/arc.h (added)
-
include/interrupt.h (modified) (1 diff)
-
include/types.h (modified) (1 diff)
-
src/asm.S (modified) (1 diff)
-
src/console.c (modified) (3 diffs)
-
src/drivers/arc.c (added)
-
src/exception.c (modified) (1 diff)
-
src/interrupt.c (modified) (4 diffs)
-
src/mips.c (modified) (4 diffs)
-
src/mm/tlb.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
arch/mips/Makefile.inc
r8491c48 r3156582 1 1 MIPS_TARGET=mipsel-linux-gnu 2 3 2 MIPS_CC_DIR=/usr/local/mipsel/bin 4 3 MIPS_BINUTILS_DIR=/usr/local/mipsel/bin … … 9 8 OBJDUMP=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-objdump 10 9 OBJCOPY=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-objcopy 11 BFD_NAME=elf32-tradlittlemips12 10 BFD_ARCH=mips 13 11 … … 15 13 CFLAGS=$(DEFS) -mno-abicalls -G 0 -nostdlib -fno-builtin -O2 -fno-zero-initialized-in-bss 16 14 LFLAGS=-M -N 15 BFD_ARCH=mips 17 16 18 # It seems that on big endian either GCC or the simulators 19 # have the swl/swr/lwl/lwr instructions wrong. Just for sure, 20 # disable it with -mmemcpy (force calling memcpy instead of inlining) 17 # GCC 4.0.1 compiled for mipsEL has problems compiling in 18 # BigEndian mode with the swl/swr/lwl/lwr instructions. 19 # We have to compile it with mips-sgi-irix5 to get it right. 20 ifeq (${MACHINE},indy) 21 MIPS_TARGET=mips-sgi-irix5 22 MIPS_CC_DIR=/usr/local/mips/bin 23 MIPS_BINUTILS_DIR=/usr/local/mips/bin 21 24 22 ifeq (${MACHINE},indy) 23 CFLAGS += -EB -mmemcpy -DBIG_ENDIAN -DHAVE_FPU -DFPU_LAZY -march=r4600 25 CFLAGS += -EB -DBIG_ENDIAN -DHAVE_FPU -DFPU_LAZY -march=r4600 24 26 BFD = ecoff-bigmips 25 27 KERNEL_LOAD_ADDRESS = 0x88002000 28 BFD_NAME=elf32-big 26 29 endif 27 30 … … 30 33 BFD = ecoff-littlemips 31 34 KERNEL_LOAD_ADDRESS = 0x80100000 35 BFD_NAME=elf32-little 32 36 endif 33 37 34 38 ifeq (${MACHINE},bgxemul) 35 CFLAGS += -EB -mmemcpy -DBIG_ENDIAN -DHAVE_FPU -DFPU_LAZY -mips3 39 MIPS_TARGET=mips-sgi-irix5 40 MIPS_CC_DIR=/usr/local/mips/bin 41 MIPS_BINUTILS_DIR=/usr/local/mips/bin 42 43 CFLAGS += -EB -DBIG_ENDIAN -DHAVE_FPU -DFPU_LAZY -mips3 36 44 BFD = ecoff-bigmips 37 45 KERNEL_LOAD_ADDRESS = 0x80100000 46 BFD_NAME=elf32-big 38 47 endif 39 48 … … 44 53 CFLAGS += -msoft-float -march=4kc 45 54 KERNEL_LOAD_ADDRESS = 0x80100000 55 BFD_NAME=elf32-little 46 56 endif 47 57 … … 52 62 CFLAGS += -msoft-float -mips3 53 63 KERNEL_LOAD_ADDRESS = 0x80100000 64 BFD_NAME=elf32-little 54 65 endif 55 66 … … 73 84 arch/mm/tlb.c \ 74 85 arch/fpu_context.c \ 75 arch/fmath.c 86 arch/fmath.c \ 87 arch/drivers/arc.c -
arch/mips/_link.ld.in
r8491c48 r3156582 34 34 *(.sdata); 35 35 *(.reginfo); 36 /* Unfortunately IRIX does not allow us 37 * to include this as a last section :-( 38 * BSS/SBSS addresses will be wrong */ 39 symbol_table = .; 40 *(symtab.*); 36 41 } 37 42 _gp = . + 0x8000; … … 47 52 } 48 53 49 mysymtab : {50 symbol_table = .;51 *(symtab.*); /* Symbol table, must be LAST symbol!*/52 }53 54 kdata_end = .; 54 55 -
arch/mips/include/byteorder.h
r8491c48 r3156582 32 32 /* MIPS is little-endian */ 33 33 #ifdef BIG_ENDIAN 34 static inline __u64 u64_le2host(__u64 n) 35 { 36 return ((n & 0xff) << 56) | 37 ((n & 0xff00) << 40) | 38 ((n & 0xff0000) << 24) | 39 ((n & 0xff000000LL) << 8) | 40 ((n & 0xff00000000LL) >>8) | 41 ((n & 0xff0000000000LL) >> 24) | 42 ((n & 0xff000000000000LL) >> 40) | 43 ((n & 0xff00000000000000LL) >> 56); 44 } 45 34 46 static inline __native native_le2host(__native n) 35 47 { … … 40 52 } 41 53 #else 42 # define native_le2host(n) n 54 # define native_le2host(n) (n) 55 # define u64_le2host(n) (n) 43 56 #endif 44 57 -
arch/mips/include/console.h
r8491c48 r3156582 39 39 void console_init(void); 40 40 41 extern int bios_write(int fd, const char *buf, int size, int *cnt);42 43 44 41 #endif -
arch/mips/include/interrupt.h
r8491c48 r3156582 30 30 #define __INTERRUPT_H__ 31 31 32 #include <arch/exception.h> 33 32 34 #define TIMER_INTERRUPT 7 33 35 34 extern void interrupt( void);36 extern void interrupt(struct exception_regdump *pstate); 35 37 36 38 #endif -
arch/mips/include/types.h
r8491c48 r3156582 33 33 34 34 typedef signed char __s8; 35 typedef unsigned char __u8; 35 36 36 typedef unsigned char __u8;37 typedef signed short __s16; 37 38 typedef unsigned short __u16; 39 38 40 typedef unsigned long __u32; 39 typedef long long __u64; 41 typedef signed long __s32; 42 43 typedef unsigned long long __u64; 44 typedef signed long long __s64; 40 45 41 46 typedef __u32 __address; -
arch/mips/src/asm.S
r8491c48 r3156582 118 118 119 119 120 .global bios_write121 bios_write:122 lw $2, 0x80001020123 lw $2, 0x6c($2)124 j $2125 nop126 127 120 .global cpu_halt 128 121 cpu_halt: -
arch/mips/src/console.c
r8491c48 r3156582 32 32 #include <arch/console.h> 33 33 #include <arch.h> 34 #include <arch/drivers/arc.h> 35 #include <arch/arch.h> 34 36 35 static void arc_putchar(const char ch) 36 { 37 int cnt; 38 pri_t pri; 39 40 /* TODO: Should be spinlock? */ 41 pri = cpu_priority_high(); 42 bios_write(1, &ch, 1, &cnt); 43 cpu_priority_restore(pri); 44 45 } 46 37 /** Putchar that works with MSIM & gxemul */ 47 38 static void cons_putchar(const char ch) 48 39 { … … 50 41 } 51 42 52 43 /** Putchar that works with simics */ 53 44 static void serial_putchar(const char ch) 54 45 { … … 68 59 void console_init(void) 69 60 { 61 if (arc_enabled()) 62 putchar_func = arc_putchar; 70 63 /* The LSR on the start usually contains this value */ 71 if (*SERIAL_LSR == 0x60)64 else if (*SERIAL_LSR == 0x60) 72 65 putchar_func = serial_putchar; 73 66 else -
arch/mips/src/exception.c
r8491c48 r3156582 66 66 switch (excno) { 67 67 case EXC_Int: 68 interrupt( );68 interrupt(pstate); 69 69 break; 70 70 case EXC_TLBL: -
arch/mips/src/interrupt.c
r8491c48 r3156582 33 33 #include <time/clock.h> 34 34 #include <panic.h> 35 #include <print.h> 36 #include <symtab.h> 37 #include <arch/drivers/arc.h> 38 39 static void print_regdump(struct exception_regdump *pstate) 40 { 41 char *pcsymbol = ""; 42 char *rasymbol = ""; 43 44 char *s = get_symtab_entry(pstate->epc); 45 if (s) 46 pcsymbol = s; 47 s = get_symtab_entry(pstate->ra); 48 if (s) 49 rasymbol = s; 50 51 printf("PC: %X(%s) RA: %X(%s)\n",pstate->epc,pcsymbol, 52 pstate->ra,rasymbol); 53 } 35 54 36 55 pri_t cpu_priority_high(void) … … 58 77 } 59 78 60 void interrupt( void)79 void interrupt(struct exception_regdump *pstate) 61 80 { 62 81 __u32 cause; … … 70 89 switch (i) { 71 90 case 0: /* SW0 - Software interrupt 0 */ 72 cp0_cause_write(c ause& ~(1 << 8)); /* clear SW0 interrupt */91 cp0_cause_write(cp0_cause_read() & ~(1 << 8)); /* clear SW0 interrupt */ 73 92 break; 74 93 case 1: /* SW1 - Software interrupt 1 */ 75 cp0_cause_write(c ause& ~(1 << 9)); /* clear SW1 interrupt */94 cp0_cause_write(cp0_cause_read() & ~(1 << 9)); /* clear SW1 interrupt */ 76 95 break; 77 96 case 2: /* IRQ0 */ … … 80 99 case 5: /* IRQ3 */ 81 100 case 6: /* IRQ4 */ 101 print_regdump(pstate); 82 102 panic("unhandled interrupt %d\n", i); 83 103 break; -
arch/mips/src/mips.c
r8491c48 r3156582 37 37 #include <memstr.h> 38 38 #include <arch/interrupt.h> 39 #include <arch/drivers/arc.h> 39 40 40 41 #include <print.h> … … 53 54 /* It is not assumed by default */ 54 55 cpu_priority_high(); 56 57 init_arc(); 55 58 56 59 /* Copy the exception vectors to the right places */ … … 80 83 81 84 console_init(); 85 arc_print_memory_map(); 82 86 } 83 87 … … 111 115 supervisor_sp = (__address) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA]; 112 116 } 113 114 -
arch/mips/src/mm/tlb.c
r8491c48 r3156582 41 41 char *sym2 = ""; 42 42 43 if (THREAD) { 44 char *s = get_symtab_entry(pstate->epc); 45 if (s) 46 symbol = s; 47 s = get_symtab_entry(pstate->ra); 48 if (s) 49 sym2 = s; 50 } 43 char *s = get_symtab_entry(pstate->epc); 44 if (s) 45 symbol = s; 46 s = get_symtab_entry(pstate->ra); 47 if (s) 48 sym2 = s; 51 49 panic("%X: tlb_refill exception at %X(%s<-%s)\n", cp0_badvaddr_read(), 52 50 pstate->epc, symbol,sym2); … … 57 55 char *symbol = ""; 58 56 59 if (THREAD) { 60 char *s = get_symtab_entry(pstate->epc); 61 if (s) 62 symbol = s; 63 } 57 char *s = get_symtab_entry(pstate->epc); 58 if (s) 59 symbol = s; 64 60 panic("%X: TLB exception at %X(%s)\n", cp0_badvaddr_read(), 65 61 pstate->epc, symbol);
Note:
See TracChangeset
for help on using the changeset viewer.
