riscv

an RV32I simulator and related experiments
git clone http://frotz.net/git/riscv.git
Log | Files | Refs | README

start.S (358B)


      1 
      2 #include "iocall.h"
      3 
      4 #define EXITI_0   .long 0x0000000b // _exiti 0
      5 #define IOCALL(n) .long 0x0000100b | ((n) << 20) // iocall n
      6 
      7 #define MKIOCALL(a,b) .globl a; a: IOCALL(IOCALL_##b); ret
      8 
      9 .globl _start
     10 _start:
     11 	jal main
     12 
     13 .globl exit
     14 exit:
     15 	EXITI_0
     16 
     17 MKIOCALL(dputc,DPUTC)
     18 MKIOCALL(open,OPEN)
     19 MKIOCALL(close,CLOSE)
     20 MKIOCALL(read,READ)
     21 MKIOCALL(write,WRITE)