edit: fixed the bug in this snippet, and modifyed the code so maybe someone will find it usefull
ok well lets see
Code: Select all
void smpinitasm(unsigned int eipuj){ // 000C46XXH
asm(
"MOV ESI, 0xFEE00300\n"
"MOV EAX, 0x000C4500\n"
"MOV [ESI], EAX\n"
"MOV EBX, 99999999\n"
"varakozik:\n"
"SUB EBX, 1\n"
"CMP EBX, 0\n"
"jne varakozik\n"
"MOV DWORD EAX, [bp+8]\n"
"MOV [ESI], EAX\n"
"MOV EBX, 199999999\n"
"varakozik2:\n"
"SUB EBX, 1\n"
"CMP EBX, 0\n"
"jne varakozik2\n"
"MOV [ESI], EAX\n"
"MOV EBX, 199999999\n"
"varakozik3:\n"
"SUB EBX, 1\n"
"CMP EBX, 0\n"
"jne varakozik3\n"
);
}
void smpinit(unsigned long eipuj){ // 000C46XXH
eipuj=0x000C4600|(eipuj/4096);
smpinitasm(eipuj);
}
this supposed to start up all of the cores (if we believe the lies on internet)
no timers yet to wait precisely (i tried multiple values, less and more)
Code: Select all
// *************
// smp
// *************
void smp_blob(){
asm(
...... 4096 nops ..
"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"
"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"
"mov dword eax,72\n"
"mov dword ebx,1024\n"
"mov dword [ebx],eax\n"
"add ebx,1\n"
"mov dword [ebx],eax\n"
"add ebx,1\n"
"mov dword [ebx],eax\n"
"add ebx,1\n"
"mov dword [ebx],eax\n"
"add ebx,1\n"
"mov dword [ebx],eax\n"
"add ebx,1\n"
"mov dword [ebx],eax\n"
"add ebx,1\n"
"mov dword [ebx],eax\n"
"add ebx,1\n"
"mov dword [ebx],eax\n"
"add ebx,1\n"
"mov dword [ebx],eax\n"
this is a binary code meant to be executed on the waking up cores.
(nops are there becouse of security reasons, since the code is in c, not sure how the compiler aligns or places function initialization, so i jump into the bounch of nops) so the address is divisible with
16 4096 always.
this just writes letters from memory address 1024
it works when its generally called
but when its supposed to wake up as the payload of the SMP cores, nothing happens
qemu with params -smp cpus=2,cores=2
something happens, becouse qemu slows down after the call of wake up signals
but the code is not writing the letters, so it not works
(see Brendan, thats why i dont play with x86, and thats why the platform is dieing, becouse its too complicated, and the errors are undeterministic)