Changeset de6b301 in mainline for arch


Ignore:
Timestamp:
2006-03-12T18:27:33Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f972b89
Parents:
a82500ce
Message:

Basic support for loading ELF object files.
ia64, amd64, ia32 working.
mips32 requires some attention.

Location:
arch
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/Makefile.inc

    ra82500ce rde6b301  
    4444
    4545CFLAGS += -fno-unwind-tables -m64 -mcmodel=kernel -mno-red-zone
    46 DEFS += -D_CPU=${CPU}
     46DEFS += -D_CPU=${CPU} -D__64_BITS__
    4747
    4848## Accepted CPUs
  • arch/amd64/_link.ld.in

    ra82500ce rde6b301  
    5555       
    5656#ifdef CONFIG_SMP       
    57        
    5857        _hardcoded_unmapped_size = (unmapped_ktext_end - unmapped_ktext_start) + (unmapped_kdata_end - unmapped_kdata_start);
    5958        ap_boot = unmapped_ap_boot - BOOT_OFFSET + AP_BOOT_OFFSET;
  • arch/amd64/include/elf.h

    ra82500ce rde6b301  
    3030#define __amd64_ELF_H__
    3131
    32 #include <elf64.h>
    33 
    3432#define ELF_MACHINE             EM_X86_64
    3533#define ELF_DATA_ENCODING       ELFDATA2LSB
    3634#define ELF_CLASS               ELFCLASS64
    3735
    38 /*
    39  * Main ELF loader function
    40  */
    41 #define elf_load(header, as) elf64_load(header, as)
    42 
    4336#endif
  • arch/amd64/include/types.h

    ra82500ce rde6b301  
    3333
    3434typedef signed char __s8;
     35typedef signed short __s16;
     36typedef signed int __s32;
     37typedef signed long long __s64;
    3538
    3639typedef unsigned char __u8;
  • arch/amd64/src/userspace.c

    ra82500ce rde6b301  
    4040 *
    4141 */
    42 void userspace(void)
     42void userspace(__address entry)
    4343{
    4444        ipl_t ipl;
     
    6262                          "r" (ipl),
    6363                          "i" (gdtselector(UTEXT_DES) | PL_USER),
    64                           "i" (UTEXT_ADDRESS));
     64                          "r" (entry));
    6565       
    6666        /* Unreachable */
  • arch/ia32/Makefile.inc

    ra82500ce rde6b301  
    4343endif
    4444
    45 DEFS += -D_CPU=${IA32_CPU}
     45DEFS += -D_CPU=${IA32_CPU} -D__32_BITS__
    4646
    4747## Accepted CPUs
  • arch/ia32/include/elf.h

    ra82500ce rde6b301  
    3030#define __ia32_ELF_H__
    3131
    32 #include <elf32.h>
    33 
    3432#define ELF_MACHINE             EM_386
    3533#define ELF_DATA_ENCODING       ELFDATA2LSB
    3634#define ELF_CLASS               ELFCLASS32
    3735
    38 /*
    39  * Main ELF loader function
    40  */
    41 #define elf_load(header, as) elf32_load(header, as)
    42 
    4336#endif
  • arch/ia32/include/types.h

    ra82500ce rde6b301  
    3333
    3434typedef signed char __s8;
     35typedef signed short __s16;
     36typedef signed long __s32;
     37typedef signed long long __s64;
    3538
    3639typedef unsigned char __u8;
    3740typedef unsigned short __u16;
    3841typedef unsigned long __u32;
    39 typedef long long __u64;
     42typedef unsigned long long __u64;
    4043
    4144typedef __u32 __address;
  • arch/ia32/src/userspace.c

    ra82500ce rde6b301  
    4040 *
    4141 */
    42 void userspace(void)
     42void userspace(__address entry)
    4343{
    4444        ipl_t ipl;
     
    6161                "iret"
    6262                :
    63                 : "i" (selector(UDATA_DES) | PL_USER), "r" (USTACK_ADDRESS+(THREAD_STACK_SIZE)), "r" (ipl), "i" (selector(UTEXT_DES) | PL_USER), "i" (UTEXT_ADDRESS)
     63                : "i" (selector(UDATA_DES) | PL_USER), "r" (USTACK_ADDRESS+(THREAD_STACK_SIZE)), "r" (ipl), "i" (selector(UTEXT_DES) | PL_USER), "r" (entry)
    6464                : "eax");
    6565       
  • arch/ia64/Makefile.inc

    ra82500ce rde6b301  
    4646AFLAGS += -mconstant-gp
    4747
    48 DEFS += -DINIT_ADDRESS=$(INIT_ADDRESS) -DINIT_SIZE=$(INIT_SIZE)
     48DEFS += -D__64_BITS__ -DINIT_ADDRESS=$(INIT_ADDRESS) -DINIT_SIZE=$(INIT_SIZE)
    4949
    5050## Compile with page hash table support.
  • arch/ia64/include/elf.h

    ra82500ce rde6b301  
    3030#define __ia64_ELF_H__
    3131
    32 #include <elf64.h>
    33 
    3432#define ELF_MACHINE             EM_IA_64
    3533#define ELF_DATA_ENCODING       ELFDATA2LSB
    3634#define ELF_CLASS               ELFCLASS64
    3735
    38 /*
    39  * Main ELF loader function
    40  */
    41 #define elf_load(header, as) elf64_load(header, as)
    42 
    4336#endif
  • arch/ia64/src/ia64.c

    ra82500ce rde6b301  
    6767
    6868/** Enter userspace and never return. */
    69 void userspace(void)
     69void userspace(__address entry)
    7070{
    7171        psr_t psr;
     
    8484        rsc.mode = 3;                           /* eager mode */
    8585
    86         switch_to_userspace(UTEXT_ADDRESS, USTACK_ADDRESS+PAGE_SIZE-1, USTACK_ADDRESS, psr.value, rsc.value);
     86        switch_to_userspace(entry, USTACK_ADDRESS+PAGE_SIZE-1, USTACK_ADDRESS, psr.value, rsc.value);
    8787
    8888        while (1) {
  • arch/mips32/Makefile.inc

    ra82500ce rde6b301  
    4242
    4343KERNEL_LOAD_ADDRESS = 0x80100000
    44 INIT_ADDRESS = 0x20000000
     44INIT_ADDRESS = 0x81000000
    4545INIT_SIZE = 65536
    4646
    4747CFLAGS += -mno-abicalls -G 0 -fno-zero-initialized-in-bss
    4848
    49 DEFS += -DMACHINE=${MIPS_MACHINE} -DKERNEL_LOAD_ADDRESS=${KERNEL_LOAD_ADDRESS} -DINIT_ADDRESS=${INIT_ADDRESS} -DINIT_SIZE=${INIT_SIZE}
     49DEFS += -D__32_BITS__ -DMACHINE=${MIPS_MACHINE} -DKERNEL_LOAD_ADDRESS=${KERNEL_LOAD_ADDRESS} -DINIT_ADDRESS=${INIT_ADDRESS} -DINIT_SIZE=${INIT_SIZE}
    5050
    5151## Compile with hierarchical page tables support.
     
    8181        BFD = ecoff-littlemips
    8282        CFLAGS += -DARCH_HAS_FPU -mips3
    83         INIT_ADDRESS = 0x1800000
     83        INIT_ADDRESS = 0x81800000
    8484endif
    8585ifeq ($(MIPS_MACHINE),bgxemul)
     
    8989        TOOLCHAIN_DIR = /usr/local/mips/bin
    9090        CFLAGS += -EB -DBIG_ENDIAN -DARCH_HAS_FPU -mips3
    91         INIT_ADDRESS = 0x1800000
     91        INIT_ADDRESS = 0x81800000
    9292endif
    9393ifeq ($(MIPS_MACHINE),simics)
  • arch/mips32/include/elf.h

    ra82500ce rde6b301  
    2727 */
    2828
    29 #ifndef __ia32_ELF_H__
    30 #define __ia32_ELF_H__
    31 
    32 #include <elf32.h>
     29#ifndef __mips32_ELF_H__
     30#define __mips32_ELF_H__
    3331
    3432#define ELF_MACHINE             EM_MIPS
     
    3634#define ELF_CLASS               ELFCLASS32
    3735
    38 /*
    39  * Main ELF loader function
    40  */
    41 #define elf_load(header, as) elf32_load(header, as)
    42 
    4336#endif
  • arch/mips32/src/mips32.c

    ra82500ce rde6b301  
    119119__address supervisor_sp __attribute__ ((section (".text")));
    120120
    121 void userspace(void)
     121void userspace(__address entry)
    122122{
    123123        /* EXL=1, UM=1, IE=1 */
     
    125125                                              cp0_status_um_bit |
    126126                                              cp0_status_ie_enabled_bit));
    127         cp0_epc_write(UTEXT_ADDRESS);
     127        cp0_epc_write(entry);
    128128        userspace_asm(USTACK_ADDRESS+PAGE_SIZE);
    129129        while (1)
  • arch/ppc32/Makefile.inc

    ra82500ce rde6b301  
    4141LFLAGS += -no-check-sections -N
    4242
     43DEFS += -D__32_BITS__
     44
    4345## Own configuration directives
    4446#
  • arch/ppc32/include/elf.h

    ra82500ce rde6b301  
    2727 */
    2828
    29 #ifndef __ia32_ELF_H__
    30 #define __ia32_ELF_H__
    31 
    32 #include <elf32.h>
     29#ifndef __ppc32_ELF_H__
     30#define __ppc32_ELF_H__
    3331
    3432#define ELF_MACHINE             EM_PPC
     
    3634#define ELF_CLASS               ELFCLASS32
    3735
    38 /*
    39  * Main ELF loader function
    40  */
    41 #define elf_load(header, as) elf32_load(header, as)
    42 
    4336#endif
  • arch/ppc32/include/types.h

    ra82500ce rde6b301  
    3333
    3434typedef signed char __s8;
     35typedef signed short __s16;
     36typedef signed long __s32;
     37typedef signed long long __s64;
    3538
    3639typedef unsigned char __u8;
    3740typedef unsigned short __u16;
    3841typedef unsigned long __u32;
    39 typedef long long __u64;
     42typedef unsigned long long __u64;
    4043
    4144typedef __u32 __address;
  • arch/sparc64/Makefile.inc

    ra82500ce rde6b301  
    4141CFLAGS += -mcpu=ultrasparc -m64
    4242LFLAGS += -no-check-sections -N
     43
     44DEFS += -D__64_BITS__
    4345
    4446## Own configuration directives
  • arch/sparc64/include/elf.h

    ra82500ce rde6b301  
    2727 */
    2828
    29 #ifndef __ia64_ELF_H__
    30 #define __ia64_ELF_H__
    31 
    32 #include <elf64.h>
     29#ifndef __sparc64_ELF_H__
     30#define __sparc64_ELF_H__
    3331
    3432#define ELF_MACHINE             EM_SPARCV9
     
    3634#define ELF_CLASS               ELFCLASS64
    3735
    38 /*
    39  * Main ELF loader function
    40  */
    41 #define elf_load(header, as) elf64_load(header, as)
    42 
    4336#endif
Note: See TracChangeset for help on using the changeset viewer.