def sscopy_attach_shadow_stack(sscopy): base = llop.gc_adr_of_root_stack_base(llmemory.Address).address[0] ll_assert(llop.gc_adr_of_root_stack_top(llmemory.Address).address[0]==base, "attach_shadow_stack: ss is not empty?") length_bytes = sscopy.signed[0] llmemory.raw_memcopy(sscopy + SIZEADDR, base, length_bytes) llop.gc_adr_of_root_stack_top(llmemory.Address).address[0] = ( base + length_bytes) llmemory.raw_free(sscopy)
def sscopy_detach_shadow_stack(): base = llop.gc_adr_of_root_stack_base(llmemory.Address).address[0] top = llop.gc_adr_of_root_stack_top(llmemory.Address).address[0] length_bytes = top - base result = llmemory.raw_malloc(SIZEADDR + length_bytes) if result: result.signed[0] = length_bytes llmemory.raw_memcopy(base, result + SIZEADDR, length_bytes) llop.gc_adr_of_root_stack_top(llmemory.Address).address[0] = base return result
def sscopy_attach_shadow_stack(sscopy): base = llop.gc_adr_of_root_stack_base(llmemory.Address).address[0] ll_assert( llop.gc_adr_of_root_stack_top(llmemory.Address).address[0] == base, "attach_shadow_stack: ss is not empty?") length_bytes = sscopy.signed[0] llmemory.raw_memcopy(sscopy + SIZEADDR, base, length_bytes) llop.gc_adr_of_root_stack_top(llmemory.Address).address[0] = (base + length_bytes) llmemory.raw_free(sscopy)