Custom entry points of the Symbian program and one-point records compiled using ARM

Source: Internet
Author: User

Holes are often larger and larger. This is to try How To Get The s60 program out of the default startup code, but to use its own startup code.

The first step to pursue this goal is to view
The real entry point of the Symbian executable program, which was quickly found, is a function named _ e32startup. Immediately follow the pictures and pictures of yourself on Windows
Write winmaincrtstartup, write a function with the same name, leave the implementation blank, and try to replace the default entry provided by the compiler.

The progress of this small job
The display is not so smooth. The first write is void _ e32startup (), and the result compilation and link are smooth. However, you can view the map file generated at the same time to find the entry point.
_ E32startup is still located in uc_exe _. o
. I realized that there may be a problem with the function prototype or Function Modification (in fact there is a problem), so I finally changed it to the correct extern "C" tint
_ E32startup (), but the link still does not pass, the report "there are multiple _ e32startup ".

In desperation, I had to check the linker command.
Line. Carbide. c ++ does not provide any interface for modifying project compilation options or link options. In fact, these items are also automatically generated. In the end
In epoc32/build, the make file generated by carbide. c ++ for my test project is found.
The file is automatically named Tiny. armv5.
In the generation rules, find evidence of forcible link to the default startup code, that is, reference in the command line
$ (Epocstatlinkurel)/eexe. Lib (uc_exe _. O ). I deleted the reference and went back to the carbide. c ++ integrated environment.
Clean and perform the build operation (thank God, the modified make is not automatically generated and overwritten), the target file tiny.exe
It was born smoothly. From the corresponding map file, it is very clean and there are no other symbols.

In principle, this should have been done. But I did not happen to have been around a few days ago.
The loader checks whether the first command of the EXE entry point is tst pc or 0. Apparently, I wrote it in C ++.
_ E32startup
The function could not meet this requirement, so I thought of using the embedded assembly method. Who knows how to get into the quagmire. First, there is a problem to be solved: The instruction must be the first one, so the compiler cannot
The PROLOG and epilog of the function. This requires that the function be a naked attribute. Fortunately, rvct supports such functions and adds _ ASM before the function.
. At this time, the function body is still empty. The error message after compilation is: the entry point does not point to any command (l6204e: Entry Point
(0x00008000) does not point to
Instruction ). Then I wrote down the damn command with confidence and re-compiled it. The result still failed to be compiled. The error message changed: instruction, offset, immediate count, and register
The combination is not supported under the current Instruction Set (a1616e: instruction, offset, immediate or register
Combination is not supported by the current Instruction
Set ). Then I changed the policy again, and hard-coded the operation code corresponding to the command with the DCD command in place. The error returned to the beginning (that is, the entry point is not the instruction ).

Since I had previously communicated with other colleagues who tried to use embedded assembly in the program, I decided not to compete with embedded assembly, but prefer to use an independent assembly language module to solve the problem. It took about one day to figure out the format of the assembler accepted by armasm, and compile a. s source program into a corresponding. O.

Upper
This section outlines a tangle of intermediate processes, that is, the formats of gcce embedded assembly and rvct Embedded Assembly are different. The assembly code in Symbian that I see is written in
In the. CIA file, this is a file written in a mix of C ++ and assembly, but the format of Assembly commands adopts gcce specifications. Use rvct now
The assembler compilation in involves a translation process. When searching materials on the Internet, someone accidentally said that if the. CIA file is compiled in the rvct environment, it will be pre-processed by the compilation system to generate
Valid input accepted by the rvct assembler. I spent a lot of effort to find the translation program code in the second generation compilation system Raptor of Symbian, using Perl
The name is tranasm. pl. Using it to translate a. CIA file for reference and comparison, I have gained a lot and explained a lot.
In the assembly instructions exist in the puzzle. I hope this tool will be helpful to later colleagues.

Questions left over. My colleagues helped me in my research.
There is no answer to a strange thing: The rvct mentioned above
Some Embedded Assembly commands cannot be compiled, but they can be used in his project. The difference is that his project is a driver. This difference may make sense, but I haven't found it yet.
By now, the compiler will use evidence of different embedded assembly instruction review rules based on the type and function of the target file. It takes time to learn more.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.