OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 5:55 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Was: SMP (on intel) set address of code
PostPosted: Wed Apr 12, 2017 12:25 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 14, 2013 6:01 pm
Posts: 442
for my -how-to-do-a-kernel-within-days-without-experience- unreal mode bootable emulator that is using CHS tuple and polling even for the timers and mouse input, i guess it will not ruin the experience even more if i just kicking the cores in with a pair of russian steel toe boots.

its not an issue if bad/disabled cores are coming online, spinning the emulation environment not needs any features, so it will work even with an extremely damaged cpu if the basic comparison and register accessing opcodes are working.

i just need a method to find out the CPU number (maybe CPUID will do it) so i can know what memory location should i crawl.

_________________
Operating system for SUBLEQ cpu architecture:
http://users.atw.hu/gerigeri/DawnOS/download.html


Top
 Profile  
 
 Post subject: Re: SMP (on intel) set address of code
PostPosted: Wed Apr 12, 2017 12:29 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

Geri wrote:
for my -how-to-do-a-kernel-within-days-without-experience- unreal mode bootable emulator that is using CHS tuple and polling even for the timers and mouse input, i guess it will not ruin the experience even more if i just kicking the cores in with a pair of russian steel toe boots.


If this is your goal; the single most productive thing you can (that would benefit yourself and the entire world the most) is to give up programming anything completely.


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: SMP (on intel) set address of code
PostPosted: Wed Apr 12, 2017 12:35 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 14, 2013 6:01 pm
Posts: 442
human lifespan is limited, and x86 is not my friend.

_________________
Operating system for SUBLEQ cpu architecture:
http://users.atw.hu/gerigeri/DawnOS/download.html


Top
 Profile  
 
 Post subject: Re: SMP (on intel) set address of code
PostPosted: Wed Apr 12, 2017 12:55 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

Geri wrote:
human lifespan is limited, and x86 is not my friend.


In the long run; learning how to do something right and then doing it right the first time (or at least trying to do it right the first time) is faster and easier. The alternative is being too ignorant to bother and then (when faced with the inevitable "worthless piece of crud" results) having to throw it all in the trash and start again with zero useful code and zero useful knowledge and zero useful experience (except for learning that doing things right the first time saves you years of pointless effort).


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: SMP (on intel) set address of code
PostPosted: Wed Apr 12, 2017 1:10 pm 
Offline
Member
Member
User avatar

Joined: Wed Jan 06, 2010 7:07 pm
Posts: 792
There is something to be said though for starting out the "wrong" way and incrementally improving things. That approach will teach you things you would have missed by trying to do everything perfectly from the start, and because you've acknowledged that you're going to be improving things over time, you won't be stuck with your head up your arse on some design that makes no sense in the real world.

That is, of course, different from taking shortcuts with no intention of fixing them later. But even that can be a reasonable approach if you're not aiming for a production OS and your main goal lies elsewhere.

_________________
[www.abubalay.com]


Top
 Profile  
 
 Post subject: Re: SMP (on intel) set address of code
PostPosted: Wed Apr 12, 2017 1:26 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 14, 2013 6:01 pm
Posts: 442
Brendan wrote:
In the long run; learning how to do something right and then doing it right the first time (or at least trying to do it right the first time) is faster and easier. The alternative is being too ignorant to bother and then (when faced with the inevitable "worthless piece of crud" results) having to throw it all in the trash and start again with zero useful code and zero useful knowledge and zero useful experience (except for learning that doing things right the first time saves you years of pointless effort).


if you are a game developer, your passion is to be a game developer, your identity is a game developer, your job is a game developer, then you should learn how to write a game properly: how to render the graphics, find proper ways to load your models and textures, research how you can render efficiently, how you create the content efficiently, how you reach the most users, how to do the actual game itself, how to sell to the users itself.

if you are common to programming, but you are not a game developer, you will never have to create a game again, gamedev are not your passion, you just need it for some purpose when it does not matter what the quality of the game is, becouse the game itself is not the product, becouse something else is the product, but you need to have a game too, then you may just probably write a few for cycle with middle scool math skills to render the scene out, putting as little efforts as possible (or you use some external game engine where you just click the content together).

