Hi Martin. Thanks for your reply. >> If the answer is AM31, then what happens if it >> is run as AM64 instead?
> The process is started by the kernel in the "correct" mode, > you can not specify that a ELF32 binary is started in AMODE-64. > The kernel enforces limits as well, e.g. with a 31-bit compat > process (ELF32) you can not map anything above the 2GB line. I would like the z/Linux kernel to be modified to start an ELF32 binary in AM64 and have access to a full 4 GiB address space. And when it starts an ELF32 binary it should zero out the high 32 bits of the 64-bit registers using LMH R0,R15,=16F'0'. Is there any technical barrier to doing that? Thanks. Paul. <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free. www.avg.com <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> On 22 May 2018 at 21:31, Martin Schwidefsky <schwidef...@de.ibm.com> wrote: > On Mon, 21 May 2018 07:21:38 +1000 > Paul Edwards <mutazi...@gmail.com> wrote: > > > When 32-bit modules are created on z/Linux > > using "gcc -m32" or whatever, is the resultant > > module run as AM31 or AM64? > > The -m31 option creates objects and binaries in the ELF32 format. > Without the option or with -m64 the ELF64 format is used. > > A 64-bit kernel recognizes the format of the binary and starts it > in the appropriate mode. Native for ELF64 or compat for ELF32. > The addressing mode is AMODE-64 for native 64-bit programs and > AMOED-31 for compat 31-bit code. > > > If the answer is AM31, then what happens if it > > is run as AM64 instead? > > The process is started by the kernel in the "correct" mode, > you can not specify that a ELF32 binary is started in AMODE-64. > > The kernel enforces limits as well, e.g. with a 31-bit compat > process (ELF32) you can not map anything above the 2GB line. > The format of the signal handler frame is different as well > for ELF32 vs ELF64. > > But you can switch the addressing mode in your program with > the sam24, sam31, and sam64 instructions. If the code of the > program is at a location that goes along with the chosen > addressing mode, the CPU will happily execute the instructions. > You better not forget to switch back to the default mode before > calling a function in the runtime environment. Otherwise your > program will quickly terminate. > > -- > blue skies, > Martin. > > "Reality continues to ruin my life." - Calvin. > > ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For more information on Linux on System z, visit http://wiki.linuxvm.org/