CN113821273A - Application program running method, computing device and storage medium - Google Patents

Application program running method, computing device and storage medium Download PDF

Info

Publication number
CN113821273A
CN113821273A CN202111117069.9A CN202111117069A CN113821273A CN 113821273 A CN113821273 A CN 113821273A CN 202111117069 A CN202111117069 A CN 202111117069A CN 113821273 A CN113821273 A CN 113821273A
Authority
CN
China
Prior art keywords
information
section
file
module
application program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111117069.9A
Other languages
Chinese (zh)
Other versions
CN113821273B (en
Inventor
钟俊
江峰
柏鑫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Deepin Technology Co ltd
Original Assignee
Wuhan Deepin Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Deepin Technology Co ltd filed Critical Wuhan Deepin Technology Co ltd
Priority to CN202111117069.9A priority Critical patent/CN113821273B/en
Publication of CN113821273A publication Critical patent/CN113821273A/en
Application granted granted Critical
Publication of CN113821273B publication Critical patent/CN113821273B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44557Code layout in executable memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses an application program running method, a computing device and a storage medium, wherein the application program running method is suitable for being executed in the computing device and comprises the following steps: generating an executable file of the application program according to the application file; determining first storage information stored in an internal memory of the application program according to an executable file of the application program; generating second section information of the initialized data section according to the first section information and the module file; generating second storage information according to the second section information and the first storage information; loading the executable file and the module file of the application program into the internal memory according to the second storage information; and running the application program according to the executable file and the module file in the internal memory, and constructing a functional module in the application program. The invention can insert the module file into the initialization data section when the module file inserted into the application program needs to use a new data and the data needs to be given an initial value.

Description

Application program running method, computing device and storage medium
Technical Field
The present invention relates to the field of operating systems, and in particular, to an application program running method, a computing device, and a storage medium.
Background
With the continuous development of computer technology, more and more application programs are developed. Accordingly, more and more data are applied, and the data structure is more and more complex. In the process of using the application program, it is sometimes necessary to implement additional functions on the basis of the application program, or to know the operation condition of the application program, and the like.
In the prior art, when an application program is loaded, a binary file is obtained through some series of operations such as compiling and the like, and the binary file cannot be processed. Therefore, to implement additional functions of an application, the source code of the application must be modified, the required functions added thereto, and then recompiled when the application is not yet compiled. This approach is not only complicated, but also not suitable for some special scenarios, such as adding additional functions in an application program when there is no source code file or source code cannot be modified.
For this reason, a new application program running method is required.
Disclosure of Invention
To this end, the present invention provides an application program running method in an attempt to solve or at least alleviate the above-existing problems.
According to an aspect of the present invention, there is provided an application program running method, adapted to be executed in a computing device, the computing device including an internal memory and an external memory, the external memory storing therein an application file and a module file, the method including the steps of: generating an executable file of the application program according to the application file; determining first storage information stored in an internal memory of the application program according to an executable file of the application program, wherein the first storage information comprises first section information of the initialization data section allocated in the internal memory; generating second section information of the initialized data section according to the first section information and the module file; generating second storage information according to the second section information and the first storage information; loading the executable file and the module file of the application program into the internal memory according to the second storage information; and running the application program according to the executable file and the module file in the internal memory, and constructing a functional module in the application program to realize the additional function of the application program.
Optionally, in the method according to the present invention, determining, according to the executable file of the application program, first storage information stored in the internal memory of the application program includes the steps of: determining a first section size and first alignment information of an initialization data section allocated in an internal memory, according to an executable file; generating first section information of the initialization data section according to the first section size and the first alignment information; and generating first storage information according to the first section information.
Optionally, in the method according to the present invention, generating second section information according to the first section information and the module file includes: generating a second section size according to the first section size and the module file; generating second alignment information according to the first alignment information and the module file; generating preset section information of the uninitialized data section according to the size of the second section and the second alignment information; determining whether the module file is stored across page boundaries when the generated preset section information is stored in the internal memory; and if the module file is not stored across the page boundary, the preset section information is used as second section information.
Optionally, in the method according to the present invention, if the module file is stored across the page boundary, an occupied section is added before the storage location of the module file, so that the module file is not stored across the page boundary; and generating second zone information according to the added occupied zone and the preset zone information.
Optionally, in the method according to the present invention, generating the second section size according to the first section size and the module file includes: and adding the first section size and the file size of the module file to obtain a second section size.
Optionally, in the method according to the present invention, generating the second section size according to the first section size and the module file includes: and adding the first section size and the file size of the module file to obtain a second section size.
Optionally, in the method according to the present invention, loading the executable file and the module file of the application program into the internal memory according to the second storage information includes the steps of: allocating an initialization data section in the internal memory according to the second storage information; loading the executable file into the internal memory according to the second storage information; and loading the module file to the initialization data section according to second section information of the initialization data section of the second storage information.
Optionally, in the method according to the present invention, allocating the initialization data segment in the internal memory according to the second storage information comprises the steps of: determining an initial address of the module file storage according to the second storage information; and adding an initialization identifier at the initial address stored in the module file so as to insert the module file according to the initialization identifier.
Optionally, in the method according to the present invention, adding an initialization identifier to a start position of the module file storage includes the steps of: constructing a data address table, wherein the data address table comprises data address rows; and adding a memory page head address of an internal memory storage module file, a start bit address stored in the module file and a section type in a data address row, wherein the section type is an initialization data section.
Optionally, in the method according to the present invention, the computing device further includes a processor, and loading the executable file into the internal memory according to the second storage information includes: and when the processor generates a page fault exception because the initialization data section does not store related data, writing the initialization data of the executable file into the initialization data section.
Optionally, in the method according to the present invention, loading the module file into the initialization data segment according to the second segment information of the initialization data segment of the second storage information includes the steps of: inquiring whether a data address line comprising the memory page head address exists in a data address table according to the memory page head address stored in the internal memory of the module file; if a data address line comprising a memory page head address is inquired, determining the section type of the data address line; if the section type is an initialization data section, initializing the data of the module file to obtain initialization data of the module file; and storing the initialization data of the module file in the initialization data section according to the initial address stored in the module file.
Optionally, in the method according to the present invention, storing the initialization data of the module file in the initialization data section includes the steps of: determining a module alignment mode according to a second alignment mode of the second section information; and storing the initialization data of the module file in the initialization data section according to the module alignment mode.
Optionally, in the method according to the present invention, storing the initialization data of the module file in the initialization data section includes the steps of: determining a module alignment mode according to a second alignment mode of the second section information; and storing the initialization data of the module file in the initialization data section according to the module alignment mode.
According to another aspect of the present invention, there is provided a computing device comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing an application execution method according to the present invention.
According to a further aspect of the present invention, there is provided a computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computing device, cause the computing device to perform a method in an application execution method according to the present invention.
The application program running method is suitable for being executed in computing equipment, the computing equipment comprises an external memory and an internal memory, and application files and module files are stored in the external memory. Firstly, an executable file of an application program is generated according to an application file, and when the application is loaded, the application file in an external memory needs to be processed to obtain the executable file of a binary type file, and the executable file can be stored in an internal memory. First storage information stored in the internal memory by the application program is then determined according to the executable file of the application program, and the first storage information comprises first section information of the initialization data section allocated in the internal memory. When the executable file of the application program is loaded in the internal memory, a plurality of sections are divided in the internal memory, and corresponding data of the executable file is loaded in each section. One of the sections of the internal memory is an initialization data section, and if a module file to be inserted in an application needs to use a new data, and the data needs to be given an initial value, the new data needs to be inserted into the initialization data section. In order to load the module file into the initialization data segment, it is necessary to regenerate the second segment information of the initialization data segment from the first segment information of the initialization data segment and the module file. And generating second storage information according to the second section information and the first storage information so as to load the executable file and the module file of the application program into the internal memory according to the second storage information. After the executable file and the module file of the application program are loaded into the internal memory together, a functional module can be constructed in the application program to realize the additional function of the application program.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description when read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
FIG. 1 illustrates a schematic structure of an external memory and an internal memory according to an exemplary embodiment of the present invention;
FIG. 2 illustrates a block diagram of a computing device 200, according to an exemplary embodiment of the invention;
FIG. 3 illustrates a flowchart of an application execution method 300 according to an exemplary embodiment of the present invention;
FIG. 4 illustrates a schematic diagram of inserting a module file into an initialization data segment in accordance with an exemplary embodiment of the present invention; and
fig. 5 shows a flowchart for generating the second section information according to an exemplary embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art. Like reference numerals generally refer to like parts or elements.
Fig. 1 illustrates a schematic structure of an external memory and an internal memory according to an exemplary embodiment of the present invention. As shown in FIG. 1, computing device 200 includes internal memory 230 and external memory 210, and runs operating system 220. The present invention is not limited as to the type of operating system 220. The external memory 210 stores therein an application file 111 and a module file 112. The manner in which the application files 111 and the module files 112 are stored in the external memory 210 shown in fig. 1 is merely exemplary, and the present invention does not limit the number of application files and module files stored in the external memory 210.
The application file 111 can be implemented as an application file of any application program, and the invention does not limit the types of the application programs and the types of the application files. According to an embodiment of the present invention, the application file 111 is compiled, assembled, linked, etc. by the operating system 220 to obtain an executable file of the application program, and finally loaded into the internal memory 230.
The module file 112 can be implemented as a module file of any kind of functional module, the functional module can implement the additional function of the application program, and the invention does not limit the file type of the module file 112 and the type of the additional function of the application program. The module file 112 may be an uncompiled file that is pre-processed when loaded into the internal memory 230 to obtain an executable file of the functional module that can be loaded into the internal memory 230. The module file 112 may also be implemented as a binary type file, facilitating direct loading into a corresponding location in the internal memory 230.
The module file 112 is constructed in advance by a developer, and in order to implement an additional function in the application program, the module file 112 needs to be loaded into the internal memory 230, and particularly needs to be stored in a corresponding position of the internal memory 230 where an executable file of the application program is stored. After the module file 112 is deployed to the corresponding location, the module file 112 is transparent to the application program, and the application program does not sense and use the module file 112, and the operating system 220 directly calls the module file 112 to construct a functional module, thereby implementing an additional function of the application program.
The internal memory 230 allocates a storage space for the executable file when storing the executable file of the application program. The storage space allocated by the internal storage 230 includes a plurality of different memory segments, and the executable file is stored in the internal storage 230 in the form of memory segments. The internal memory 230 divides the memory space into memory sections including a heap section, a stack section, an initialization data section, and an uninitialized data section. When the operating system creates a process, the memory segment determines first storage information according to file information of the application executable file, and is divided in the internal storage 230 according to the first storage information.
The initialization data segment is used for storing initialized global variables in the application program and is static memory allocation. If a module file which needs to be inserted into an application program needs to use a new data, and the data needs to be given an initial value, the module file needs to be inserted into the initialization data section, so that the data which needs to be initialized in the module file can be initialized, the module file is normally loaded, and the additional function of the application program is realized.
The specific structure of the computing device 200 in fig. 1 is shown in fig. 2. FIG. 2 illustrates a block diagram of a computing device 200, according to an exemplary embodiment of the invention. As shown in FIG. 2, in a basic configuration 202, a computing device 200 typically includes a system memory 206 and one or more processors 204. A memory bus 208 may be used for communication between the processor 204 and the system memory 206.
Depending on the desired configuration, the processor 204 may be any type of processing, including but not limited to: a microprocessor (μ P), a microcontroller (μ C), a Digital Signal Processor (DSP), or any combination thereof. The processor 204 may include one or more levels of cache, such as a level one cache 210 and a level two cache 212, a processor core 214, and registers 216. Example processor cores 214 may include Arithmetic Logic Units (ALUs), Floating Point Units (FPUs), digital signal processing cores (DSP cores), or any combination thereof. The example memory controller 218 may be used with the processor 204, or in some implementations the memory controller 218 may be an internal part of the processor 204.
Depending on the desired configuration, system memory 206 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 206 may include an operating system 220, one or more programs 222, and program data 228. In some embodiments, the program 222 may be arranged to execute the instructions 223 of the method 300 according to the invention on an operating system by one or more processors 204 using the program data 228.
Computing device 200 may also include a storage interface bus 234. The storage interface bus 234 enables communication from the storage devices 232 (e.g., removable storage 236 and non-removable storage 238) to the basic configuration 202 via the bus/interface controller 230. Operating system 220, programs 222, and at least a portion of data 224 can be stored on removable storage 236 and/or non-removable storage 238, and loaded into system memory 206 via storage interface bus 234 and executed by one or more processors 204 when computing device 200 is powered on or programs 222 are to be executed.
Computing device 200 may also include an interface bus 240 that facilitates communication from various interface devices (e.g., output devices 242, peripheral interfaces 244, and communication devices 246) to the basic configuration 202 via the bus/interface controller 230. The example output device 242 includes a graphics processing unit 248 and an audio processing unit 250. They may be configured to facilitate communication with various external devices, such as a display or speakers, via one or more a/V ports 252. Example peripheral interfaces 244 can include a serial interface controller 254 and a parallel interface controller 256, which can be configured to facilitate communications with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 258. An example communication device 246 may include a network controller 260, which may be arranged to communicate with one or more other computing devices 262 over a network communication link via one or more communication ports 264.
A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
In a computing device 200 according to the present invention, the program 222 comprises a plurality of program instructions of the application execution method 300 that can instruct the processor 204 to perform some of the steps of the application execution method 300 executed in the computing device 200 of the present invention so that some of the parts in the computing device 200 execute the application by performing the application execution method 300 of the present invention.
Computing device 200 may be implemented as a server, e.g., file server 240, database 250, a server, an application server, etc., which may be a device such as a Personal Digital Assistant (PDA), a wireless web-browsing device, an application-specific device, or a hybrid device that include any of the above functions. May be implemented as a personal computer including both desktop and notebook computer configurations, and in some embodiments, the computing device 200 is configured as an application execution method 300.
Fig. 3 shows a flow diagram of an application execution method 300 according to an exemplary embodiment of the present invention. The application execution method 300 in the present invention is executed in a computing device and is further adapted to be executed in the computing device 200 as shown in fig. 1. As shown in fig. 3, the instruction execution method 300 starts with step S310, and generates an executable file of an application program according to the application file 111.
The application files 111 stored in the external memory 210 are not preprocessed and cannot be directly loaded into the internal memory 230. According to an embodiment of the present invention, the application file 111 needs to be compiled, assembled and linked by the operating system 220 to obtain an executable file of the application program. The steps and methods of the present invention for pre-processing the application files 111 by the operating system 220 are not limited.
Subsequently, step S320 is executed to determine first storage information stored in the internal memory 230 by the application according to the executable file of the application, wherein the first storage information includes first section information of the initialization data section allocated in the internal memory 230.
The first storage information stored in the internal storage 230 by the application program includes sector information of a plurality of memory sectors. The memory sections divided in the internal memory 230 include a heap section, a stack section, a code section, an initialization data section, and an uninitialized data section. When the operating system 220 creates a process, the memory segment determines the first storage information according to the file information of the executable file of the application program, and is divided in the internal storage 230 according to the first storage information. The initialization data section stores initialized initialization data in the executable file, and the initialized initialization data comprises global variables initialized in the application program.
When the first storage information stored in the internal memory 230 by the application is determined based on the executable file of the application, the first section size and the first alignment information of the initialization data section allocated in the internal memory 230 are determined based on the executable file. Specifically, the size of the first section is determined according to initialization data in the executable file, namely how many initialized global variables exist in the application program; the determination of the application alignment stored in the internal memory 230 of the executable file is then decided according to the instruction fetch of the processor as the first alignment information. The first alignment information indicates from which alignment boundary the start address of the initialization data segment should start (e.g., 2, 4, 8, 32 byte alignment, etc.), which determines the start position of the initialization data segment, and is determined by the instruction fetch mode of the processor.
First sector information of the initialization data sector is then generated based on the first sector size and the first alignment information, the first sector information including the first sector size and the first alignment information.
First storage information is generated according to the first section information, and the first section information of the initialization data section and the section information of other data sections are used as the first storage information. Other data sections include a heap section, a stack section, a code section, and an uninitialized data section.
Subsequently, step S330 is executed to generate second section information of the initialization data section according to the first section information and the module file 112.
Fig. 4 illustrates a schematic diagram of inserting a module file into an initialization data segment according to an exemplary embodiment of the present invention. As shown in fig. 4, the module file 415 is inserted into the initialization data section 416, and the section information of the initialization data section 416 is the first section information calculated according to steps S310 and S320. When the executable file is loaded in the internal memory 230, the storage space required for storing the executable file is increased; specifically, a storage space is reserved for the module file 415 in the initialization data section 416. The insertion of the module file 415 in the initialization data section 416 can be achieved by adding the reserved storage space, which is not in the storage space required for storing the executable file itself. The module file 415 is the same as the module file 112 in fig. 1, but if the module file 112 cannot be directly stored in the internal memory 230, the module file 415 is obtained by preprocessing the module file 112.
After module file 415 is inserted into initialization data section 416, initialization data section 426 results. The size and starting position of the initialization data segment 426 are changed from those of the initialization data segment 416, and the segment information of the initialization data segment 426 needs to be recalculated to obtain the second segment information.
Fig. 5 shows a flowchart for generating the second section information according to an exemplary embodiment of the present invention. As shown in fig. 5, first segment information is acquired, a second segment size is generated according to the first segment size and the module file 112, and when the second segment size is generated, the first segment size and the file size of the module file 112 are added to obtain the second segment size.
Then, second alignment information is generated according to the first alignment information and the module file 112, wherein the first alignment information includes an application alignment mode, and the application alignment mode refers to an alignment boundary from which the start address of the initialization data segment should start, and determines the start position of the initialization data segment. When the second alignment information is generated, the module alignment mode is generated according to the application alignment mode, and the module file 112 starts from which alignment boundary from which the initialization data segment starts, so that the module alignment mode of the module file 112 in the internal memory 230 is the same as the application alignment mode of the executable file in the internal memory 230.
According to one embodiment of the invention, the initialization data fields are aligned in 32-bit bytes, and then module file 112 is also aligned in 32-bit bytes.
And then generating second alignment information according to the application alignment mode and the module alignment mode. The second alignment information includes an application alignment mode and a module alignment mode.
And then generating preset section information of the initialization data section according to the second section size and the second alignment information. The preset section information includes a second section size and second alignment information.
It is then determined whether the module file is stored across a page boundary when stored in the internal memory according to the generated preset section information. The internal memory stores data in a memory page manner by applying a memory paging mechanism when storing data. And if the module file is not stored across the page boundary, the preset section information is used as second section information. If the module file is stored across page boundaries, an occupied section is added in front of the storage position of the module file, so that the module file is not stored across page boundaries, and a processor can read and process transparent data from an internal memory conveniently. And finally, generating second zone information according to the added occupied zone and the preset zone information. And storing the module file after the occupied section, then re-determining the size of the second section and the second alignment information according to the size of the occupied section, and generating the second section information according to the modified size of the second section and the second alignment information.
Subsequently, step S340 is performed to generate second storage information according to the second section information and the first storage information. And when the second storage information is generated, combining the second section information of the initialization data section with the section information of other data sections in the first storage information to obtain the second storage information. Other data sections include a heap section, a stack section, a code section, and an uninitialized data section.
Subsequently, step S350 is performed to load the executable file of the application program and the module file 112 to the internal memory 230 according to the second storage information. When the executable file of the application program and the module file 112 are loaded into the internal memory 230, the initialization data section is first allocated in the internal memory according to the second storage information.
When the initialization data section is allocated, the size of the initialization data section is determined according to the size of the second section, and the header address of the memory for storing the initialization data section, the starting address of the module file in the memory page where the initialization data section is located and the starting address of the application file storage are determined according to the second alignment information.
As shown in fig. 4, the allocated initialization data segment 426 is increased in size relative to the calculated initialization data segment 416, and the increased reserved storage space is used to store the module file 415. Uninitialized data for the application to be stored in original initialized data section 416 is still stored in uninitialized data section 426.
And then, adding an initialization identifier at the initial address of the module file storage so as to insert the module file according to the initialization identifier. When the initialization identifier is added, a data address table is constructed, and the data address table stores one or more data address rows. The data address table is used to determine whether the initialization data is required and to retrieve a start location of the initialization data storage so as to store the initialization data in the corresponding start location.
And then adding a memory page head address of the internal memory storage module file, a start bit address stored in the module file and a section type in the data address row, wherein the section type is an initialization data section. According to whether the memory page head address and the section type of the data address line storage module file exist, whether data initialization needs to be carried out in the memory page can be judged. If data initialization is needed, the initialization data is stored according to the start bit address stored in the module file.
A processor (not shown in fig. 1) is also included in the computing device. The processor reads and processes data from the internal memory. When the data sector is allocated, only the sector of the data storage is allocated, the initialization identifier of the module file is set, and the storage of the application file and the module file is not completed. And the processor accesses and acquires the module file and the application file according to the initial address stored in the module file and the initial address stored in the application file. The processor checks whether the corresponding position stores the corresponding file or not according to the storage address of the file, the processor has an actual memory, and if not, the processor throws out the page fault exception.
Loading the executable file into the internal memory according to the second storage information includes writing initialization data of the executable file into the initialization data section when the processor generates a page fault exception because the initialization data section does not store the relevant data. When the executable file of the application program is generated, initializing the data which needs to be initialized by the application program to obtain the initialized data in the executable file.
And then, when loading the module file into the initialized data section according to the second section information of the initialized data section of the second storage information, firstly, inquiring whether a data address line comprising the memory page head address exists in the data address table according to the memory page head address stored in the internal memory of the module file. One or more data address rows are stored in the data address table. And if the data address line comprising the memory page head address is inquired, determining the section type of the data address line so as to determine whether the data initialization operation is required.
If the section type is an initialization data section, initializing the data of the module file to obtain the initialization data of the module file, and storing the initialization data of the module file in the initialization data section according to the initial address stored in the module file, thereby realizing the insertion of the module file into the application program. When the initialization data of the module file 112 is loaded into the initialization data segment, the module alignment mode is determined according to the second alignment mode of the second segment information, and the module file 112 is stored in the initialization data segment according to the module alignment mode.
According to one embodiment of the present invention, when the module alignment is 32-bit byte aligned, module file 112 is stored in initialization data section 425 with the 32-bit byte as an alignment boundary.
Finally, step S360 is performed to run the application program according to the executable file in the internal memory 230 and the module file 112, and to build a function module in the application program to implement the additional function of the application program. The internal memory 230 includes executable files and module files 112 that may be directly invoked for execution by the operating system 220 to run applications. In addition, the operating system 220 calls the module file according to the calculated initial position of the module file 112 stored in the initialized data segment, constructs a function module, and implements an additional function of the application program.
The application program running method is suitable for being executed in computing equipment, the computing equipment comprises an external memory and an internal memory, and application files and module files are stored in the external memory. Firstly, an executable file of an application program is generated according to an application file, and when the application is loaded, the application file in an external memory needs to be processed to obtain the executable file of a binary type file, and the executable file can be stored in an internal memory. First storage information stored in the internal memory by the application program is then determined according to the executable file of the application program, and the first storage information comprises first section information of the initialization data section allocated in the internal memory. When the executable file of the application program is loaded in the internal memory, a plurality of sections are divided in the internal memory, and corresponding data of the executable file is loaded in each section. One of the sections of the internal memory is an initialization data section, and if a module file to be inserted in an application needs to use a new data, and the data needs to be given an initial value, the new data needs to be inserted into the initialization data section. In order to load the module file into the initialization data segment, it is necessary to regenerate the second segment information of the initialization data segment from the first segment information of the initialization data segment and the module file. And generating second storage information according to the second section information and the first storage information so as to load the executable file and the module file of the application program into the internal memory according to the second storage information. After the executable file and the module file of the application program are loaded into the internal memory together, a functional module can be constructed in the application program to realize the additional function of the application program.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
A9, the method as in A8, wherein the adding of the initialization flag at the start position of the module file storage comprises the steps of:
constructing a data address table, wherein the data address table comprises data address rows;
and adding a memory page head address of the internal memory for storing the module file, a start bit address of the module file and a section type in the data address row, wherein the section type is an initialization data section.
A10, the method according to any one of A7-A9, wherein the computing device further comprises a processor, and the loading the executable file into the internal memory according to the second storage information comprises the steps of:
when the processor generates a page fault exception because the initialization data section does not store related data, the initialization data of the executable file is written into the initialization data section.
A11, the method of a10, wherein the loading the module file to the initialization data section according to the second section information of the initialization data section of the second storage information comprises the steps of:
inquiring whether a data address row comprising the memory page head address exists in the data address table according to the memory page head address stored in the internal memory by the module file;
if a data address line comprising the memory page head address is inquired, determining the section type of the data address line;
if the section type is an initialization data section, initializing the data of the module file to obtain initialization data of the module file;
and storing the initialization data of the module file in the initialization data section according to the initial address stored in the module file.
A12, the method of A11, wherein the storing the initialization data of the module file in the initialization data segment includes the steps of:
determining a module alignment mode according to a second alignment mode of the second section information;
and storing the initialization data of the module file in the initialization data section according to the module alignment mode.
A13, the method as in A12, wherein building the function module in the application program comprises the steps of:
and calling the module file according to the initial position of the module file stored in the initialization data section, and constructing the functional module.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or groups of devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. Modules or units or groups in embodiments may be combined into one module or unit or group and may furthermore be divided into sub-modules or sub-units or sub-groups. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as floppy diskettes, CD-ROMs, hard drives, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the application execution method of the present invention according to instructions in the program code stored in the memory.
By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer-readable media includes both computer storage media and communication media. Computer storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of computer readable media.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed in an illustrative rather than a restrictive sense, and the scope of the present invention is defined by the appended claims.

Claims (10)

1. An application program running method, adapted to be executed in a computing device including an internal memory and an external memory, the external memory storing therein an application file and a module file, the method comprising the steps of:
generating an executable file of an application program according to the application file;
determining first storage information stored in the internal memory by the application program according to the executable file of the application program, wherein the first storage information comprises first section information of the initialization data section allocated in the internal memory;
generating second section information of the initialization data section according to the first section information and the module file;
generating second storage information according to the second section information and the first storage information;
loading the executable file and the module file of the application program to the internal memory according to the second storage information;
and running the application program according to the executable file and the module file in the internal memory, and constructing a functional module in the application program to realize the additional function of the application program.
2. The method of claim 1, wherein the determining first storage information of the application program stored in the internal memory according to the executable file of the application program comprises the steps of:
determining a first section size and first alignment information of an initialization data section allocated in the internal memory according to the executable file;
generating first section information of the initialization data section according to the first section size and first alignment information;
and generating first storage information according to the first section information.
3. The method of claim 2, wherein the generating of the second section information according to the first section information and the module file comprises the steps of:
generating a second section size according to the first section size and the module file;
generating second alignment information according to the first alignment information and the module file;
generating preset section information of the uninitialized data section according to the second section size and the second alignment information;
determining whether the module file is stored across page boundaries when stored in the internal memory according to the generated preset section information;
and if the module file is not stored across page boundaries, using the preset section information as second section information.
4. The method of claim 3, wherein the method further comprises the steps of:
if the module file is stored across page boundaries, adding an occupied section before the storage position of the module file to ensure that the module file is not stored across page boundaries;
and generating second zone information according to the added occupied zone and the preset zone information.
5. The method of claim 3 or 4, wherein said generating a second section size from said first section size and said module file comprises the steps of:
and adding the first section size and the file size of the module file to obtain the second section size.
6. The method of any of claims 3-5, wherein the first alignment information includes an application alignment style, and the generating second alignment information from the first alignment information and the module file includes the steps of:
generating a module alignment mode according to the application alignment mode;
and generating second alignment information according to the application alignment mode and the module alignment mode to ensure that the module alignment mode of the module file in the internal memory is the same as the application alignment mode of the executable file in the internal memory.
7. The method of claim 6, wherein the loading the executable file and the module file of the application program to the internal memory according to the second storage information comprises the steps of:
allocating an initialization data section in the internal memory according to the second storage information;
loading the executable file to the internal memory according to the second storage information;
and loading the module file to the initialization data section according to second section information of the initialization data section of the second storage information.
8. The method of claim 7, wherein the allocating initialization data segments in the internal memory according to the second storage information comprises the steps of:
determining the initial address of the module file storage according to the second storage information;
and adding an initialization identifier at the initial address stored in the module file so as to insert the module file according to the initialization identifier.
9. A computing device, comprising:
one or more processors;
a memory; and
one or more apparatuses comprising instructions for performing the method of any of claims 1-8.
10. A computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computing device, cause the computing device to perform the method of any of claims 1-8.
CN202111117069.9A 2021-09-23 2021-09-23 Application program running method, computing device and storage medium Active CN113821273B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111117069.9A CN113821273B (en) 2021-09-23 2021-09-23 Application program running method, computing device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111117069.9A CN113821273B (en) 2021-09-23 2021-09-23 Application program running method, computing device and storage medium

Publications (2)

Publication Number Publication Date
CN113821273A true CN113821273A (en) 2021-12-21
CN113821273B CN113821273B (en) 2023-10-13

Family

ID=78920994

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111117069.9A Active CN113821273B (en) 2021-09-23 2021-09-23 Application program running method, computing device and storage medium

Country Status (1)

Country Link
CN (1) CN113821273B (en)

Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1329309A (en) * 2000-06-13 2002-01-02 微软公司 Multi-languages user interface for operating system
CN101452402A (en) * 2008-11-28 2009-06-10 珠海金山软件股份有限公司 Software operation system and software operation method
CN103473059A (en) * 2013-09-11 2013-12-25 江苏中科梦兰电子科技有限公司 General purpose operating system capable of supporting multiple system structures
CN103677937A (en) * 2013-12-23 2014-03-26 腾讯科技(深圳)有限公司 Method and device for upgrading and running software
CN104572224A (en) * 2015-02-04 2015-04-29 南车株洲电力机车研究所有限公司 Method, device and system for loading out file
CN105005491A (en) * 2015-08-11 2015-10-28 上海斐讯数据通信技术有限公司 Linux kernel and application program upgrading method and system
CN105068832A (en) * 2015-07-30 2015-11-18 北京奇虎科技有限公司 Method and apparatus for generating executable file
US9974492B1 (en) * 2015-06-05 2018-05-22 Life365, Inc. Health monitoring and communications device
US20190095119A1 (en) * 2015-06-05 2019-03-28 Life365, Inc. Device configured for dynamic software change
CN110069459A (en) * 2019-03-14 2019-07-30 北京字节跳动网络技术有限公司 File monitor method, apparatus and electronic equipment
CN110457870A (en) * 2019-08-01 2019-11-15 浙江大华技术股份有限公司 Processing method and processing device, embedded device and the storage medium of executable file
CN111290952A (en) * 2020-01-22 2020-06-16 北京深之度科技有限公司 Tracking method and device for dynamic link library function
CN111930467A (en) * 2020-07-02 2020-11-13 联想(北京)有限公司 Virtual machine starting method, device, equipment and computer readable storage medium
CN113377370A (en) * 2021-05-18 2021-09-10 龙芯中科(西安)科技有限公司 File processing method and device, electronic equipment and storage medium
CN113805971A (en) * 2021-09-23 2021-12-17 武汉深之度科技有限公司 Application program running method, computing device and storage medium
CN113821272A (en) * 2021-09-23 2021-12-21 武汉深之度科技有限公司 Application program running method, computing device and storage medium
CN113849245A (en) * 2021-09-23 2021-12-28 武汉深之度科技有限公司 Application program running method, computing device and storage medium
CN114003289A (en) * 2021-11-02 2022-02-01 武汉深之度科技有限公司 Application program running method, computing device and storage medium

Patent Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1329309A (en) * 2000-06-13 2002-01-02 微软公司 Multi-languages user interface for operating system
CN101452402A (en) * 2008-11-28 2009-06-10 珠海金山软件股份有限公司 Software operation system and software operation method
CN103473059A (en) * 2013-09-11 2013-12-25 江苏中科梦兰电子科技有限公司 General purpose operating system capable of supporting multiple system structures
CN103677937A (en) * 2013-12-23 2014-03-26 腾讯科技(深圳)有限公司 Method and device for upgrading and running software
CN104572224A (en) * 2015-02-04 2015-04-29 南车株洲电力机车研究所有限公司 Method, device and system for loading out file
US20190095119A1 (en) * 2015-06-05 2019-03-28 Life365, Inc. Device configured for dynamic software change
US9974492B1 (en) * 2015-06-05 2018-05-22 Life365, Inc. Health monitoring and communications device
CN105068832A (en) * 2015-07-30 2015-11-18 北京奇虎科技有限公司 Method and apparatus for generating executable file
CN105005491A (en) * 2015-08-11 2015-10-28 上海斐讯数据通信技术有限公司 Linux kernel and application program upgrading method and system
CN110069459A (en) * 2019-03-14 2019-07-30 北京字节跳动网络技术有限公司 File monitor method, apparatus and electronic equipment
CN110457870A (en) * 2019-08-01 2019-11-15 浙江大华技术股份有限公司 Processing method and processing device, embedded device and the storage medium of executable file
CN111290952A (en) * 2020-01-22 2020-06-16 北京深之度科技有限公司 Tracking method and device for dynamic link library function
CN111930467A (en) * 2020-07-02 2020-11-13 联想(北京)有限公司 Virtual machine starting method, device, equipment and computer readable storage medium
CN113377370A (en) * 2021-05-18 2021-09-10 龙芯中科(西安)科技有限公司 File processing method and device, electronic equipment and storage medium
CN113805971A (en) * 2021-09-23 2021-12-17 武汉深之度科技有限公司 Application program running method, computing device and storage medium
CN113821272A (en) * 2021-09-23 2021-12-21 武汉深之度科技有限公司 Application program running method, computing device and storage medium
CN113849245A (en) * 2021-09-23 2021-12-28 武汉深之度科技有限公司 Application program running method, computing device and storage medium
CN114003289A (en) * 2021-11-02 2022-02-01 武汉深之度科技有限公司 Application program running method, computing device and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
WEI DONG等: ""Enabling efficient reprogramming through reduction of executable modules in networked embedded systems"", 《AD HOC NETWORKS》 *
高永惠: ""C语言多模块文件的处理"", 《湖南科技学院学报》, pages 141 - 142 *

Also Published As

Publication number Publication date
CN113821273B (en) 2023-10-13

Similar Documents

Publication Publication Date Title
US10324694B2 (en) Arranging binary code based on call graph partitioning
CN105393217B (en) Method and system for Compiler Optimization
CN112988252B (en) Operating system starting method and computing device
JP2007531074A (en) Method and apparatus for code partitioning in program code conversion
CN114691240A (en) Drive hardware configuration information loading method, device and system and computing equipment
US20170329704A1 (en) Dynamically sized locals with precise garbage collection reporting
CN113127100B (en) Heterogeneous program execution method and device, computing device and readable storage medium
CN114003289A (en) Application program running method, computing device and storage medium
CN113849245B (en) Application program running method, computing device and storage medium
CN113805971B (en) Application program running method, computing device and storage medium
CN113821272B (en) Application program running method, computing device and storage medium
US20080222627A1 (en) Static extensibility models with dynamic languages and scripts
CN113821273B (en) Application program running method, computing device and storage medium
CN102982073B (en) File is to the binding method in host file and device
CN113791873B (en) Virtual machine creating method, computing device and storage medium
CN114780173A (en) Method for loading plug-in application, computing equipment and storage medium
CN114691549A (en) File writing method and device and computing equipment
JP4984303B2 (en) Dynamic linking and dynamic loading of post-processing kernel
CN114168489B (en) Function information acquisition method, computing device and storage medium
CN113835927B (en) Instruction execution method, computing device and storage medium
CN111752620A (en) Processing method and loading method of kernel module
US11327758B2 (en) Non-transitory computer-readable recording medium, assembly instruction conversion method and information processing apparatus
US20220108003A1 (en) Apparatus and method for kernel runtime randomization
CN114706828A (en) File loading method, computing device and storage medium
CN114003281A (en) Hash value-based instruction execution method, computing device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant