Skip to content

Commit

Permalink
fix stack alignment dynamically for OP_BLOCK_COPY
Browse files Browse the repository at this point in the history
  • Loading branch information
lnussel committed Jun 2, 2010
1 parent 2950bb9 commit 233fcb0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions code/qcommon/vm_x86_64.c
Expand Up @@ -757,13 +757,18 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
emit("push %%r8");
emit("push %%r9");
emit("push %%r10");
emit("push %%r10");
emit("movq %%rsp, %%rbx"); // we need to align the stack pointer
emit("subq $8, %%rbx"); // |
emit("andq $127, %%rbx"); // |
emit("subq %%rbx, %%rsp"); // <-+
emit("push %%rbx");
emit("movl 4(%%rsi), %%edi"); // 1st argument dest
emit("movl 8(%%rsi), %%esi"); // 2nd argument src
emit("movl $%d, %%edx", iarg); // 3rd argument count
emit("movq $%"PRIu64", %%rax", (uint64_t)block_copy_vm);
emit("callq *%%rax");
emit("pop %%r10");
emit("pop %%rbx");
emit("addq %%rbx, %%rsp");
emit("pop %%r10");
emit("pop %%r9");
emit("pop %%r8");
Expand Down

0 comments on commit 233fcb0

Please sign in to comment.