Changeset 46c20c8 in mainline for boot/arch/mips32


Ignore:
Timestamp:
2010-11-26T20:08:10Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
45df59a
Parents:
fb150d78 (diff), ffdd2b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Location:
boot/arch/mips32
Files:
2 added
1 deleted
1 edited
13 moved

Legend:

Unmodified
Added
Removed
  • boot/arch/mips32/Makefile.inc

    rfb150d78 r46c20c8  
    2727#
    2828
    29 build: $(BASE)/image.boot
     29BFD_ARCH = mips
     30BITS = 32
     31PAGE_SIZE = 16384
     32EXTRA_CFLAGS = -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3
    3033
    31 $(BASE)/image.boot:
    32         $(MAKE) -C arch/$(BARCH)/loader PRECHECK=$(PRECHECK)
    33         cp arch/$(BARCH)/loader/image.boot $@
     34RD_SRVS_ESSENTIAL +=
    3435
    35 clean:
    36         $(MAKE) -C arch/$(BARCH)/loader clean
    37         rm -f $(BASE)/image.boot
     36RD_SRVS_NON_ESSENTIAL += \
     37        $(USPACE_PATH)/srv/bd/gxe_bd/gxe_bd
     38
     39ifeq ($(MACHINE),lgxemul)
     40        BFD_NAME = elf32-tradlittlemips
     41        BFD_OUTPUT = ecoff-littlemips
     42        ENDIANESS = LE
     43endif
     44ifeq ($(MACHINE),bgxemul)
     45        BFD_NAME = elf32-tradbigmips
     46        BFD_OUTPUT = ecoff-bigmips
     47        ENDIANESS = BE
     48endif
     49ifeq ($(MACHINE),msim)
     50        BFD_NAME = elf32-tradlittlemips
     51        BFD_OUTPUT = binary
     52        ENDIANESS = LE
     53        EXTRA_GCC_CFLAGS = -mhard-float
     54endif
     55
     56SOURCES = \
     57        arch/$(BARCH)/src/asm.S \
     58        arch/$(BARCH)/src/main.c \
     59        arch/$(BARCH)/src/putchar.c \
     60        $(COMPS_C) \
     61        genarch/src/division.c \
     62        genarch/src/multiplication.c \
     63        generic/src/memstr.c \
     64        generic/src/printf_core.c \
     65        generic/src/vprintf.c \
     66        generic/src/printf.c \
     67        generic/src/str.c \
     68        generic/src/version.c \
     69        generic/src/inflate.c
  • boot/arch/mips32/include/arch.h

    rfb150d78 r46c20c8  
    11/*
    22 * Copyright (c) 2006 Martin Decky
    3  * Copyright (c) 2006 Jakub Jermar
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30 #ifndef BOOT_sparc64_ASM_H_
    31 #define BOOT_sparc64_ASM_H_
    32 
    33 #include "types.h"
    34 #include "main.h"
     29#ifndef BOOT_mips32_ARCH_H_
     30#define BOOT_mips32_ARCH_H_
    3531
    3632#define PAGE_WIDTH  14
    3733#define PAGE_SIZE   (1 << PAGE_WIDTH)
    3834
    39 #define BALLOC_MAX_SIZE  (128 * 1024)
     35#define CPUMAP_OFFSET    0x00001000
     36#define STACK_OFFSET     0x00002000
     37#define BOOTINFO_OFFSET  0x00003000
     38#define BOOT_OFFSET      0x00100000
     39#define LOADER_OFFSET    0x1fc00000
    4040
    41 extern void halt(void);
    42 extern void jump_to_kernel(void *entry, uint64_t cfg, bootinfo_t *bootinfo,
    43     unsigned int bootinfo_size, uint8_t subarchitecture) __attribute__((noreturn));
     41#define MSIM_VIDEORAM_ADDRESS  0xb0000000
     42#define MSIM_DORDER_ADDRESS    0xb0000004
     43
     44#ifndef __ASM__
     45        #define PA2KA(addr)    (((uintptr_t) (addr)) + 0x80000000)
     46        #define KSEG2PA(addr)  (((uintptr_t) (addr)) - 0xa0000000)
     47#else
     48        #define PA2KA(addr)    ((addr) + 0x80000000)
     49        #define KSEG2PA(addr)  ((addr) - 0xa0000000)
     50#endif
    4451
    4552#endif
  • boot/arch/mips32/include/asm.h

    rfb150d78 r46c20c8  
    3030#define BOOT_mips32_ASM_H_
    3131
    32 #define PAGE_SIZE   16384
    33 #define PAGE_WIDTH  14
    34 
    35 void jump_to_kernel(void *entry, void *bootinfo) __attribute__((noreturn));
     32extern void jump_to_kernel(void *, void *) __attribute__((noreturn));
    3633
    3734#endif
  • boot/arch/mips32/include/main.h

    rfb150d78 r46c20c8  
    2727 */
    2828
    29 /** @addtogroup amd64debug
    30  * @{
    31  */
    32 /** @file
    33  */
     29#ifndef BOOT_mips32_MAIN_H_
     30#define BOOT_mips32_MAIN_H_
    3431
    35 #ifndef KERN_ia32_DEBUG_H_
    36 #define KERN_ia32_DEBUG_H_
    37 
    38 #include <arch/asm.h>
    39 
    40 #define HERE get_ip()
     32extern void bootstrap(void);
    4133
    4234#endif
    43 
    44 /** @}
    45  */
  • boot/arch/mips32/include/regname.h

    rfb150d78 r46c20c8  
    6363#define ra      31
    6464
    65 #define rindex          0
    66 #define rrandom         1
    67 #define entrylo0        2
    68 #define entrylo1        3
    69 #define context         4
    70 #define pagemask        5
    71 #define wired           6
    72 #define badvaddr        8
    73 #define count           9
    74 #define entryhi         10
    75 #define compare         11
    76 #define status          12
    77 #define cause           13
    78 #define epc             14
    79 #define rconfig         16
    80 #define lladdr          17
    81 #define watchlo         18
    82 #define watchhi         19
    83 #define xcontext        20
    84 #define rdebug          23
    85 #define depc            24
    86 #define eepc            30
     65#define rindex    0
     66#define rrandom   1
     67#define entrylo0  2
     68#define entrylo1  3
     69#define context   4
     70#define pagemask  5
     71#define wired     6
     72#define badvaddr  8
     73#define count     9
     74#define entryhi   10
     75#define compare   11
     76#define status    12
     77#define cause     13
     78#define epc       14
     79#define rconfig   16
     80#define lladdr    17
     81#define watchlo   18
     82#define watchhi   19
     83#define xcontext  20
     84#define rdebug    23
     85#define depc      24
     86#define eepc      30
    8787
    88 #endif /* _REGNAME_H_ */
     88#endif
  • boot/arch/mips32/include/types.h

    rfb150d78 r46c20c8  
    2727 */
    2828
     29#ifndef BOOT_mips32_TYPES_H_
     30#define BOOT_mips32_TYPES_H_
    2931
    30 /** @addtogroup arm32boot
    31  * @{
    32  */
    33 /** @file
    34  *  @brief Definitions of basic types like #uintptr_t.
    35  */
     32#define TASKMAP_MAX_RECORDS        32
     33#define CPUMAP_MAX_RECORDS         32
     34#define BOOTINFO_TASK_NAME_BUFLEN  32
    3635
     36typedef uint32_t size_t;
     37typedef uint32_t uintptr_t;
    3738
    38 #ifndef BOOT_arm32_TYPES_H
    39 #define BOOT_arm32_TYPES_H
     39typedef struct {
     40        /** Address where the task was placed. */
     41        void *addr;
     42        /** Size of the task's binary. */
     43        size_t size;
     44        /** Task name. */
     45        char name[BOOTINFO_TASK_NAME_BUFLEN];
     46} task_t;
    4047
    41 
    42 #include <gentypes.h>
    43 
    44 typedef signed char int8_t;
    45 
    46 typedef unsigned char uint8_t;
    47 typedef unsigned short uint16_t;
    48 typedef unsigned int uint32_t;
    49 typedef unsigned long long uint64_t;
    50 
    51 typedef uint32_t uintptr_t;
    52 typedef uint32_t unative_t;
    53 
     48typedef struct {
     49        uint32_t cpumap;
     50        size_t cnt;
     51        task_t tasks[TASKMAP_MAX_RECORDS];
     52} bootinfo_t;
    5453
    5554#endif
    56 
    57 
    58 /** @}
    59  */
  • boot/arch/mips32/src/asm.S

    rfb150d78 r46c20c8  
    2727#
    2828
    29 #include "regname.h"
     29#include <arch/arch.h>
     30#include <arch/regname.h>
    3031
    3132.set noat
     
    3334.set nomacro
    3435
     36.global start
     37.global halt
     38.global jump_to_kernel
     39
     40.section BOOTSTRAP
     41
     42start:
     43        /* Setup CPU map (on msim this code
     44           is executed in parallel on all CPUs,
     45           but it not an issue) */
     46        la $a0, PA2KA(CPUMAP_OFFSET)
     47       
     48        sw $zero, 0($a0)
     49        sw $zero, 4($a0)
     50        sw $zero, 8($a0)
     51        sw $zero, 12($a0)
     52       
     53        sw $zero, 16($a0)
     54        sw $zero, 20($a0)
     55        sw $zero, 24($a0)
     56        sw $zero, 28($a0)
     57       
     58        sw $zero, 32($a0)
     59        sw $zero, 36($a0)
     60        sw $zero, 40($a0)
     61        sw $zero, 44($a0)
     62       
     63        sw $zero, 48($a0)
     64        sw $zero, 52($a0)
     65        sw $zero, 56($a0)
     66        sw $zero, 60($a0)
     67       
     68        sw $zero, 64($a0)
     69        sw $zero, 68($a0)
     70        sw $zero, 72($a0)
     71        sw $zero, 76($a0)
     72       
     73        sw $zero, 80($a0)
     74        sw $zero, 84($a0)
     75        sw $zero, 88($a0)
     76        sw $zero, 92($a0)
     77       
     78        sw $zero, 96($a0)
     79        sw $zero, 100($a0)
     80        sw $zero, 104($a0)
     81        sw $zero, 108($a0)
     82       
     83        sw $zero, 112($a0)
     84        sw $zero, 116($a0)
     85        sw $zero, 120($a0)
     86        sw $zero, 124($a0)
     87       
     88        lui $a1, 1
     89       
     90#ifdef MACHINE_msim
     91       
     92        /* Read dorder value */
     93        la $k0, MSIM_DORDER_ADDRESS
     94        lw $k1, ($k0)
     95       
     96        /* If we are not running on BSP
     97           then end in an infinite loop  */
     98        beq $k1, $zero, bsp
     99        nop
     100       
     101        /* Record CPU presence */
     102        sll $a2, $k1, 2
     103        addu $a2, $a2, $a0
     104        sw $a1, ($a2)
     105       
     106        loop:
     107                j loop
     108                nop
     109       
     110#endif
     111       
     112        bsp:
     113                /* Record CPU presence */
     114                sw $a1, ($a0)
     115               
     116                /* Setup initial stack */
     117                la $sp, PA2KA(STACK_OFFSET)
     118               
     119                j bootstrap
     120                nop
     121
    35122.text
    36123
    37 .global halt
    38 .global memcpy
    39 .global jump_to_kernel
    40 
    41124halt:
    42         b halt
     125        j halt
    43126        nop
    44        
    45 memcpy:
    46         addiu   $v0,$a1,3
    47         li      $v1,-4                  # 0xfffffffffffffffc
    48         and     $v0,$v0,$v1
    49         beq     $a1,$v0,3f
    50         move    $t0,$a0
    51         move    $t2,$a0                 # save dst
    52 
    53 0:
    54         beq     $a2,$zero,2f
    55         move    $a3,$zero
    56 
    57 1:
    58         addu    $v0,$a1,$a3
    59         lbu     $a0,0($v0)
    60         addu    $v1,$t0,$a3
    61         addiu   $a3,$a3,1
    62         bne     $a3,$a2,1b
    63         sb      $a0,0($v1)
    64 
    65 2:
    66         jr      $ra
    67         move    $v0,$t2
    68 
    69 3:
    70         addiu   $v0,$a0,3
    71         and     $v0,$v0,$v1
    72         bne     $a0,$v0,0b
    73         srl     $t1,$a2,2
    74 
    75         beq     $t1,$zero,5f
    76         move    $a3,$zero
    77 
    78         move    $a3,$zero
    79         move    $a0,$zero
    80 4:
    81         addu    $v0,$a1,$a0
    82         lw      $v1,0($v0)
    83         addiu   $a3,$a3,1
    84         addu    $v0,$t0,$a0
    85         sw      $v1,0($v0)
    86         bne     $a3,$t1,4b
    87         addiu   $a0,$a0,4
    88 
    89 5:
    90         andi    $a2,$a2,0x3
    91         beq     $a2,$zero,2b
    92         nop
    93 
    94         sll     $v0,$a3,2
    95         addu    $t1,$v0,$t0
    96         move    $a3,$zero
    97         addu    $t0,$v0,$a1
    98 6:
    99         addu    $v0,$t0,$a3
    100         lbu     $a0,0($v0)
    101         addu    $v1,$t1,$a3
    102         addiu   $a3,$a3,1
    103         bne     $a3,$a2,6b
    104         sb      $a0,0($v1)
    105 
    106         jr      $ra
    107         move    $v0,$t2
    108127
    109128jump_to_kernel:
    110129        #
    111         # TODO
     130        # TODO:
    112131        # Make sure that the I-cache, D-cache and memory are mutually coherent
    113132        # before passing control to the copied code.
  • boot/arch/mips32/src/putchar.c

    rfb150d78 r46c20c8  
    11/*
    2  * Copyright (c) 2005 Jakub Vana
     2 * Copyright (c) 2006 Martin Decky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 #include <print.h>
    30 #include <debug.h>
     29#include <typedefs.h>
     30#include <arch/arch.h>
     31#include <putchar.h>
     32#include <str.h>
    3133
    32 #include <test.h>
    33 #include <sysinfo/sysinfo.h>
    34 
    35 char *test_sysinfo1(void)
     34void putchar(const wchar_t ch)
    3635{
    37         if (!test_quiet)
    38                 sysinfo_dump(NULL, 0);
    39         return NULL;
     36        if (ascii_check(ch))
     37                *((char *) MSIM_VIDEORAM_ADDRESS) = ch;
     38        else
     39                *((char *) MSIM_VIDEORAM_ADDRESS) = U_SPECIAL;
    4040}
Note: See TracChangeset for help on using the changeset viewer.