Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 42 additions & 31 deletions src/libtools/myalign.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void myStackAlign(x64emu_t* emu, const char* fmt, uint64_t* st, uint64_t* mystac
++mystack;
++p;
break; // fetch an int in the stack....
case ' ': state=0; ++p; break;
case ' ': ++p; break;
default:
state=20; // other stuff, put an int...
}
Expand Down Expand Up @@ -234,7 +234,7 @@ void myStackAlignScanf(x64emu_t* emu, const char* fmt, uint64_t* st, uint64_t* m
case '#':
case '+':
case '-': ++p; break; // formating, ignored
case 'm': state = 0; ++p; break; // no argument
case 'm': ++p; break; // no argument
case 'n':
case 'p':
case 'S':
Expand Down Expand Up @@ -492,7 +492,7 @@ void myStackAlignScanfW(x64emu_t* emu, const char* fmt, uint64_t* st, uint64_t*
case '#':
case '+':
case '-': ++p; break; // formating, ignored
case 'm': state = 0; ++p; break; // no argument
case 'm': ++p; break; // no argument
case 'n':
case 'p':
case 'S':
Expand Down Expand Up @@ -746,7 +746,7 @@ void myStackAlignValist(x64emu_t* emu, const char* fmt, uint64_t* mystack, x64_v
++mystack;
++p;
break; // fetch an int in the stack....
case ' ': state=0; ++p; break;
case ' ': ++p; break;
default:
state=20; // other stuff, put an int...
}
Expand Down Expand Up @@ -906,7 +906,7 @@ void myStackAlignWValist(x64emu_t* emu, const char* fmt, uint64_t* mystack, x64_
++mystack;
++p;
break; // fetch an int in the stack....
case ' ': state=0; ++p; break;
case ' ': ++p; break;
default:
state=20; // other stuff, put an int...
}
Expand Down Expand Up @@ -1049,7 +1049,7 @@ void myStackAlignScanfValist(x64emu_t* emu, const char* fmt, uint64_t* mystack,
case '#':
case '+':
case '-': ++p; break; // formating, ignored
case 'm': state = 0; ++p; break; // no argument
case 'm': ++p; break; // no argument
case 'n':
case 'p':
case 'S':
Expand Down Expand Up @@ -1156,7 +1156,7 @@ void myStackAlignScanfWValist(x64emu_t* emu, const char* fmt, uint64_t* mystack,
case '.':
case '+':
case '-': ++p; break; // formating, ignored
case 'm': state = 0; ++p; break; // no argument
case 'm': ++p; break; // no argument
case 'n':
case 'p':
case 'S':
Expand Down Expand Up @@ -1213,7 +1213,7 @@ void myStackAlignGVariantNewVa(x64emu_t* emu, const char* fmt, uint64_t* scratch
const char *p = fmt;
int state = 0;
int inblocks = 0;
int tmp;
int tmp = 0;

do {
switch(state) {
Expand Down Expand Up @@ -1252,9 +1252,9 @@ void myStackAlignGVariantNewVa(x64emu_t* emu, const char* fmt, uint64_t* scratch
case '(': ++inblocks; break;
case '}':
case ')': --inblocks; break;
case 'a': state = 1; break; // GVariantBuilder* or GVariantIter**
case 'a': state = 1; tmp = 0; break; // GVariantBuilder* or GVariantIter**
case 'm': state = 2; break; // maybe types
case '@': state = 3; break; // GVariant* of type [type]
case '@': state = 3; tmp = 0; break; // GVariant* of type [type]
case '^': state = 4; break; // pointer value
case '&': break; // pointer: do nothing
}
Expand Down Expand Up @@ -1410,7 +1410,7 @@ void myStackAlignGVariantNew(x64emu_t* emu, const char* fmt, uint64_t* st, uint6
const char *p = fmt;
int state = 0;
int inblocks = 0;
int tmp;
int tmp = 0;
int xmm = R_EAX;

do {
Expand All @@ -1435,10 +1435,11 @@ void myStackAlignGVariantNew(x64emu_t* emu, const char* fmt, uint64_t* st, uint6
case 't': // guint64
if (pos < 6)
*mystack = emu->regs[regs_abi[pos++]].q[0];
else
else {
*mystack = *st;
++st;
}
++mystack;
++st;
break;
case 'd': // gdouble
if (xmm) {
Expand All @@ -1455,9 +1456,9 @@ void myStackAlignGVariantNew(x64emu_t* emu, const char* fmt, uint64_t* st, uint6
case '(': ++inblocks; break;
case '}':
case ')': --inblocks; break;
case 'a': state = 1; break; // GVariantBuilder* or GVariantIter**
case 'a': state = 1; tmp = 0; break; // GVariantBuilder* or GVariantIter**
case 'm': state = 2; break; // maybe types
case '@': state = 3; break; // GVariant* of type [type]
case '@': state = 3; tmp = 0; break; // GVariant* of type [type]
case '^': state = 4; break; // pointer value
case '&': break; // pointer: do nothing
}
Expand All @@ -1473,10 +1474,11 @@ void myStackAlignGVariantNew(x64emu_t* emu, const char* fmt, uint64_t* st, uint6
if (tmp == 0) {
if (pos < 6)
*mystack = emu->regs[regs_abi[pos++]].q[0];
else
else {
*mystack = *st;
++st;
}
++mystack;
++st;
state = 0;
}
break;
Expand All @@ -1499,10 +1501,11 @@ void myStackAlignGVariantNew(x64emu_t* emu, const char* fmt, uint64_t* st, uint6
// Add a gboolean or gboolean*, no char increment
if (pos < 6)
*mystack = emu->regs[regs_abi[pos++]].q[0];
else
else {
*mystack = *st;
++st;
}
++mystack;
++st;
--p;
state = 0;
break;
Expand All @@ -1525,10 +1528,11 @@ void myStackAlignGVariantNew(x64emu_t* emu, const char* fmt, uint64_t* st, uint6
default: // Default to add a gboolean & reinit state?
if (pos < 6)
*mystack = emu->regs[regs_abi[pos++]].q[0];
else
else {
*mystack = *st;
++st;
}
++mystack;
++st;
--p;
state = 0;
}
Expand All @@ -1552,10 +1556,11 @@ void myStackAlignGVariantNew(x64emu_t* emu, const char* fmt, uint64_t* st, uint6
if (tmp == 0) {
if (pos < 6)
*mystack = emu->regs[regs_abi[pos++]].q[0];
else
else {
*mystack = *st;
++st;
}
++mystack;
++st;
state = 0;
}
break;
Expand All @@ -1568,10 +1573,11 @@ void myStackAlignGVariantNew(x64emu_t* emu, const char* fmt, uint64_t* st, uint6
if ((*p == 's') || (*p == 'o') || (*p == 'y')) {
if (pos < 6)
*mystack = emu->regs[regs_abi[pos++]].q[0];
else
else {
*mystack = *st;
++st;
}
++mystack;
++st;
state = 0;
} else if (*p == '&') state = 6;
else if (*p == 'a') state = 7;
Expand All @@ -1581,10 +1587,11 @@ void myStackAlignGVariantNew(x64emu_t* emu, const char* fmt, uint64_t* st, uint6
if ((*p == 's') || (*p == 'o')) {
if (pos < 6)
*mystack = emu->regs[regs_abi[pos++]].q[0];
else
else {
*mystack = *st;
++st;
}
++mystack;
++st;
state = 0;
} else if (*p == 'a') state = 7;
else state = 0; //???
Expand All @@ -1593,10 +1600,11 @@ void myStackAlignGVariantNew(x64emu_t* emu, const char* fmt, uint64_t* st, uint6
if (*p == 'y') {
if (pos < 6)
*mystack = emu->regs[regs_abi[pos++]].q[0];
else
else {
*mystack = *st;
++st;
}
++mystack;
++st;
state = 0;
} else state = 0; //???
break;
Expand All @@ -1608,10 +1616,11 @@ void myStackAlignGVariantNew(x64emu_t* emu, const char* fmt, uint64_t* st, uint6
if (*p == 'y') {
if (pos < 6)
*mystack = emu->regs[regs_abi[pos++]].q[0];
else
else {
*mystack = *st;
++st;
}
++mystack;
++st;
state = 0;
} else state = 0; //???
break;
Expand Down Expand Up @@ -1743,6 +1752,7 @@ void del_xcb_connection(void* src)

void register_xcb_display(void* d, void* xcb)
{
if (!d) return;
for(int i=0; i<NXCB; ++i)
if(&x64_xcb_connects[i] == xcb) {
xcb_display[i] = d;
Expand All @@ -1752,6 +1762,7 @@ void register_xcb_display(void* d, void* xcb)

void unregister_xcb_display(void* d)
{
if (!d) return;
for(int i=0; i<NXCB; ++i)
if(xcb_display[i] == d) {
my_xcb_connects[i] = NULL;
Expand Down
14 changes: 7 additions & 7 deletions src/libtools/myalign32.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void myStackAlign32(const char* fmt, uint32_t* st, uint64_t* mystack)
case 's': state = 30; break; // pointers
case '$': ++p; break; // should issue a warning, it's not handled...
case '*': *(mystack++) = *(st++); ++p; break; // fetch an int in the stack....
case ' ': state=(state==1)?6:0; ++p; break;
case ' ': ++p; break;
default:
state=20; // other stuff, put an int...
}
Expand Down Expand Up @@ -216,7 +216,7 @@ size_t myStackAlignScanf32(const char* fmt, uint32_t* st, uint64_t* mystack, siz
case '+':
case '-': ++p; break; // formating, ignored
case '[': state += 60; ++p; break;
case 'm': state = 0; ++p; break; // no argument
case 'm': ++p; break; // no argument
case 'p': state = 30; break; // pointers
case 'S':
case 's': state = 50; break; // string
Expand Down Expand Up @@ -351,7 +351,7 @@ void myStackAlignScanf32_final(const char* fmt, uint32_t* st, uint64_t* mystack,
case '+':
case '-': ++p; break; // formating, ignored
case '[': state += 60; ++p; break;
case 'm': state = 0; ++p; break; // no argument
case 'm': ++p; break; // no argument
case 'p': state = 30; break; // pointers
case 'S':
case 's': state = 50; break; // strings
Expand Down Expand Up @@ -494,7 +494,7 @@ size_t myStackAlignScanfW32(const char* fmt, uint32_t* st, uint64_t* mystack, si
case '#':
case '+':
case '-': ++p; break; // formating, ignored
case 'm': state = 0; ++p; break; // no argument
case 'm': ++p; break; // no argument
case 'p': state = 30; break; // pointers
case 'S':
case 's': state = 50; break; // strings
Expand Down Expand Up @@ -619,9 +619,9 @@ void myStackAlignScanfW32_final(const char* fmt, uint32_t* st, uint64_t* mystack
case '9':
case '.':
case '#':
case '+':
case '+': state = 0;
case '-': ++p; break; // formating, ignored
case 'm': state = 0; ++p; break; // no argument
case 'm': ++p; break; // no argument
case 'p': state = 30; break; // pointers
case 'S':
case 's': state = 50; break; // string
Expand Down Expand Up @@ -757,7 +757,7 @@ void myStackAlignW32(const char* fmt, uint32_t* st, uint64_t* mystack)
case 's': state = 30; break; // pointers
case '$': ++p; break; // should issue a warning, it's not handled...
case '*': *(mystack++) = *(st++); ++p; break; // fetch an int in the stack....
case ' ': state=(state==1)?6:0; ++p; break;
case ' ': ++p; break;
default:
state=20; // other stuff, put an int...
}
Expand Down
Loading