cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

maxinator
Journeyman III

How to use DualCore with mere assembler?

yeah, like the topic says, i want to let my tiny self-programmed operating system use dualcore-support, but i cant find really anything, which could describe me how i acces the second core.
I hope somebody here in this community can give me some links to technical-docs or so. But the best would be, if someone could give me a small example-code and a link to a document, so that i can learn with this exemple-code.
As exemple a program in assembler, which creates 2 tasks, which do some different things, like adding eax to ebx.



My imagination:
main_program:
load_in_core0 program_task1
load_in_core1 program_task2

program_task1:
mov ecx,2
mov eax,9
rep mul eax

wait_for_program_task_2
ret_main_program

program_task2:
add eax,2

wait_for_program_task_2
let_this_core_sleep_and_let_the other_core_return_to_the_main_code

EDIT: i found something, that would fit my needs, but its written in c++, but i need it in assembler: http://developer.amd.com/articles.jsp?id=79&num=1
0 Likes
2 Replies
stroia
Staff

These are very very low level concepts. There is no specifc document I can point you to that has the assembly code you are looking for. But, I have a few different suggestions you may want to pursue.

If your operating system is running on top of some other operating system, you could use OS calls to start a thread and specify the processor affinity.

Check the BIOS Guide that corresponds with your processor. They can be found here: http://developer.amd.com/devguides.jsp http://developer.amd.com/devguides.jsp
This bit may be what your assembly code needs to trigger:
CPU1 Enable (Cpu1En) - Bit 5. Enables a second CPU core, if it is implemented on the node. When this bit is set the second CPU core begins fetching code. This bit should only be set for nodes which have two CPU cores.
0 = Second CPU core disabled or not present
1 = Second CPU core enabled

You could also download an open source operating system and study they way they do it. Linux is probably best for this, but you could also check out Solaris or QNX Neutrino.
0 Likes
maxinator
Journeyman III

If your operating system is running on top of some other operating system, you could use OS calls to start a thread and specify the processor affinity.

No, my OS shall not and is not running on top of a other OS, thats the problem.

You could also download an open source operating system...

... unfortunately i cant download the whole code of one operating-system, 'cause all traffic about 5gb i have to pay myself and isnt included in the flatrate....

I can point you to that has the assembly code you are looking for

I think, that would be the best xD
0 Likes