Is there any one who can explain this code to me?
This is an old exam question and i can’t find an answer on the net.
void (*x)(); x=0xFFFF0000; printf("1"); x(); printf("2"); x(); printf("3"); x();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
On classic real-mode x86 architectures, you could trigger a system boot by doing an unconditional JMP to address 0xFFFF0000.
The code is basically defining
x()as a function, and setting the function’s in-memory address as 0xFFFF0000. When you invoke the function, the system would doCALL 0xFFFF000or similar at the assembler level, and jump directly to the BIOS boot code, triggering a system reboot.