flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Use multiprocessoring

Author
Thread Post new topic Reply to topic
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 31 Jul 2018, 07:52
Hello, i have just one question, how is it possible in assembly to use multiprocessoring ? Have you got simple example ?
Post 31 Jul 2018, 07:52
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 31 Jul 2018, 10:33
Depends on what you mean by “multiprocessoring”, i.e. what particular task you’re trying to solve.
Post 31 Jul 2018, 10:33
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20460
Location: In your JS exploiting you and your system
revolution 31 Jul 2018, 10:50
If you are using an existing OS then you can use the threading APIs to get other threads running.

Then there are the synchronisation APIs you can use to get things happening in the sequence you need.
Post 31 Jul 2018, 10:50
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 31 Jul 2018, 19:57
No, its about os construction.

For example, i would like to use first core or my processor to launch 16bits code, and use second to launch 64bits code.

Is it possible ?
Post 31 Jul 2018, 19:57
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20460
Location: In your JS exploiting you and your system
revolution 31 Jul 2018, 20:05
Moved to "OS Construction"
Post 31 Jul 2018, 20:05
View user's profile Send private message Visit poster's website Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 01 Aug 2018, 02:09
This topic may help: https://board.flatassembler.net/topic.php?p=108312

You have to send inter-processor interrupts (IPI) to the other cores, which requires that interrupts are properly set up for IO APIC, which in turn requires either the multi-processor (MP) table information from BIOS or (if I remember correctly) the later x2APIC and ACPI tables.
Post 01 Aug 2018, 02:09
View user's profile Send private message Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 25 Sep 2018, 11:33
I have looked your example, but i don't understand very well.

How you can, for example launch in parralel 32 bits and 16 code at the same time. Is it in real time ? Or multiprocess is impossible ?
Post 25 Sep 2018, 11:33
View user's profile Send private message Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 30 Mar 2020, 18:58
I have studied the problem.

I need i think to make TSS descriptor into GDT and enable multiprocessoring.

Do you know good documentation about multiprocessoring ?
Post 30 Mar 2020, 18:58
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 30 Mar 2020, 21:31
Post 30 Mar 2020, 21:31
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20460
Location: In your JS exploiting you and your system
revolution 30 Mar 2020, 23:18
Fulgurance wrote:
I have studied the problem.

I need i think to make TSS descriptor into GDT and enable multiprocessoring.

Do you know good documentation about multiprocessoring ?
TSS is related to task switching, and isn't directly related to using multiple CPUs.

If you want to use multiple processors (either logical or physical CPUs) then you will need to look into communicating between your CPUs. Read about the mailbox for passing messages among the processors in the system.
Post 30 Mar 2020, 23:18
View user's profile Send private message Visit poster's website Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 514
Location: Czech republic, Slovak republic
Feryno 31 Mar 2020, 07:33
if you have UEFI there are multiprocessor protocols so you can do some experiments even without OS
here you have a sample
https://board.flatassembler.net/topic.php?t=16187
the sample tries 3 ways: the most common MP protocol, if it fails then second one, if both fail then manually (sending INIT-SIPI) - the manual way is just as simple as possible as it does not care about possible defective cores turned off by firmware (it sends IPI from BSP to all but self so it can wake up defective cores)

there is also one tricky way if you want to use only BIOS and your code is realmode - hooking int2 vector, sending NMI to all but self so AP CPUs start to execute code from NMI vector = int2 and then restore the NMI vector (this is possible because firmware already woke up every CPU when enumerating them while creating ACPI tables and then put them asleep state from which they could be waken up by NMI) but anyway in this case the BSP CPU must enable protected mode and paging to be able to reach APIC (memory at physical address FEE00000h) to send the IPI, you also have to solve a stack problem as all CPUs start with the same SS:SP at the same time (e.g. using CPUID to get APIC ID which is unique so you can setup unique stack for every CPU)
Post 31 Mar 2020, 07:33
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
guignol



Joined: 06 Dec 2008
Posts: 763
guignol 01 Apr 2020, 08:52
tell us revō what does differ thread from a core
like about that one 64-core CPU with 128 threads
?
Post 01 Apr 2020, 08:52
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.