i used the following statement to reboot the system.
reboot(0x4321fedc);
can any one give an idea , what is happing internally.
i used the following statement to reboot the system.
reboot(0x4321fedc);
can any one give an idea , what is happing internally.
Read the manual?
Look at the source code?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
The cpu can put data on the data bus to transfer to memory or the i/o bus to transfer to other chips. When it comes across the machine code to reboot it will send an appropriate value via the i/o bus to chips controlling external devices and to it's own reset pin. To find out more about how your particular processor handles reset you need to find a document like this one which is for the Intel Pentium 4 chip.Originally Posted by rama chandra
If you mean what is the parameter used for then, on my Suse Linux system, the command:
describes several alternative parameter values allowing you to vary the outcome by restarting or halting or powering off or changing the outcome off the ctrl-alt-del key sequence. Yours is the power off value.Code:man 2 reboot
He he, one of the constants defined to use as reboot() parameters is LINUX_REBOOT_MAGIC1 is 0xfee1dead.
===
Don't grumble about what you can't have;
be grateful you don't get what you deserve.
see the source code:
see the defines for reboot.Code:#define LINUX_REBOOT_MAGIC2B 369367448 #define LINUX_REBOOT_CMD_RESTART 0x01234567 #define LINUX_REBOOT_CMD_HALT 0xCDEF0123 #define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF #define LINUX_REBOOT_CMD_CAD_OFF 0x00000000 #define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC #define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
The command which u fired 0x4321FEDC is a memory location add which forces the system to execute instruction at memory address specified above .this is usually a hard reset or in lay mans terms a power reset unlike the normal reboot where the POST(power on self test ) doesnt happens...as in the case of 0x01234567
If those are addresses I'll eat my hat. They are ordered sequences of hex digits. Even MAGIC2B is 0x16041998, I wonder what is significant about the 16th of April 1998.Originally Posted by linux_punk
===
Don't grumble about what you can't have;
be grateful you don't get what you deserve.
Maybe the Linux kernel has luggage.
System: Debian Sid and FreeBSD 7.0. Both with GCC 4.3.
Useful resources:
comp.lang.c FAQ | C++ FQA Lite
Whats there to eat ya hat...from the source code thats all i can judge !!!!!Originally Posted by risby
LINUX_REBOOT_CMD_RESTART 0x01234567 ---> first 8 congituous digitsOriginally Posted by linux_punk
LINUX_REBOOT_CMD_HALT 0xCDEF0123 ------> last 4 contiguous digits followed by first 4
LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF ----> last 8 contiguous digits
LINUX_REBOOT_CMD_CAD_OFF 0x00000000 ---> all zeros or is it address of first byte of memory?
LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC -> first 4 non-zero digits descending followed by last 4
LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4 --> alternating alpha digits with numeric digits
Don't you think it would be a lot to ask of the operating system to have to reserve all of these particular memory addresses, jumbled as they are throughout the whole address space, so that either an instruction or possibly another address to jump to could be placed there?
Wouldn't it be better to have your reboot code with its various options all in one place in memory.
These are "magic numbers", simply arbitrary values that indicate different options, not addresses.
===
Don't grumble about what you can't have;
be grateful you don't get what you deserve.
Ah ha!Originally Posted by linux_punk
369367448 decimal = 16041998 hexadecimalCode:#define LINUX_REBOOT_MAGIC2B 369367448
16041998 could be viewed as 16th April 1998
Linus Torvalds' second daughter, Daniela Yolanda, was born on April the 16th, 1998
Well done, linux_punk, you made my day!
===
Don't grumble about what you can't have;
be grateful you don't get what you deserve.
Originally Posted by risby
hehehe..chee thanks!!