| ... | ... | @@ -7457,11 +7457,25 @@ fn genInlineMemcpy( |
| 7457 | 7457 | try self.spillRegisters(&.{ .rdi, .rsi, .rcx }); |
| 7458 | 7458 | |
| 7459 | 7459 | switch (dst_ptr) { |
| 7460 | | .memory, .linker_load => { |
| 7461 | | try self.loadMemPtrIntoRegister(.rdi, Type.usize, dst_ptr); |
| 7460 | .memory => |addr| { |
| 7461 | try self.genSetReg(Type.usize, .rdi, .{ .immediate = addr }); |
| 7462 | 7462 | // Load the pointer, which is stored in memory |
| 7463 | 7463 | try self.asmRegisterMemory(.mov, .rdi, Memory.sib(.qword, .{ .base = .rdi })); |
| 7464 | 7464 | }, |
| 7465 | .linker_load => |load_struct| { |
| 7466 | const atom_index = if (self.bin_file.cast(link.File.MachO)) |macho_file| blk: { |
| 7467 | const atom = try macho_file.getOrCreateAtomForDecl(self.mod_fn.owner_decl); |
| 7468 | break :blk macho_file.getAtom(atom).getSymbolIndex().?; |
| 7469 | } else if (self.bin_file.cast(link.File.Coff)) |coff_file| blk: { |
| 7470 | const atom = try coff_file.getOrCreateAtomForDecl(self.mod_fn.owner_decl); |
| 7471 | break :blk coff_file.getAtom(atom).getSymbolIndex().?; |
| 7472 | } else unreachable; |
| 7473 | |
| 7474 | switch (load_struct.type) { |
| 7475 | .import => unreachable, |
| 7476 | .got, .direct => try self.asmMovLinker(.rdi, atom_index, load_struct), |
| 7477 | } |
| 7478 | }, |
| 7465 | 7479 | .stack_offset, .ptr_stack_offset => |off| { |
| 7466 | 7480 | try self.asmRegisterMemory(switch (dst_ptr) { |
| 7467 | 7481 | .stack_offset => .mov, |
| ... | ... | @@ -7485,11 +7499,25 @@ fn genInlineMemcpy( |
| 7485 | 7499 | } |
| 7486 | 7500 | |
| 7487 | 7501 | switch (src_ptr) { |
| 7488 | | .memory, .linker_load => { |
| 7489 | | try self.loadMemPtrIntoRegister(.rsi, Type.usize, src_ptr); |
| 7502 | .memory => |addr| { |
| 7503 | try self.genSetReg(Type.usize, .rsi, .{ .immediate = addr }); |
| 7490 | 7504 | // Load the pointer, which is stored in memory |
| 7491 | 7505 | try self.asmRegisterMemory(.mov, .rsi, Memory.sib(.qword, .{ .base = .rsi })); |
| 7492 | 7506 | }, |
| 7507 | .linker_load => |load_struct| { |
| 7508 | const atom_index = if (self.bin_file.cast(link.File.MachO)) |macho_file| blk: { |
| 7509 | const atom = try macho_file.getOrCreateAtomForDecl(self.mod_fn.owner_decl); |
| 7510 | break :blk macho_file.getAtom(atom).getSymbolIndex().?; |
| 7511 | } else if (self.bin_file.cast(link.File.Coff)) |coff_file| blk: { |
| 7512 | const atom = try coff_file.getOrCreateAtomForDecl(self.mod_fn.owner_decl); |
| 7513 | break :blk coff_file.getAtom(atom).getSymbolIndex().?; |
| 7514 | } else unreachable; |
| 7515 | |
| 7516 | switch (load_struct.type) { |
| 7517 | .import => unreachable, |
| 7518 | .got, .direct => try self.asmMovLinker(.rsi, atom_index, load_struct), |
| 7519 | } |
| 7520 | }, |
| 7493 | 7521 | .stack_offset, .ptr_stack_offset => |off| { |
| 7494 | 7522 | try self.asmRegisterMemory(switch (src_ptr) { |
| 7495 | 7523 | .stack_offset => .mov, |