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.
I've implemented the SMP startup sequence for the AP's in my kernel. Now inside my AP startup code, I need to have a section that is locked across all processors, so I can assign a different stack for each AP. There is only one instance of this code (in lower memory at 0x1000), so I tried to implement the lock like this:
; Inter-core synchronization
interlock:
dd 0x00000000
acquireLock:
lock bts [interlock], 0
jc acquireLock
ret
releaseLock:
lock btr [interlock], 0
ret
The problem is that NASM tells me that I have an invalid combination of opcode and operands at both of the locked instructions. What is the problem here?
max wrote:The problem is that NASM tells me that I have an invalid combination of opcode and operands at both of the locked instructions. What is the problem here?
The problem is that NASM can't figure out the operand size you want. To fix it either do "lock bts dword [interlock], 0" or "lock bts word [interlock], 0".
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Thanks Brendan, that fixed it. That message is a little misleading because normally NASM will complain with operation size not specified instead of this.