Full Multicore Support is almost here

Topics: Developing Cosmos (Working on Cosmos source code directly), Other, Using Cosmos (Developing your own OS, projects, etc)
Developer
Mar 27, 2014 at 8:13 PM
After days of Reading Intel Docs and trial and error , i finally have support for multi-core cpus in my kernel. Its still in its early stage

Right now the extra core(s) runs in real mode successfully.

Hopefully i will update cosmos source code after i have finished fine tuning it :)
Coordinator
Mar 28, 2014 at 11:17 AM
As long as there's no memory management which reclaims memory, using multi-core's is a bit pointless, as you'll run out of memory way too easy..

On a side note: would you be interested in helping out moving cosmos as a project forward?



2014-03-27 21:14 GMT+01:00 forest201 <[email removed]>:

From: forest201

After days of Reading Intel Docs and trial and error , i finally have support for multi-core cpus in my kernel. Its still in its early stage

Right now the extra core(s) runs in real mode successfully.

Hopefully i will update cosmos source code after i have finished fine tuning it :)

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Developer
Mar 28, 2014 at 2:16 PM
I had memory manager (HMI) but i lost all my kernel code so im starting a new one. I already coded a new memory manager before i started coding for multi-core cpu. My problem now is deciding whether i should divide the IRQs between Cores like let Core0 handle IRQ0 to RQ7 and Core1 handle the rest
Coordinator
Mar 28, 2014 at 2:27 PM
Would you be willing to join cosmos development?



2014-03-28 15:16 GMT+01:00 forest201 <[email removed]>:

From: forest201

I had memory manager (HMI) but i lost all my kernel code so im starting a new one. I already coded a new memory manager before i started coding for multi-core cpu. My problem now is deciding whether i should divide the IRQs between Cores like let Core0 handle IRQ0 to RQ7 and Core1 handle the rest

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Developer
Mar 28, 2014 at 2:35 PM
Sure
Coordinator
Mar 28, 2014 at 2:48 PM
We could really use some help in getting us forward again, and it seems you have the right mentality (= doing some research on your own).
Are you also interested in doing some "not-to-fancy"-jobs?
If so, please join our mailinglist, and we'll get you going....



2014-03-28 15:35 GMT+01:00 forest201 <[email removed]>:

From: forest201

