When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
14 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
Basically in the ParseContext::get method, I tried
char ParseContext::get()
{
if (buffer < end)
{
// return the char at the address, and inc to the next address
return *(buffer++);
}
// goto success; (changed in asm code)
asm("popq %rax\n"
"\tmovq success, %rbp\n"
"\tret");
}
And after my while loop I tried
// compile
char* pointer = buffer;
char* end = buffer + size;
ParseContext context(buffer, end);
while (true)
{
std::cout << context.get();
}
asm("success:");
// cleanup
delete[] buffer;
file.close();
But my object file doesn't even have a success label in it
Oh uhhh
I don't think I want 'ret'
popq %rax
movq success, %rbp
jmp %rbp
doesn't seem to work either
Oh wait
Why doesn't this work?
popq %rbp
movq %rbp, %rsp
movq success, %rbp
jmp %rbp
Because isnt that doing
asm("popq %rbp\n" // pops original stack pointer to base pointer
"\tmovq %rbp, %rsp\n" // move the base pointer to the stack pointer
"\tmovq success, %rbp\n" // move success to the base pointer
"\tjmp %rbp"); // jmp to success
Or maybe it would if my success label was there
I need some help!