Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. /*
  2. * hello-1.2/Makefile
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 1995, 1997 by Ralf Baechle
  9. */
  10. #include <regdef.h>
  11. #include <sys/asm.h>
  12. #include <sys/syscall.h>
  13.  
  14. #define O_RDWR 02
  15.  
  16. EXPORT(__start)
  17.  
  18.  
  19. .set noreorder
  20. LEAF(main)
  21.  
  22. # fd = open("/dev/tty1", O_RDWR, 0);
  23. la a0,tty
  24. li a1,O_RDWR
  25. li a2,0
  26. li v0,SYS_open
  27. syscall
  28.  
  29. bnez a3,quit
  30. move s0,v0 # delay slot
  31.  
  32. # write(fd, "hello, world.n", 14);
  33. move a0,s0
  34. la a1,hello
  35. li a2,14
  36. li v0,SYS_write
  37. syscall
  38.  
  39. # close(fd);
  40. move a0,s0
  41. li v0,SYS_close
  42. syscall
  43.  
  44. quit:
  45. li a0,0
  46. li v0,SYS_exit
  47. syscall
  48.  
  49. j quit
  50. nop
  51.  
  52. END(main)
  53.  
  54. .data
  55. tty: .asciz "/dev/tty1"
  56. hello: .ascii "Hello, world.n"
  57.  
  58. #
  59. # hello-1.2/Makefile
  60. #
  61. # This file is subject to the terms and conditions of the GNU General Public
  62. # License. See the file COPYING in the main directory of this archive for more
  63. # details.
  64.  
  65. tool-prefix = mips-linux-gnu-
  66.  
  67. CC = $(tool-prefix)gcc -I /home/slobodan/rtl819x-toolchain/toolchain/rsdk-1.5.5-5281-EB-2.6.30-0.9.30.3-110714/include/sys/
  68. LD = $(tool-prefix)ld
  69. STRIP = $(tool-prefix)strip
  70.  
  71. CFLAGS = -G0 -mno-abicalls -fno-pic
  72. LDFLAGS = -N -s
  73.  
  74. all: hello
  75.  
  76. hello: hello.o
  77. $(LD) $(LDFLAGS) -o hello hello.o
  78.  
  79. hello.o: hello.S
  80. $(CC) $(CFLAGS) -c hello.S
  81.  
  82. clean:
  83. rm -f core a.out *.o *.s
  84.  
  85. distclean: clean
  86. rm -f hello
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement