Changeset de6b301 in mainline


Ignore:
Timestamp:
2006-03-12T18:27:33Z (19 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.

Files:
1 added
4 deleted
28 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    ra82500ce rde6b301  
    121121        generic/src/lib/memstr.c \
    122122        generic/src/lib/sort.c \
    123         generic/src/lib/elf32.c \
    124         generic/src/lib/elf64.c \
     123        generic/src/lib/elf.c \
    125124        generic/src/debug/print.c \
    126125        generic/src/debug/symtab.c \
  • 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
  • contrib/conf/msim.conf

    ra82500ce rde6b301  
    88add rwm mainmem         0x00100000      16M     load "kernel/kernel.bin"
    99add rom startmem        0x1fc00000      1k      load "kernel/load.bin"
    10 add rwm init            0x20000000      1M      load "uspace/init/init"
     10add rwm init            0x01000000      1M      load "uspace/init/init"
    1111
    1212add dprinter printer 0x10000000
  • contrib/conf/ski.conf

    ra82500ce rde6b301  
    11load HelenOS/boot/kernel.bin
    2 romload HelenOS/boot/init 0x400000
     2romload HelenOS/uspace/init/init 0x400000
  • contrib/conf/spmips.conf

    ra82500ce rde6b301  
    2323              (0x180003ff,      tty0,         0,            7,          1),
    2424              (0x1c000000,      hfs0,         0,            0,         16),
    25               (0x20000000,      initmem0,     0,            0,  0x20000))
     25              (0x01000000,      initmem0,     0,            0,  0x20000))
    2626}
    2727
  • generic/include/elf.h

    ra82500ce rde6b301  
    3131
    3232#include <arch/elf.h>
    33 
     33#include <arch/types.h>
     34#include <mm/as.h>
     35
     36/**
     37 * current ELF version
     38 */
     39#define EV_CURRENT      1
     40
     41/**
     42 * ELF types
     43 */
     44#define ET_NONE         0       /* No type */
     45#define ET_REL          1       /* Relocatable file */
     46#define ET_EXEC         2       /* Executable */
     47#define ET_DYN          3       /* Shared object */
     48#define ET_CORE         4       /* Core */
     49#define ET_LOPROC       0xff00  /* Processor specific */
     50#define ET_HIPROC       0xffff  /* Processor specific */
     51
     52/**
     53 * ELF machine types
     54 */
     55#define EM_NO           0       /* No machine */
     56#define EM_SPARC        2       /* SPARC */
     57#define EM_386          3       /* i386 */
     58#define EM_MIPS         8       /* MIPS RS3000 */
     59#define EM_MIPS_RS3_LE  10      /* MIPS RS3000 LE */
     60#define EM_PPC          20      /* PPC32 */
     61#define EM_PPC64        21      /* PPC64 */
     62#define EM_SPARCV9      43      /* SPARC64 */
     63#define EM_IA_64        50      /* IA-64 */
     64#define EM_X86_64       62      /* AMD64/EMT64 */
     65
     66/**
     67 * ELF identification indexes
     68 */
     69#define EI_MAG0         0
     70#define EI_MAG1         1
     71#define EI_MAG2         2
     72#define EI_MAG3         3
     73#define EI_CLASS        4               /* File class */
     74#define EI_DATA         5               /* Data encoding */
     75#define EI_VERSION      6               /* File version */
     76#define EI_OSABI        7
     77#define EI_ABIVERSION   8
     78#define EI_PAD          9               /* Start of padding bytes */
     79#define EI_NIDENT       16              /* ELF identification table size */
     80
     81/**
     82 * ELF magic number
     83 */
     84#define ELFMAG0         0x7f
     85#define ELFMAG1         'E'
     86#define ELFMAG2         'L'
     87#define ELFMAG3         'F'
     88
     89/**
     90 * ELF file classes
     91 */
     92#define ELFCLASSNONE    0
     93#define ELFCLASS32      1
     94#define ELFCLASS64      2
     95
     96/**
     97 * ELF data encoding types
     98 */
     99#define ELFDATANONE     0
     100#define ELFDATA2LSB     1               /* Least significant byte first (little endian) */
     101#define ELFDATA2MSB     2               /* Most signigicant byte first (big endian) */
     102
     103/**
     104 * ELF error return codes
     105 */
     106#define EE_OK                   0       /* No error */
     107#define EE_INVALID              1       /* Invalid ELF image */
     108#define EE_MEMORY               2       /* Cannot allocate address space */
     109#define EE_INCOMPATIBLE         3       /* ELF image is not compatible with current architecture */
     110#define EE_UNSUPPORTED          4       /* Non-supported ELF (e.g. dynamic ELFs) */
     111#define EE_IRRECOVERABLE        5
     112
     113/**
     114 * ELF section types
     115 */
     116#define SHT_NULL                0
     117#define SHT_PROGBITS            1
     118#define SHT_SYMTAB              2
     119#define SHT_STRTAB              3
     120#define SHT_RELA                4
     121#define SHT_HASH                5
     122#define SHT_DYNAMIC             6
     123#define SHT_NOTE                7
     124#define SHT_NOBITS              8
     125#define SHT_REL                 9
     126#define SHT_SHLIB               10
     127#define SHT_DYNSYM              11
     128#define SHT_LOOS                0x60000000
     129#define SHT_HIOS                0x6fffffff
     130#define SHT_LOPROC              0x70000000
     131#define SHT_HIPROC              0x7fffffff
     132#define SHT_LOUSER              0x80000000
     133#define SHT_HIUSER              0xffffffff
     134
     135/**
     136 * ELF section flags
     137 */
     138#define SHF_WRITE               0x1
     139#define SHF_ALLOC               0x2
     140#define SHF_EXECINSTR           0x4
     141#define SHF_MASKPROC            0xf0000000
     142
     143/**
     144 * Symbol binding
     145 */
     146#define STB_LOCAL               0
     147#define STB_GLOBAL              1
     148#define STB_WEAK                2
     149#define STB_LOPROC              13
     150#define STB_HIPROC              15
     151
     152/**
     153 * Symbol types
     154 */
     155#define STT_NOTYPE              0
     156#define STT_OBJECT              1
     157#define STT_FUNC                2
     158#define STT_SECTION             3
     159#define STT_FILE                4
     160#define STT_LOPROC              13
     161#define STT_HIPROC              15
     162
     163/**
     164 * Program segment types
     165 */
     166#define PT_NULL                 0
     167#define PT_LOAD                 1
     168#define PT_DYNAMIC              2
     169#define PT_INTERP               3
     170#define PT_NOTE                 4
     171#define PT_SHLIB                5
     172#define PT_PHDR                 6
     173#define PT_LOPROC               0x70000000
     174#define PT_HIPROC               0x7fffffff
     175
     176/**
     177 * Program segment attributes.
     178 */
     179#define PF_X    1
     180#define PF_W    2
     181#define PF_R    4
     182
     183/**
     184 * ELF data types
     185 *
     186 * These types are found to be identical in both 32-bit and 64-bit
     187 * ELF object file specifications. They are the only types used
     188 * in ELF header.
     189 */
     190typedef __u64 elf_xword;
     191typedef __s64 elf_sxword;
     192typedef __u32 elf_word;
     193typedef __s32 elf_sword;
     194typedef __u16 elf_half;
     195
     196/**
     197 * 32-bit ELF data types.
     198 *
     199 * These types are specific for 32-bit format.
     200 */
     201typedef __u32 elf32_addr;
     202typedef __u32 elf32_off;
     203
     204/**
     205 * 64-bit ELF data types.
     206 *
     207 * These types are specific for 64-bit format.
     208 */
     209typedef __u64 elf64_addr;
     210typedef __u64 elf64_off;
     211
     212/** ELF header */
     213struct elf32_header {
     214        __u8 e_ident[EI_NIDENT];
     215        elf_half e_type;
     216        elf_half e_machine;
     217        elf_word e_version;
     218        elf32_addr e_entry;
     219        elf32_off e_phoff;
     220        elf32_off e_shoff;
     221        elf_word e_flags;
     222        elf_half e_ehsize;
     223        elf_half e_phentsize;
     224        elf_half e_phnum;
     225        elf_half e_shentsize;
     226        elf_half e_shnum;
     227        elf_half e_shstrndx;
     228};
     229struct elf64_header {
     230        __u8 e_ident[EI_NIDENT];
     231        elf_half e_type;
     232        elf_half e_machine;
     233        elf_word e_version;
     234        elf64_addr e_entry;
     235        elf64_off e_phoff;
     236        elf64_off e_shoff;
     237        elf_word e_flags;
     238        elf_half e_ehsize;
     239        elf_half e_phentsize;
     240        elf_half e_phnum;
     241        elf_half e_shentsize;
     242        elf_half e_shnum;
     243        elf_half e_shstrndx;
     244};
     245
     246/*
     247 * ELF section header
     248 */
     249struct elf32_section_header {
     250        elf_word sh_name;
     251        elf_word sh_type;
     252        elf_word sh_flags;
     253        elf32_addr sh_addr;
     254        elf32_off sh_offset;
     255        elf_word sh_size;
     256        elf_word sh_link;
     257        elf_word sh_info;
     258        elf_word sh_addralign;
     259        elf_word sh_entsize;
     260};
     261struct elf64_section_header {
     262        elf_word sh_name;
     263        elf_word sh_type;
     264        elf_xword sh_flags;
     265        elf64_addr sh_addr;
     266        elf64_off sh_offset;
     267        elf_xword sh_size;
     268        elf_word sh_link;
     269        elf_word sh_info;
     270        elf_xword sh_addralign;
     271        elf_xword sh_entsize;
     272};
     273
     274/*
     275 * ELF symbol table entry
     276 */
     277struct elf32_symbol {
     278        elf_word st_name;
     279        elf32_addr st_value;
     280        elf_word st_size;
     281        __u8 st_info;
     282        __u8 st_other;
     283        elf_half st_shndx;
     284};
     285struct elf64_symbol {
     286        elf_word st_name;
     287        __u8 st_info;
     288        __u8 st_other;
     289        elf_half st_shndx;
     290        elf64_addr st_value;
     291        elf_xword st_size;
     292};
     293
     294/*
     295 * ELF program header entry
     296 */
     297struct elf32_ph_entry {
     298        elf_word p_type;
     299        elf32_off p_offset;
     300        elf32_addr p_vaddr;
     301        elf32_addr p_paddr;
     302        elf_word p_filesz;
     303        elf_word p_memsz;
     304        elf_word p_flags;
     305        elf_word p_align;
     306};
     307struct elf64_ph_entry {
     308        elf_word p_type;
     309        elf_word p_flags;
     310        elf64_off p_offset;
     311        elf64_addr p_vaddr;
     312        elf64_addr p_paddr;
     313        elf_xword p_filesz;
     314        elf_xword p_memsz;
     315        elf_xword p_align;
     316};
     317
     318#ifdef __32_BITS__
     319typedef struct elf32_header elf_header_t;
     320typedef struct elf32_section_header elf_section_header_t;
     321typedef struct elf32_symbol elf_symbol_t;
     322typedef struct elf32_ph_entry elf_ph_entry_t;
    34323#endif
     324#ifdef __64_BITS__
     325typedef struct elf64_header elf_header_t;
     326typedef struct elf64_section_header elf_section_header_t;
     327typedef struct elf64_symbol elf_symbol_t;
     328typedef struct elf64_ph_entry elf_ph_entry_t;
     329#endif
     330
     331extern int elf_load(elf_header_t *header, as_t * as);
     332extern char *elf_error(int rc);
     333
     334#endif
  • generic/include/userspace.h

    ra82500ce rde6b301  
    3030#define __USERSPACE_H__
    3131
    32 extern void userspace(void) __attribute__ ((noreturn)); /**< Switch to user-space (CPU user priviledge level) */
     32#include <arch/types.h>
     33
     34extern void userspace(__address entry) __attribute__ ((noreturn)); /**< Switch to user-space (CPU user priviledge level) */
    3335
    3436#endif
  • generic/src/main/kinit.c

    ra82500ce rde6b301  
    4747#include <interrupt.h>
    4848#include <console/kconsole.h>
     49#include <elf.h>
    4950
    5051#ifdef CONFIG_SMP
     
    7273        as_t *as;
    7374        as_area_t *a;
    74         __address frame;
    75         count_t frames;
    76         int i;
     75        int rc;
    7776        task_t *u;
    7877
     
    151150                if (!as)
    152151                        panic("as_create\n");
    153                 u = task_create(as);
    154                 if (!u)
    155                         panic("task_create\n");
    156                 t = thread_create(uinit, NULL, u, THREAD_USER_STACK);
    157                 if (!t)
    158                         panic("thread_create\n");
     152
     153                rc = elf_load((elf_header_t *) config.init_addr, as);
     154                if (rc != EE_OK) {
     155                        printf("elf_load failed: %s\n", elf_error(rc));
     156                } else {
     157                        u = task_create(as);
     158                        if (!u)
     159                                panic("task_create\n");
     160                        t = thread_create(uinit, (void *)((elf_header_t *) config.init_addr)->e_entry, u, THREAD_USER_STACK);
     161                        if (!t)
     162                                panic("thread_create\n");
    159163               
    160                 /*
    161                  * Create the text as_area and initialize its mapping.
    162                  */
    163                
    164                 frame = config.init_addr;
    165                 if (IS_KA(frame))
    166                         frame = KA2PA(frame);
     164                        /*
     165                         * Create the data as_area.
     166                         */
     167                        a = as_area_create(as, AS_AREA_STACK, 1, USTACK_ADDRESS);
     168                        if (!a)
     169                                panic("as_area_create: stack\n");
    167170
    168                 frames = SIZE2FRAMES(config.init_size);
    169                
    170                 a = as_area_create(as, AS_AREA_TEXT, frames, UTEXT_ADDRESS);
    171                 if (!a)
    172                         panic("as_area_create: text\n");
    173 
    174                 for (i = 0; i < frames; i++)
    175                         as_set_mapping(as, UTEXT_ADDRESS + i * PAGE_SIZE, frame + i * FRAME_SIZE);
    176 
    177                 /*
    178                  * Create the data as_area.
    179                  */
    180                 a = as_area_create(as, AS_AREA_STACK, 1, USTACK_ADDRESS);
    181                 if (!a)
    182                         panic("as_area_create: stack\n");
    183 
    184                 thread_ready(t);
     171                        thread_ready(t);
     172                }
    185173        }
    186174
  • generic/src/main/uinit.c

    ra82500ce rde6b301  
    3333#include <print.h>
    3434
    35 
    3635void uinit(void *arg)
    3736{
    3837        printf("USER task, uinit thread: kernel mode\n");
    39         userspace();
     38        userspace((__address)(arg));
    4039}
Note: See TracChangeset for help on using the changeset viewer.