Jehanne Operating System http://jehanne.h--k.it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.2 KiB

  1. /*
  2. * This file is part of Jehanne.
  3. *
  4. * Copyright (C) 2022 Giacomo Tesio <giacomo@tesio.it>
  5. *
  6. * Jehanne is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, version 3 of the License.
  9. *
  10. * Jehanne is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* automatically generated by /sys/src/kern/build/inith.rc.template */
  19. #! fn base10 {
  20. #! seq -f%0.0f $1 $1
  21. #! }
  22. #! CODE=`{$READELF -W -l init|grep LOAD|sed 's/R E/R_E/'|grep R_E}
  23. #! CODE_START=`{base10 $CODE(3)}
  24. int init_code_start = $CODE_START;
  25. int init_code_end = $CODE_START + $CODE(6);
  26. int init_code_len = $CODE(6);
  27. uint8_t init_code_out[] = {
  28. #! hexdump -s $CODE(2) -n $CODE(5) -v \
  29. #! -e '1/1 " 0x%02x, " 6/1 "0x%02x, " 1/1 " 0x%02x,\n"' \
  30. #! init | sed '$s/0x ,//g'
  31. };
  32. #! DATA=`{$READELF -W -l init|grep LOAD|grep RW}
  33. #! PAGE_SIZE=`{base10 $DATA(8)}
  34. #! DATA_START=`{base10 $DATA(3)}
  35. #! DATA_PAGE_START=`{echo $DATA_START d $PAGE_SIZE '%-p'|dc}
  36. #! DATA_FILE_START=`{base10 $DATA(2)}
  37. #! DATA_PADDING=`{echo $DATA_START $DATA_PAGE_START '-p'|dc}
  38. #! DATA_MEM_LENGTH=`{base10 $DATA(6)}
  39. #! DATA_MEM_LENGTH=`{echo $DATA_MEM_LENGTH $DATA_PADDING '+p'|dc}
  40. #! DATA_FILE_LENGTH=`{base10 $DATA(5)}
  41. #! TRAILING_ZEROS=`{echo `{base10 $DATA(6)} `{base10 $DATA(5)} '-p'|dc}
  42. int init_data_start = $DATA_PAGE_START;
  43. int init_data_end = $DATA_PAGE_START + $DATA_MEM_LENGTH;
  44. int init_data_len = $DATA_MEM_LENGTH;
  45. uint8_t init_data_out[] = {
  46. #! hexdump -n $DATA_PADDING -v \
  47. #! -e '1/1 " 0x%02x, " 6/1 "0x%02x, " 1/1 " 0x%02x,\n"' \
  48. #! /dev/zero | sed '$s/ 0x ,//g'
  49. #! hexdump -s $DATA_FILE_START -n $DATA_FILE_LENGTH -v \
  50. #! -e '1/1 " 0x%02x, " 6/1 "0x%02x, " 1/1 " 0x%02x,\n"' \
  51. #! init | sed '$s/ 0x ,//g'
  52. #! hexdump -n $TRAILING_ZEROS -v \
  53. #! -e '1/1 " 0x%02x, " 6/1 "0x%02x, " 1/1 " 0x%02x,\n"' \
  54. #! /dev/zero | sed '$s/ 0x ,//g'
  55. };