i am using smallerc and inline assembly. the awaken cores jumping into inline assembly code around ~3k, and the threads are working perfectly now.
parts of this process is not pre-deterministic as its going with a C compiler, and i dont have full control on code origins, cs, and ip.
so basically i jump into assembly code which is works (it does what i want), and i try to enable unreal mode with the Big Unreal Mode trick ( http://wiki.osdev.org/Unreal_Mode ) by using the given code snippet (except using different sp to not grind code down).
mov ds, bx crash. (even if i try to execute this code snippet from the bootstrap core, it is crashing, so its broken)
what could be the reason?
i suspect that i must set gdtinfo base into something.
a tryed the folowing:
i attempted to grind down cs to 0 if the case its not 0, in the hope that is maybe required for simplier handling
Code: Select all
"xor ax, ax\n"
"mov ds, ax\n"
"mov ss, ax\n"
"mov ebx, 0\n"
"mov ecx, 0\n"
"mov edx, 0\n"
"mov fs, ax\n"
"mov gs, ax\n"
"mov es, ax\n"
"mov sp, 57344\n"
"mov ax, cs\n"
"cmp ax, 0\n"
"je nincsmarcx\n"
"mov cx, 16\n"
"mul cx\n"
"add ax, 16\n"
"push 0\n"
"push ax\n"
"retf\n"
"nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n" "nop\n"
"nincsmarcx:\n"
i tried to mov several values with mov [gdt+2], ax, where i tried to set ax to cs*16 for example, not sure if made it properly, since the crash at mov ds, bx still stayed.
Code: Select all
"mov ax, cs\n"
"mov cx, 16\n"
"mul cx\n"
"mov [gdtinfo+2], ax\n"
EDIT 1:
possibly i am assuming the reason (wrong data in gdtinfo) of the problem to be wrong, and itself the pointer of gdtinfo is bad.
EDIT 2:
what the hell? i got a20 unlocked and 32 bit width at DEFAULT from the AP-s alreday? isnt they supposed to be in 16 bit real mode?