diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2025-01-26 08:30:01 -0500 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2025-01-26 08:30:01 -0500 |
commit | 9307097160390b384907c193aca0d6703ab63516 (patch) | |
tree | 5fb1959c5a84bc71d1eca85f20a4c05dd76ee2d4 /foci.h | |
parent | 6aad3b0853ba82e6a6a6d5610d8311d132993c4b (diff) |
consting; arch choice; . hex [']
Diffstat (limited to 'foci.h')
-rw-r--r-- | foci.h | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -27,7 +27,7 @@ #define WORD(name, tname, prev, attr) \ extern const void *name##_body[]; \ - struct word_t w_##name = { \ + const struct word_t w_##name = { \ name##_body, prev, attr + sizeof(tname) - 1, tname \ }; \ const void *name##_body[] = { @@ -37,7 +37,7 @@ #define NATIVE(name, tname, prev, attr) \ extern const void *name##_body[]; \ NAKED void name(void); \ - struct word_t w_##name = { \ + const struct word_t w_##name = { \ name##_body, prev, \ (attr | ATTR_NATIVE) + sizeof(tname) - 1, tname \ }; \ @@ -54,19 +54,22 @@ struct word_t { const void **body; - struct word_t *prev; + const struct word_t *prev; unsigned char attr; char name[]; } __attribute__ ((packed)); +#ifdef FOCI_ARM // ARM Cortex-M: -//register intptr_t * sp asm("r0"); // pointer to stack cells -//register intptr_t *** rp asm("r1"); // stack of pp -//register intptr_t ** pp asm("r2"); // pointer to ip -//register intptr_t tmp asm("r8"); -//#define STASH asm("push {r0-r2,r8}") -//#define RESTORE asm("pop {r0-r2,r8}") +register intptr_t * sp asm("r0"); // pointer to stack cells +register intptr_t *** rp asm("r1"); // stack of pp +register intptr_t ** pp asm("r2"); // pointer to ip +register intptr_t tmp asm("r8"); +#define STASH asm("push {r0-r2,r8}") +#define RESTORE asm("pop {r0-r2,r8}") +#endif // FOCI_ARM +#ifdef FOCI_X86_64 // x86_64 register intptr_t * sp asm("r12"); // pointer to stack cells register intptr_t *** rp asm("r13"); // stack of pp @@ -74,6 +77,7 @@ register intptr_t ** pp asm("r14"); // pointer to ip register intptr_t tmp asm("r15"); #define STASH asm("push %r12; push %r13; push %r14") #define RESTORE asm("pop %r14; pop %r13; pop %r12") +#endif // FOCI_X86_64 extern void foci_putchar(int); extern int foci_getchar(void); |