Changeset 24241cf in mainline


Ignore:
Timestamp:
2005-09-10T17:30:56Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1493d9
Parents:
9060bd1
Message:

Basic changes to boot it on SGI Indy.

Files:
16 edited

Legend:

Unmodified
Added
Removed
  • arch/mips/Makefile.inc

    r9060bd1 r24241cf  
    1212BFD_ARCH=mips
    1313
    14 ASFLAGS=-mips3
    15 
    16 DEFS=-DARCH=$(ARCH) -DMACHINE=${MACHINE}
    17 CFLAGS=$(DEFS) -mno-abicalls -mips3 -G 0 -nostdlib -fno-builtin -O2
    18 LFLAGS=-mips2 -M -no-check-sections
     14DEFS=-DARCH=$(ARCH) -DMACHINE=${MACHINE} -DKERNEL_LOAD_ADDRESS=${KERNEL_LOAD_ADDRESS}
     15CFLAGS=$(DEFS) -mno-abicalls -G 0 -nostdlib -fno-builtin -O2  -fno-zero-initialized-in-bss
     16LFLAGS=-M -N
    1917
    2018# It seems that on big endian either GCC or the simulators
     
    2321
    2422ifeq (${MACHINE},indy)
    25  CFLAGS += -EB -mmemcpy -DBIG_ENDIAN -DHAVE_FPU -DFPU_LAZY
    26  BFD = elf32-big
     23 CFLAGS += -EB -mmemcpy -DBIG_ENDIAN -DHAVE_FPU -DFPU_LAZY -march=r4600
     24 BFD = ecoff-bigmips
     25 KERNEL_LOAD_ADDRESS = 0x88002000
    2726endif
    2827
    2928ifeq (${MACHINE},lgxemul)
    30  CFLAGS += -DHAVE_FPU -DFPU_LAZY
     29 CFLAGS += -DHAVE_FPU -DFPU_LAZY -mips3
    3130 BFD = ecoff-littlemips
     31 KERNEL_LOAD_ADDRESS = 0x80010000
    3232endif
    3333
    3434ifeq (${MACHINE},bgxemul)
    35  CFLAGS += -EB -mmemcpy -DBIG_ENDIAN -DHAVE_FPU -DFPU_LAZY
     35 CFLAGS += -EB -mmemcpy -DBIG_ENDIAN -DHAVE_FPU -DFPU_LAZY -mips3
    3636 BFD = ecoff-bigmips
     37 KERNEL_LOAD_ADDRESS = 0x80010000
    3738endif
    3839
     40# MSIM needs lwl/swl patch & 4kc instruction patch to work
     41# otherwise add -mmemcpy -mips3
    3942ifeq (${MACHINE},msim)
    4043 BFD = binary
    41  CFLAGS += -msoft-float
     44 CFLAGS += -msoft-float -march=4kc
     45 KERNEL_LOAD_ADDRESS = 0x80010000
    4246endif
    4347
     48# SIMICS 4kc emulation is broken, although for instructions
     49# that do not bother us
    4450ifeq (${MACHINE},simics)
    4551 BFD = elf32-little
    46  CFLAGS += -msoft-float
     52 CFLAGS += -msoft-float -mips3
     53 KERNEL_LOAD_ADDRESS = 0x80010000
    4754endif
    4855
  • arch/mips/_link.ld.in

    r9060bd1 r24241cf  
    1616
    1717SECTIONS {
    18         . = 0x80100000;
     18        . = KERNEL_LOAD_ADDRESS;
    1919        .text : {
    2020                ktext_start = .;
     
    3030                LONG(kdata_end - kdata_start);
    3131                hardcoded_load_address = .;
    32                 LONG(0x80100000);
     32                LONG(KERNEL_LOAD_ADDRESS);
     33                *(.rodata*);
     34                *(.sdata);
     35                *(.reginfo);
    3336        }
    3437        _gp = . + 0x8000;
    3538        .lit8 : { *(.lit8) }
    3639        .lit4 : { *(.lit4) }
    37         .sdata : { *(.sdata) }
    3840        .sbss : {
    3941                *(.sbss);
     
    4446                *(COMMON);              /* global variables */
    4547        }
    46         mysymtable : {
     48
     49        mysymtab : {
    4750                symbol_table = .;
    48                 *(symtab.*);            /* Symbol table, must be LAST symbol!*/
     51                *(symtab.*);             /* Symbol table, must be LAST symbol!*/
    4952        }
    5053        kdata_end = .;
    5154
    52         .mdebug : { *(.mdebug) }
    53         .stab 0 : { *(.stab) }
    54         .stabstr 0 : { *(.stabstr) }
    55         .comment : { *(.comment) }
    56         .note : { *(.note) }
     55        /DISCARD/ : {
     56          *(.mdebug*);
     57          *(.pdr);
     58          *(.comment);
     59          *(.note);
     60        }
    5761}
  • arch/mips/boot/Makefile

    r9060bd1 r24241cf  
    1414
    1515ASFLAGS=-mips2 -I../../../include
    16 LFLAGS=--oformat=binary -mips2 -e start -T _link.ld
     16LFLAGS=--oformat=binary -e start -T _link.ld
    1717
    1818.S.o:
  • arch/mips/boot/boot.S

    r9060bd1 r24241cf  
    3434
    3535#include <arch/asm/boot.h>
     36
     37#ifndef KERNEL_LOAD_ADDRESS
     38# define KERNEL_LOAD_ADDRESS 0x80010000
     39#endif
    3640       
    3741.global start
  • arch/mips/include/asm/boot.h

    r9060bd1 r24241cf  
    3434#define TEMP_STACK_SIZE 0x100
    3535
    36 /* Kernel startup address */
    37 #define KERNEL_LOAD_ADDRESS 0x80100000
    38 
    39 
    4036#endif
  • arch/mips/include/console.h

    r9060bd1 r24241cf  
    3939void console_init(void);
    4040
     41extern int bios_write(int fd, const char *buf, int size, int *cnt);
     42
     43
    4144#endif
  • arch/mips/include/cp0.h

    r9060bd1 r24241cf  
    3939#define cp0_status_fpu_bit              (1<<29)
    4040
    41 #define cp0_status_im7_shift            15
     41#define cp0_status_im_shift             8
     42#define cp0_status_im_mask              0xff00
     43
    4244/*
    4345 * Magic value for use in msim.
     
    6466}
    6567
     68#define cp0_mask_all_int() cp0_status_write(cp0_status_read() & ~(cp0_status_im_mask))
     69#define cp0_unmask_all_int() cp0_status_write(cp0_status_read() | cp0_status_im_mask)
     70#define cp0_mask_int(it) cp0_status_write(cp0_status_read() & ~(1<<(cp0_status_im_shift+(it))))
     71#define cp0_unmask_int(it) cp0_status_write(cp0_status_read() | (1<<(cp0_status_im_shift+(it))))
    6672
    6773
  • arch/mips/include/interrupt.h

    r9060bd1 r24241cf  
    3030#define __INTERRUPT_H__
    3131
     32#define TIMER_INTERRUPT   7
     33
    3234extern void interrupt(void);
    3335
  • arch/mips/include/mm/memory_init.h

    r9060bd1 r24241cf  
    3333
    3434#define get_memory_size()       CONFIG_MEMORY_SIZE
     35//#define get_memory_size()     150*1024*1024
    3536
    3637#endif
  • arch/mips/src/asm.S

    r9060bd1 r24241cf  
    118118
    119119
     120.global bios_write
     121bios_write:
     122        lw      $2, 0x80001020
     123        lw      $2, 0x6c($2)
     124        j       $2
     125        nop
     126       
    120127.global cpu_halt
    121128cpu_halt:
  • arch/mips/src/console.c

    r9060bd1 r24241cf  
    3131#include <arch/cp0.h>
    3232#include <arch/console.h>
     33#include <arch.h>
     34
     35static 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}
    3346
    3447static void cons_putchar(const char ch)
  • arch/mips/src/cpu/cpu.c

    r9060bd1 r24241cf  
    7878        { "Sony", "R3000" },            /* 0x21 */
    7979        { "Toshiba", "R3000" },         /* 0x22 */
    80         { "NKK", "R3000" }              /* 0x23 */
     80        { "NKK", "R3000" },             /* 0x23 */
     81        { NULL, NULL }
    8182};
    8283
     
    8586        {"Invalid","Invalid"}, /* 0x81 */
    8687        {"Invalid","Invalid"}, /* 0x82 */
    87         {"MIPS","4Km & 4Kp"} /* 0x83 */
     88        {"MIPS","4Km & 4Kp"}, /* 0x83 */
     89        { NULL, NULL}
    8890};
    8991
     
    101103{
    102104        struct data_t *data;
     105        int i;
    103106
    104107        if (m->arch.imp_num & 0x80) {
     108                /* Count records */
     109                for (i=0;imp_data80[i].vendor;i++)
     110                        ;
     111                if (m->arch.imp_num & 0x7f >= i) {
     112                        printf("imp=%d\n",m->arch.imp_num);
     113                        return;
     114                }
    105115                data = &imp_data80[m->arch.imp_num & 0x7f];
    106         } else
     116        } else {
     117                for (i=0;imp_data[i].vendor;i++)
     118                        ;
     119                if (m->arch.imp_num >= i) {
     120                        printf("imp=%d\n",m->arch.imp_num);
     121                        return;
     122                }
    107123                data = &imp_data[m->arch.imp_num];
     124        }
    108125
    109126        printf("cpu%d: %s %s (rev=%d.%d, imp=%d)\n",
  • arch/mips/src/interrupt.c

    r9060bd1 r24241cf  
    8282                                        panic("unhandled interrupt %d\n", i);
    8383                                        break;
    84                                 case 7: /* Timer Interrupt */
    85                                         cp0_compare_write(cp0_count_read() + cp0_compare_value); /* clear timer interrupt */
    86                                         /* start counting over again */
     84                                case TIMER_INTERRUPT:
     85                                        /* clear timer interrupt & set new */
     86                                        cp0_compare_write(cp0_count_read() + cp0_compare_value);
    8787                                        clock();
    8888                                        break;
  • arch/mips/src/mips.c

    r9060bd1 r24241cf  
    3636#include <arch/console.h>
    3737#include <memstr.h>
     38#include <arch/interrupt.h>
    3839
    3940/* Size of the code jumping to the exception handler code
     
    4849#include <arch/debug.h>
    4950
     51#include <print.h>
    5052void arch_pre_mm_init(void)
    5153{
     54        /* It is not assumed by default */
     55        cpu_priority_high();
     56
    5257        /* Copy the exception vectors to the right places */
    5358        memcpy(TLB_EXC, (char *)tlb_refill_entry, EXCEPTION_JUMP_SIZE);
    5459        memcpy(NORM_EXC, (char *)exception_entry, EXCEPTION_JUMP_SIZE);
    5560        memcpy(CACHE_EXC, (char *)cache_error_entry, EXCEPTION_JUMP_SIZE);
    56 
    5761
    5862        /*
     
    6266        cp0_status_write(cp0_status_read() & ~(cp0_status_bev_bootstrap_bit|cp0_status_erl_error_bit));
    6367
     68        /*
     69         * Mask all interrupts
     70         */
     71        cp0_mask_all_int();
    6472        /*
    6573         * Unmask hardware clock interrupt.
    6674         */
    67         cp0_status_write(cp0_status_read() | (1<<cp0_status_im7_shift));
     75        cp0_unmask_int(TIMER_INTERRUPT);
    6876
    6977        /*
  • arch/mips/src/mm/frame.c

    r9060bd1 r24241cf  
    2929#include <arch/mm/frame.h>
    3030#include <mm/frame.h>
     31#include <arch/asm/boot.h>
     32#include <arch/mm/page.h>
    3133
    3234void frame_arch_init(void)
    3335{
    34         /* Disable first megabyte (God knows why) */
    35         frame_region_not_free(0, 1024*1024);
     36        /* Disable Everything until load address */
     37        frame_region_not_free(0, KA2PA(KERNEL_LOAD_ADDRESS));
    3638}
  • test/fpu/mips1/test.c

    r9060bd1 r24241cf  
    8787        for (i = 0; i<ATTEMPTS; i++) {
    8888                __asm__ volatile (
    89                         "ctc1 %0,$1"
     89                        "mtc1 %0,$1"
    9090                        :"=r"(arg)
    9191                        );
     
    9393                scheduler();
    9494                __asm__ volatile (
    95                         "cfc1 %0,$1"
     95                        "mfc1 %0,$1"
    9696                        :"=r"(after_arg)
    9797                        );
    9898               
    9999                if(arg != after_arg)
    100                         panic("Control reg tid%d: arg(%d) != %d\n",
     100                        panic("General reg tid%d: arg(%d) != %d\n",
    101101                              THREAD->tid, arg, after_arg);
    102102        }
Note: See TracChangeset for help on using the changeset viewer.