From 578603650c721811eb0a4747329e3854f171ce37 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 14 Oct 2015 01:26:25 +0300 Subject: [PATCH] some 64bit arg handling --- run_exp.sh | 3 ++- stdc.hlist | 4 ++++ stdc.list | 5 +++++ tools/translate.c | 13 +++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/run_exp.sh b/run_exp.sh index f90c7fe..319c2ab 100755 --- a/run_exp.sh +++ b/run_exp.sh @@ -5,7 +5,8 @@ # $2 - .in_c outf=$3 -grep '@' $1 | grep -v '\' | awk '{print $1}' > ${outf}_explist +grep '@' $1 | grep -v '\' | grep -v '=' | \ + awk '{print $1}' > ${outf}_explist echo ".text" > $outf echo ".align 4" >> $outf diff --git a/stdc.hlist b/stdc.hlist index cbc31f7..8440d6e 100644 --- a/stdc.hlist +++ b/stdc.hlist @@ -286,6 +286,10 @@ DECLSPEC_NORETURN void __cdecl _endthread (void); unsigned long __cdecl _beginthreadex (void *, unsigned int, unsigned int (__stdcall *) (void *), void*, unsigned int, unsigned int*); DECLSPEC_NORETURN void __cdecl _endthreadex (unsigned int); +__int64 __cdecl _atoi64(const char *); +char* __cdecl _i64toa(__int64, char *, int); +char* __cdecl _ui64toa(unsigned __int64, char *, int); + void __cdecl _lock(int locknum); void __cdecl _unlock(int locknum); size_t __cdecl strncnt(const char*, size_t); diff --git a/stdc.list b/stdc.list index 53d4e89..058a09e 100644 --- a/stdc.list +++ b/stdc.list @@ -48,6 +48,8 @@ __ismbcspace __mbsrchr _shortsort _qsort +_system +_bsearch __mbspbrk __mbsstr _localtime @@ -138,6 +140,9 @@ __beginthread __endthread __beginthreadex __endthreadex +__atoi64 +__i64toa +__ui64toa __lock __unlock __isctype diff --git a/tools/translate.c b/tools/translate.c index b57c812..673e4ba 100644 --- a/tools/translate.c +++ b/tools/translate.c @@ -7297,6 +7297,19 @@ static void gen_func(FILE *fout, FILE *fhdr, const char *funcn, int opcnt) if (tmp_op->operand[0].lmod == OPLM_QWORD) arg++; } + else if (pp->arg[arg].type.is_64bit) { + ferr_assert(po, tmp_op->p_argpass == 0); + ferr_assert(po, !pp->arg[arg].is_saved); + ferr_assert(po, cast[0] == 0); + out_src_opr(buf1, sizeof(buf1), + tmp_op, &tmp_op->operand[0], cast, 0); + tmp_op = pp->arg[++arg].datap; + ferr_assert(po, tmp_op != NULL); + out_src_opr(buf2, sizeof(buf2), + tmp_op, &tmp_op->operand[0], cast, 0); + fprintf(fout, "((u64)(%s) << 32) | (%s)", + buf2, buf1); + } else if (tmp_op->p_argpass != 0) { fprintf(fout, "a%d", tmp_op->p_argpass); } -- 2.39.5