flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Simple multicore INIT-SIPI-SIPI example |
Author |
|
Feryno 29 May 2019, 19:33
I think you can't access APIC in realmode as realmode limits address to 20 bits and APIC is usually at physical memory FEE00000 on poweron/reset.
So when you set FS to FEE0, then the mov dword [fs:...] is writing into physical memory FEE00 that's into region where BIOS is shadowed (usually E0000-FFFFF) and this mem region is usually readonly so any writing there is discarded. I suggest you to switch to protected mode and map the PA of APIC into some VA. Note you should map it as noncacheable. When you execute cli \ hlt this could be woken up by NMI so this is better: Code:
@@:
cli
hlt
jmp @b Also note you sent INIT-SIPI to all but self so all APs start to run simultaneously at once so you can't execute any call either interrupt either anything which uses stack because you set all CPUs the same stack (SP=0, SS even not set). This could be solved by assigning unique stack for every AP. But your payload is simple enough and does not use any instruction which uses stack. Your payload is the same for all APs so when (in the feature) your code starts to do what do you want it to do, you won't know which AP wrote the byte 41h to the upper left corner of your textmode screen. Instead of setting di to 0 (mov di,00h) for every AP, this is better: Code: mov di,2 lock xadd [position],di mov al, 41h mov ah,... ; also set AH register to some well visible color stosw @@: cli hlt jmp @b position dw 0 ; intially the position set to 0 that way you will see the count of APs started So simple answer to your question is: Code is not working due to realmode limitation. |
|||
29 May 2019, 19:33 |
|
vitor19897 30 May 2019, 12:09
Hi Feryno! Thank you very much for your reply!
I missed that the APIC base address is an absolute address because how I read the APIC_BASE_MSR and it returns FEE00000 in real mode, I assumed that it is a segment:offset address. Now I know why it is not working. I need to go to protected or unreal mode to do that. 1 - Could you please help me to understand why using "cli \ hlt" can be woken up by NMI? Probably I do not understand because I do not know what is "@@" and "@b". 2 - "PA of APIC into some VA". What is PA and VA? |
|||
30 May 2019, 12:09 |
|
DimonSoft 30 May 2019, 12:50
I’ll try to answer to possibly save your time.
vitor19897 wrote: 1 - Could you please help me to understand why using "cli \ hlt" can be woken up by NMI? Probably I do not understand because I do not know what is "@@" and "@b". Because it’s the nature of NMI, what makes it a non-maskable interrupt: disabling interrupts by CLI (setting IF to zero) doesn’t disable NMI. vitor19897 wrote: 2 - "PA of APIC into some VA". What is PA and VA? From the context, PA stands for physical address, VA stands for virtual address. |
|||
30 May 2019, 12:50 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.