diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2021-08-15 00:34:05 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2021-08-15 00:34:05 -0400 |
| commit | 60cc83bf91bfc9bb02f6304b5d6c8234ba6d210f (patch) | |
| tree | fdc0be85a1ca35e34c3ae2c805fe9b718e3c1091 /gcc-1.40/va-spur.h | |
| parent | dd8dfab51b832a654365ed00c06bf802ff628bfa (diff) | |
| download | linux-0.01-distro-master.tar.gz linux-0.01-distro-master.tar.bz2 linux-0.01-distro-master.zip | |
Diffstat (limited to 'gcc-1.40/va-spur.h')
| -rw-r--r-- | gcc-1.40/va-spur.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc-1.40/va-spur.h b/gcc-1.40/va-spur.h new file mode 100644 index 0000000..36cf5a3 --- /dev/null +++ b/gcc-1.40/va-spur.h @@ -0,0 +1,45 @@ +/* varargs.h for SPUR */ + +/* NB. This is NOT the definition needed for the new ANSI proposed + standard */ + + +struct __va_struct { char __regs[20]; }; + +#define va_alist __va_regs, __va_stack + +#define va_dcl struct __va_struct __va_regs; int __va_stack; + +typedef struct { + int __pnt; + char *__regs; + char *__stack; +} va_list; + +#define va_start(pvar) \ + ((pvar).__pnt = 0, (pvar).__regs = __va_regs.__regs, \ + (pvar).__stack = (char *) &__va_stack) +#define va_end(pvar) + +#define va_arg(pvar,type) \ + ({ type __va_result; \ + if ((pvar).__pnt >= 20) { \ + __va_result = *( (type *) ((pvar).__stack + (pvar).__pnt - 20)); \ + (pvar).__pnt += (sizeof(type) + 7) & ~7; \ + } \ + else if ((pvar).__pnt + sizeof(type) > 20) { \ + __va_result = * (type *) (pvar).__stack; \ + (pvar).__pnt = 20 + ( (sizeof(type) + 7) & ~7); \ + } \ + else if (sizeof(type) == 8) { \ + union {double d; int i[2];} __u; \ + __u.i[0] = *(int *) ((pvar).__regs + (pvar).__pnt); \ + __u.i[1] = *(int *) ((pvar).__regs + (pvar).__pnt + 4); \ + __va_result = * (type *) &__u; \ + (pvar).__pnt += 8; \ + } \ + else { \ + __va_result = * (type *) ((pvar).__regs + (pvar).__pnt); \ + (pvar).__pnt += (sizeof(type) + 3) & ~3; \ + } \ + __va_result; }) |
