linux/tools/testing/selftests/x86/thunks_32.S
Thomas Gleixner 2025cf9e19 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms and conditions of the gnu general public license
  version 2 as published by the free software foundation this program
  is distributed in the hope it will be useful but without any
  warranty without even the implied warranty of merchantability or
  fitness for a particular purpose see the gnu general public license
  for more details

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 263 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141901.208660670@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05 17:36:37 +02:00

48 lines
843 B
ArmAsm

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* thunks_32.S - assembly helpers for mixed-bitness code
* Copyright (c) 2015 Denys Vlasenko
*
* These are little helpers that make it easier to switch bitness on
* the fly.
*/
.text
.code32
.global call64_from_32
.type call32_from_64, @function
// 4(%esp): function to call
call64_from_32:
// Fetch function address
mov 4(%esp), %eax
// Save registers which are callee-clobbered by 64-bit ABI
push %ecx
push %edx
push %esi
push %edi
// Switch to long mode
jmp $0x33,$1f
1: .code64
// Call the function
call *%rax
// Switch to compatibility mode
push $0x23 /* USER32_CS */
.code32; push $1f; .code64 /* hack: can't have X86_64_32S relocation in 32-bit ELF */
lretq
1: .code32
pop %edi
pop %esi
pop %edx
pop %ecx
ret
.size call64_from_32, .-call64_from_32