Method and mechanism for calling 32-bit functions from 16-bit functions
AssigneeInternational Business Machines Corporation
InventorsDavid M. Mooney, Kevin A. Stoodley
Life of this patent
Estimating the term…
Abstract
In the field of mixed 16-bit and 32-bit code, a method and mechanism are provided to implement alterations in the dynamic portion of memory containing the data objects used by code in the 16-bit environment so that such data is accessible to code from the 32-bit environment. The code necessary to implement the method is generated automatically by an enhanced compiler on identifying 16-bit linkage in the 32-bit code. Once the data objects in the stack are accesible to the 32-bit code, a function in the 16-bit code can successfully call a function in 32-bit code.
Claims26
A combination operable in conjunction with a digital computer system having a central processing unit (CPU) to provide a 32-bit function with access to a memory stack shared with at least one 16-bit code function, the combination comprising:
- a 32-bit program means for causing the CPU to execute a 32-bit code function;
- and
- prologue means in the 32-bit program means responsive to a call from a 16-bit code function for:
- building a parameter list in a memory stack in 32-bit form to allow the 32-bit code function to access data in the memory stack;
- translating 16-bit register values in the memory stack into a form which is addressable by the 32-bit code;
- changing the operating mode of the CPU to 32-bit form;
- establishing additional 32-bit registers;
- and
- executing the 32-bit code.
In a computing environment, having a central processing unit (CPU) and including mapping means for mapping addresses between 16- and 32-bit code, a method for calling 32-bit code from a 16-bit code in a program, in which at least one 16-bit stack frame in a memory stack, is allocated to the 16-bit code, the method comprising the computer implemented steps of:
- executing a program in the computing environment;
- during execution of the program, executing function embodied in 16-bit code;
- calling a function embodied in 32-bit code;
- building a parameter list in the memory stack in 32-bit form to allow the 32 bit code access data in the stack frame;
- translating 16-bit register values in the memory stack into a form which is addressable by the 32-bit code;
- changing operating mode of the CPU to 32-bit form;
- establishing all additional 32-bit registers;
- and,
- executing the 32-bit code.
In a computing environment including means for mapping addresses between 16- and 32-bit code, a mechanism for enabling calls from a program in 16-bit code to a subroutine in 32-bit code, comprising:
- a memory stack in which at least one stack frame is allocated to the program in 16-bit code;
- a 32-bit compiler having a enhancement element for generating and imbedding in a 32-bit subroutine, first code to transfer control in a 16-bit environment to 32-bit code and second code for returning control to 16-bit code;
- and
- signal means for activating the enhancement element in the 32-bit compiler to generate the first code to transfer control and the second code to return control.
A combination operable in conjunction with a digital computer system having a central processing unit (CPU) for calling 32-bit code from a 16-bit code in a program executing on the digital computer system, said combination comprising a data storage medium operable in conjunction with a data storage system of the digital computer system, the data storage medium having resident thereon program means executable on the CPU for performing steps including:
- during execution of a program in the digital computer system while the CPU is in a 16-bit operating mode, executing a function embodied in 16-bit code;
- calling a function embodied in 32-bit code;
- building a parameter list in a memory stack in 32-bit form to allow the 32bit code to access in the stack frame;
- translating the 16-bit register values in the memory stack into a form which is addressable by the 32-bit code;
- changing the operating mode of the CPU to 32-bit form;
- establishing all additional 32-bit registers;
- and
- executing the 32-bit code.
Dependencies are inferred from the claim text.