syscalls.c 894 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * syscalls.c
  3. *
  4. * Created on: Dec 14, 2014
  5. * Author: Mario Huettel <mario.huettel@gmx.net>
  6. */
  7. extern char __ld_sheap; // Defined by the linker
  8. extern char __ld_eheap;
  9. char* _sbrk(int incr) {
  10. static char *heap_end;
  11. char *prev_heap_end;
  12. if (heap_end == 0) {
  13. heap_end = &__ld_sheap;
  14. }
  15. prev_heap_end = heap_end;
  16. if (heap_end + incr > &__ld_eheap) {
  17. return 0;
  18. }
  19. heap_end += incr;
  20. return (char*) prev_heap_end;
  21. }
  22. int _isatty(int fd) {
  23. return 1;
  24. }
  25. int _close(int fd) {
  26. return 0;
  27. }
  28. int _open(int fd) {
  29. return 0;
  30. }
  31. int _fstat(void) {
  32. return 0;
  33. }
  34. int _lseek(void) {
  35. return 0;
  36. }
  37. int _read(void) {
  38. return 0;
  39. }
  40. int _write(int fd, const void *buf, int count) {
  41. //sendString((char*)buf, count);
  42. return count;
  43. }