Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[recode] Account for spilled values of four bytes #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
14 changes: 12 additions & 2 deletions criu-3.15/lib/py/st_reg_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,12 @@ def _get_val(ctx, val, arch=False, return_loc = False):
raw_val.append(struct.unpack(
'<Q', ctx.pages.read(8))[0])
else:
raw_val = struct.unpack('<Q', ctx.pages.read(8))[0]
if val.size == 4:
raw_val = struct.unpack('<I', ctx.pages.read(4))[0]
elif val.size == 8:
raw_val = struct.unpack('<Q', ctx.pages.read(8))[0]
else:
raise Exception("Size not supported for spilled value!")
else:
raw_val = struct.unpack('<Q', ctx.pages.read(8))[0]
if return_loc:
Expand Down Expand Up @@ -398,7 +403,12 @@ def _put_val(dest_ctx, dest_val, raw_val, arch=False, return_loc = False, fixup_
for i in range(write_count):
write_val.append(struct.pack("Q", raw_val[i]))
else:
write_val.append(struct.pack("Q", raw_val))
if dest_val.size == 4:
write_val.append(struct.pack("I", raw_val))
elif dest_val.size == 8:
write_val.append(struct.pack("Q", raw_val))
else:
raise Exception("Size not supported for spilled value!")
else:
if dest_val.operand_size == 1:
write_val.append(struct.pack("B", raw_val))
Expand Down