A shell that runs x86_64 assembly
c
x86-64
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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* Copyright Yann Weber <asmsh@yannweb.net>
  2. This file is part of asmsh.
  3. asmsh is free software: you can redistribute it and/or modify it under the
  4. terms of the GNU General Public License as published by the Free Software
  5. Foundation, either version 3 of the License, or any later version.
  6. asmsh is distributed in the hope that it will be useful, but WITHOUT ANY
  7. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  9. details.
  10. You should have received a copy of the GNU General Public License along
  11. with asmsh. If not, see <https://www.gnu.org/licenses/>.
  12. */
  13. #ifndef ASMSH_SHELL_ENV_H
  14. #define ASMSH_SHELL_ENV_H
  15. #include "config.h"
  16. #include <unistd.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19. #define ASMSH_VARNAME_MAX 256
  20. #define ASMSH_SYMALLOC 64
  21. /** The symbol prefixing a label */
  22. #define ASMSH_LABEL_SYM '@'
  23. typedef struct asmsh_sym_s asmsh_sym_t;
  24. typedef struct asmsh_symtable_s asmsh_symtable_t;
  25. struct asmsh_sym_s
  26. {
  27. char name[ASMSH_VARNAME_MAX + 1];
  28. unsigned long addr;
  29. };
  30. /** Stores the list of symbols associated with their address/value
  31. *
  32. * @note Symboles are ordered by name, ascending
  33. */
  34. struct asmsh_symtable_s
  35. {
  36. asmsh_sym_t *syms;
  37. size_t syms_sz;
  38. size_t alloc;
  39. };
  40. /** if freeval value given to add are freed on clean */
  41. int asmsh_symtable_init(asmsh_symtable_t *table);
  42. void asmsh_symtable_clean(asmsh_symtable_t *table);
  43. /**
  44. * @return 1 on update 0 on added -1 on error */
  45. int asmsh_symtable_add(asmsh_symtable_t *table, const char *name, unsigned long val);
  46. /**
  47. * @return 0 on deleted, 1 on not found, -1 on error */
  48. int asmsh_symtable_del(asmsh_symtable_t *table, const char *name);
  49. /**
  50. * @return NULL on error or not found else a ref */
  51. const asmsh_sym_t *asmsh_symtable_get(asmsh_symtable_t *table, const char *name);
  52. #include "shell.h"
  53. #endif