Sure

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Mar 30, 2014 at 2:09 AM
How about using those cores for running BIOS Interrupts?
With that we could easily switch between Video Modes without much
hassle.
Curious, have you been able to enable the APICs into non-legacy (whatever that's called) mode?
Coordinator
Mar 30, 2014 at 8:44 AM
Problemw ith bios interrupts (and why cosmos itself wont be able to use bios interrupts), is that you completely lose interrupts when doing interrupts..



2014-03-30 4:09 GMT+02:00 ALLDESP <[email removed]>:

From: ALLDESP

How about using those cores for running BIOS Interrupts?
With that we could easily switch between Video Modes without much
hassle.
Curious, have you been able to enable the APICs into non-legacy (whatever that's called) mode?

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Mar 30, 2014 at 3:18 PM
You can execute BIOS Interrupts inside a emulated environment, That's how Windows uses it if it doesn't find a proper driver for the attached Graphics Adaptor, the BIOS ROM is executed in high memory, inside an emulator which is present in HAL.DLL (iirc) or Cosmos can use Death(Virtual) 8086 Mode which is crap since it's kicked off in Long Mode so no such crap in 64-bit Mode, So yeah emulator seems to be the best choice for Cosmos in order to use hi-res modes. I think IRQs maybe lost since the BIOS Handles the IRQ itself....
Coordinator
Mar 31, 2014 at 9:03 AM
Windows 98 did so, but win2000 and up doesn't do. It caused the freezes when accessing a dirty CD-disk, etc. Which is why we (= cosmos) don't want to use v86 mode...



2014-03-30 17:18 GMT+02:00 ALLDESP <[email removed]>:

From: ALLDESP

You can execute BIOS Interrupts inside a emulated environment, That's how Windows uses it if it doesn't find a proper driver for the attached Graphics Adaptor, the BIOS ROM is executed in high memory, inside an emulator which is present in HAL.DLL (iirc) or Cosmos can use Death(Virtual) 8086 Mode which is crap since it's kicked off in Long Mode so no such crap in 64-bit Mode, So yeah emulator seems to be the best choice for Cosmos in order to use hi-res modes. I think IRQs maybe lost since the BIOS Handles the IRQ itself....

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Developer
Mar 31, 2014 at 3:50 PM
Edited Mar 31, 2014 at 3:53 PM
Yes the other core can run BIOS interrupts and I have enabled both the Local APICs and I/O APIC

Im having a serious problem having the other CPU core enter Protected Mode.

It stops after " jmp dword 08h:BootFlushCS ".
jmp RealMode
RealMode:
 
    mov byte [0x580],0x01 ;  memory address 0x580 monitors the last completed Instruction or sets of instructions

    mov ax,0
    mov ds,ax  
    mov ss,ax
    cli

    mov byte [0x580],0x02
     
    mov dword ESP, [0x520] ; Kernel_Stack  from Core 0
    mov dword EAX, [0x530] ;GDT Pointer from Core 0
    lgdt [EAX] 
    
    mov byte [0x580],0x03 
    mov dword EAX, CR4
    or dword EAX, 0x100
    mov dword CR4, EAX
    mov dword EAX, CR4
    or dword EAX, 0x200
    mov dword CR4, EAX
    mov dword EAX, CR0
    and dword EAX, 0xFFFFFFFD
    mov dword CR0, EAX
    mov dword EAX, CR0
    and dword EAX, 0x1
    mov dword CR0, EAX

    mov byte [0x580],0x04 
    jmp dword  08h:BootFlushCS
    
 BootFlushCS:
     
    mov byte [0x580],0x05
     
    mov word AX,0x10 
    mov word DS, AX  
    mov word ES, AX   
    mov word FS, AX    
    mov word GS, AX 
    mov word SS, AX
     
    mov byte [0x580],0x06 
    
    mov dword EAX, [0x540]; IDT Pointer
    lidt [EAX]  

   mov byte [0x580],0x07    
   call PMode
    
 Boot_FlushCsGDT.loop:
    cli
    hlt
    jmp Boot_FlushCsGDT.loop
    ret 0x0


[BITS 32]
PMode: 
   mov byte [0x580],0x08 
   mov word [0xB8022],0x48 ; H
   mov byte [0xB8023],0x04
   mov byte [0xB8024],0x45 ; E
   mov byte [0xB8025],0x04
   mov byte [0xB8026],0x4C ; L
   mov byte [0xB8027],0x04  
   mov byte [0xB8028],0x4C ; L
   mov byte [0xB8029],0x04
   mov byte [0xB802A],0x4F ; O
   mov byte [0xB802B],0x04
Mar 31, 2014 at 4:36 PM
Edited Mar 31, 2014 at 4:37 PM
Ah now that's some assembly!
LGDT Expects the Linear Address of the Global Descriptor Tables, you seem to be providing an offset,
try putting the GDT Manually. Does it stop or triple fault? (Reboot)
If it stops then it's executing an "HLT" (0xF4) is being directly or indirectly being executed, which will simply halt since interrupts are disabled and HLT waits for a NMI/Interrupt to increment CS:EIP.
Hoping that CS is the segment contains your GDT Descriptor to the offset try:
LGDT [CS:_GDT]
Developer
Apr 2, 2014 at 3:11 PM
Edited Apr 2, 2014 at 3:19 PM
Ahhh... i solved the problem. It was a memory alignment.

I got the The Other core to Enter Protect Mode and enable interrupts. Now the Issue is Core 1 fires a Software IRQ 0x41 which generates a General Fault Protection if it uses Kernel Stuff like " Console.WriteLine ". I think it caused by stack corruption/overwrite because both cores use the same Kernel Stack.

then i use the code like this
   private static void IRQ41(ref Cosmos.Core.INTs.IRQContext aContext)
        {
           unsafe 
           {
                  *(byte*)(0xB8002) = (byte)(char)('H');
                  *(byte*)(0xB8003) = 0x04;
            }
        }

And

   private static void IRQ41(ref Cosmos.Core.INTs.IRQContext aContext)
        {
            SyncCore = true;   //Try to prevent Core 0 from using  ' Console.WriteLine'  while Core 1 is using it
            Console.WriteLine("Core 1 is Here");
            SyncCore = false;
        }
First One produces a Exception 0x06 InvalidOpCode
Second produces a General Fault Protection

Any Idea as to how i can fix this issue?

( Its so funny that you can still use the OS even if Core 1 has an exception )

Image
Developer
Apr 2, 2014 at 4:15 PM
Edited Apr 2, 2014 at 4:15 PM
:) no need i solved it already

Now its time to switch back to Real Mode for VESA