How can I access an interrupt vector located at the machine’s location 0? If I set a pointer to 0, the compiler might translate it to some nonzero internal null pointer value.
Share
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.
Since whatever is at location 0 is obviously machine dependent, you’re free to use whatever machine-dependent trick will work to get there. Read your vendor’s documentation. It’s likely that if it’s at all meaningful for you to be accessing location 0, the system will be set up to make it reasonably easy to do so. Some possibilities are:
Simply set a pointer to 0. (This is the way that doesn’t have to work, but if it’s meaningful, it probably will.)
Assign the integer 0 to an int variable, and convert that int to a pointer. (This is also not guaranteed to work, but it probably will.)
Use a union to set the bits of a pointer variable to 0:
Use memset to set the bits of a pointer variable to 0:
Declare an external variable or array
and use an assembly language file, or some special linker invocation, to arrange that this symbol refers to (i.e. the variable is placed at) address 0.