Optimal method to identify core private data
Posted: Sat May 07, 2011 10:02 am
OK, so now I have both versions of the code debugged and tested.
Using the private GDTR per core gives the following code to lock the scheduler:
Using TR gives the following code to lock the scheduler:
To get the current thread looks like this:
Using private GDTR:
Using TR:
I think the GDTR method outcompetes the TR method easily, and it additionally does not require disabling interrupts.
Using the private GDTR per core gives the following code to lock the scheduler:
Code: Select all
push 40h
pop fs
add fs:ps_nesting,1
Code: Select all
push ax
cli
str ax
add ax,10h
mov fs,ax
add fs:ps_nesting,1
pop ax
sti
Using private GDTR:
Code: Select all
push ds
mov ax,40h
mov ds,ax
mov ax,ds:ps_curr_thread
pop ds
Code: Select all
push ds
cli
str ax
add ax,10h
mov ds,ax
mov ax,ds:ps_curr_thread
sti
pop ds