2 Questions:  va_args and APIC... hope you can hel

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
dr_watts

2 Questions:  va_args and APIC... hope you can hel

Post by dr_watts »

I have recently been working on my thesis project and have come to a roadblock.  I need a printk to do some debug information while I create some APIC code and setup interrupts.  However, my original Print function worked fine, only it would not print numbers.  The new one, it will print numbers, but no where near correctly.  I rewrote it using va_args, and yet it returns the number 2096840 when it should return 2... this is obviously a problem when I am going to need exact addresses to work.  The basic problem:  I have an itoa function which works perfectly.  I am passing to it using va_args techniques.. which obviously do not work.  They are defined as macros, and keep in mind this is a 64-bit environment, although that should not change things.  

My second question involves the APIC, although this is not as important.  I have a dual processor Opteron test system which has of course two Local APIC's.  Chapter 8 of the Intel Manuals V.3 states the memory address an APIC is mapped to.  My question:  What if you have two Local APIC's?  How can you access both?    

Any help would be terriffic

Thanks,

dr_watts
Xenos

RE:2 Questions:  va_args and APIC... hope you can help with

Post by Xenos »

Both APICs are normally mapped to 0xFEE00000. Each processor has (and can only access) its own APIC. That is because all data transfers to/from the APIC address range are caught and redirected to the APIC internally, they never reach the external bus. The only way to access both APICs is to have your code running on both CPUs.

BTW: I wish I _had_ a dual processor system...


Perhaps you could post your print function's code?
dr_watts

RE:One Last Question I guess

Post by dr_watts »

Well, the va_args was simply a problem of 32 to 64 bit conversion.  I had to use long, which in x86-64 is 64-bit, as opposed to int, which was used in the va_args macro...  But it works now..

Also, thanks for the APIC help, but I have one last question.  Is there a method to grab a Local APIC ID without having code running on its processor?  Is that stored somewhere?  I didn't see anything about that in the Intel manuals, although I apologize if this is a stupid question.

Thanks
Xenos

RE:One Last Question I guess

Post by Xenos »

Have a look at Intel's Multiprocessor Specification, chapter 4.3.1. The BIOS of MP compliant system manages a config table including Local APIC IDs.
Post Reply