for example if you want to build a christmas light flashing performance around your house this year, you will not put years into researching possible methods of fourier transformations, you will not build your own relays to switch on and off the lights with half year of work, you will not attend to a special art scool to learn how to create good impressions with switching on and off lights - you just check the solutions quickly, you probably solder some cheap relay together to a chinese tape recorder with rithmic light flashing effect, and you just put the lights quickly around your roofs and trees.

and maybe your product is to sell a book about the evil santa claus to the people who gathering to look at your lights.

_________________
Operating system for SUBLEQ cpu architecture:
http://users.atw.hu/gerigeri/DawnOS/download.html


Top
 Profile  
 
 Post subject: Re: SMP (on intel) set address of code
PostPosted: Wed Apr 12, 2017 1:42 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

Rusky wrote:
There is something to be said though for starting out the "wrong" way and incrementally improving things. That approach will teach you things you would have missed by trying to do everything perfectly from the start, and because you've acknowledged that you're going to be improving things over time, you won't be stuck with your head up your arse on some design that makes no sense in the real world.

That is, of course, different from taking shortcuts with no intention of fixing them later. But even that can be a reasonable approach if you're not aiming for a production OS and your main goal lies elsewhere.


As far as I'm concerned, it's about trying to maximise the amount of useful knowledge/experience that you gain; so that you reach "enough knowledge/experience" in the least iterations.

When someone is deliberately trying to minimise the amount of useful knowledge/experience they gain; all they're doing is wasting their time and wasting our time. Worse, they tend to influence other beginners while they're here (who influence other beginners, who...), and there's a very real risk of "plague of ignorance". It's much better to annihilate the root cause before the disease spreads.

Geri wrote:
if you are a game developer, your passion is to be a game developer, your identity is a game developer, your job is a game developer, then you should learn how to write a game properly: how to render the graphics, find proper ways to load your models and textures, research how you can render efficiently, how you create the content efficiently, how you reach the most users, how to do the actual game itself, how to sell to the users itself.

if you are common to programming, but you are not a game developer, you will never have to create a game again, gamedev are not your passion, you just need it for some purpose when it does not matter what the quality of the game is, becouse the game itself is not the product, becouse something else is the product, but you need to have a game too, then you may just probably write a few for cycle with middle scool math skills to render the scene out, putting as little efforts as possible (or you use some external game engine where you just click the content together).

for example if you want to build a christmas light flashing performance around your house this year, you will not put years into researching possible methods of fourier transformations, you will not build your own relays to switch on and off the lights with half year of work, you will not attend to a special art scool to learn how to create good impressions with switching on and off lights - you just check the solutions quickly, you probably solder some cheap relay together to a chinese tape recorder with rithmic light flashing effect, and you just put the lights quickly around your roofs and trees.

and maybe your product is to sell a book about the evil santa claus to the people who gathering to look at your lights.


I'm not interested in retarded excuses. Whether your end product is an OS or not; you are talking about low level code that everything else will be depend on. If that low level code is sewerage everything else will be built on top of sewerage. The only thing you can successfully build on top of sewerage is more sewerage.


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: Was: SMP (on intel) set address of code
PostPosted: Wed Apr 12, 2017 4:49 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 14, 2013 6:01 pm
Posts: 442
edit: fixed the bug in this snippet, and modifyed the code so maybe someone will find it usefull


ok well lets see

Code:
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:
// *************
// 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)

_________________
Operating system for SUBLEQ cpu architecture:
http://users.atw.hu/gerigeri/DawnOS/download.html


Last edited by Geri on Wed Apr 12, 2017 7:01 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Was: SMP (on intel) set address of code
PostPosted: Wed Apr 12, 2017 6:54 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

Geri wrote:
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


Probably because you overlooked something simple, like segmentation.

Geri wrote:
(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)


It's not that 80x86 is too complicated - hundreds of people have not had much problem with SMP startup. You would have similar problems with any platform (even if someone created a CPU specifically for SUBLEQ).


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: Was: SMP (on intel) set address of code
PostPosted: Wed Apr 12, 2017 6:59 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 14, 2013 6:01 pm
Posts: 442
oops, i find a problem

it has to be aligned to 4096 byte boundary, and not 16. given eip is multiplied by 4096

(and no, my subleq specifications does not have mp init methods, just table for they status and they eips.)

_________________
Operating system for SUBLEQ cpu architecture:
http://users.atw.hu/gerigeri/DawnOS/download.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: cloudapio, Majestic-12 [Bot] and 176 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group