OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [tools/] [riscv-gnu-toolchain-master/] [newlib/] [libgloss/] [riscv/] [crt0.S] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 serginhofr
#=========================================================================
2
# crt0.S : Entry point for RISC-V user programs
3
#=========================================================================
4
 
5
  .text
6
  .global _start
7
_start:
8
  # Initialize global pointer
9
1:auipc gp, %pcrel_hi(_gp)
10
  addi  gp, gp, %pcrel_lo(1b)
11
 
12
# clear the bss segment
13
  la      t0, _fbss
14
  la      t1, _end
15
1:
16
#ifdef __riscv64
17
  sd      zero,0(t0)
18
  addi    t0, t0, 8
19
#else
20
  sw      zero,0(t0)
21
  addi    t0, t0, 4
22
#endif
23
  bltu    t0, t1, 1b
24
 
25
  la      a0, __libc_fini_array   # Register global termination functions
26
  call    atexit                  #  to be called upon exit
27
  call    __libc_init_array       # Run global initialization functions
28
 
29
  lw      a0, 0(sp)               # a0 = argc
30
  addi    a1, sp, _RISCV_SZPTR/8  # a1 = argv
31
  li      a2, 0                   # a2 = envp = NULL
32
  call    main
33
  tail    exit
34
 
35
  .global _init
36
  .global _fini
37
_init:
38
_fini:
39
  # These don't have to do anything since we use init_array/fini_array.
40
  ret

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.