3.61 Home Work and 20135316 cooperation

Source: Internet
Author: User

3.61

The code in the problem will generate 6 temporary variables in the loop , so there is a total of six registers to hold the data, but due to the processor's six registers,%esp and %EBP cannot be used to hold temporary data, The other register must also be used to save the result of the multiplication instruction. Therefore, you must reduce the number of values in a loop to 5 .

When there are not enough registers to hold the temporary data, the compiler must put some local variables into the memory

Because the code in each loop to remove the value of N from the memory to check whether the loop is terminated, so I think we can remove each time the reduction process, directly with the immediate number to control the end of the loop. The code is as follows:

int Var_prod_ele (int n, int a[n][n], int b[n][n], int i, int k) {int j = n-1;     int result = 0;     for (; j!=-1;--j) result + = A[i][j] * B[j][k]; return result; }

However, the resulting results will still be used in memory.

According to the following code, the loop does not seem to use memory.

But with a constant of 4, which is add 4 When A is added .

Only need result,,e,< Span style= "font-family: ' Courier New ';" >b,4n

The idea is to initialize the a The rows of the array and b array of columns, remember their addresses, and remember a The address of the last element of the row of the array, followed by a transformation of aa The last element address of the array is compared to control the end of the loop. If you do not reach a The last element of the array row, aB The array moves down in turn until the last element is reached. The code is as follows:

int Var_prod_ele (int n, int a[n][n], int b[n][n], int i, int k) {int result = 0;     int *a = &A[i][0];     int *b = &B[0][k];     int *e = &A[i][n];     for (; a!=e;)         {result + = *a * *B;         B+=n;   a++; } return result; }

3.63

E1 and E2 are macro expressions declared with # define, with parameters representing the dimensions of the A matrix.

int Sum_col (int n, int a[e1 (n)][e2 (n)],int j) {

int i;

int result = 0;

for (i = 0; i < E1 (n); i++)

Result + = A[i][j];

return result;

}

1. Analysis of observations obtained through the exchange of information.

The most commonly used protocol reverse engineering involves the use of bus analyzers and packet sniffers. After access to the computer bus or network connection, and the successful interception of communication data, the bus or network behavior can be analyzed to create a communication with the same behavior implementation. This method is particularly suitable for reverse engineering of device drivers. Sometimes tools made intentionally by hardware manufacturers, such as JTAG ports or various debugging tools, can also help reverse-engineer embedded systems. For Microsoft's Windows system, the popular bottom debugger has softice.

2. Disassembly, that is, the use of the disassembler, the original machine code of the program, translated into a more convenient reading comprehension of the assembly code. This applies to any computer program and is particularly useful for people unfamiliar with the machine code. Popular related tools are Ollydebug and Ida.

3. Decompile, that is, using the anti-compiler, try to reproduce the high-level language source code from the program's machine code or byte code.

E1 (n) in esi ,esi = 3n.

E2 (n) in ebx ,ebx = 4*e2 (n) = (2n-1).

So E2 (n) = 2n-1.

3.61 Home Work and 20135316 cooperation

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.