Page 1 of 1
The LOADALL instruction
Posted: Wed Mar 09, 2011 2:42 pm
by Karlosoft
http://www.rcollins.org/articles/loadal ... 3_doc.html
I found this document which speaks about this strange instruction.
It is powerfull... very powerfull I'd like to use it. Does anyone know if is implemented on newer processors under an other opcode or something similar? Is there any way to emulate it in a complete way?
Re: The LOADALL instruction
Posted: Wed Mar 09, 2011 3:28 pm
by Coty
No, it has only been found on i286 and i386 according to the undocumented PC (book)... I also looked to see if any new processers found it, but I found nothing on the internet.. No it cannot be emulated on real hardware, because the CPU checks whether PM is enabled or not before letting you use paging, this was the biggest reseon it was used.
On both the i286 and i386 they also have different opcodes.
Re: The LOADALL instruction
Posted: Wed Mar 09, 2011 4:24 pm
by Combuster
There is a "loadall" instruction on all modern processors - it's called RSM. It's however heavily protected and therefore not usable from the context of an OS.
Re: The LOADALL instruction
Posted: Wed Mar 09, 2011 11:37 pm
by Karlosoft
thank you for the answers, what do you mean with heavily protected?
Re: The LOADALL instruction
Posted: Thu Mar 10, 2011 12:17 am
by Tosi
The processor has to be in system-management mode in order to execute the instruction, and the only way for that to happen as far as I recall is external to the CPU. It's only interesting/useful if you are writing firmware for SMM.
Re: The LOADALL instruction
Posted: Thu Mar 10, 2011 4:00 am
by turdus
Karlosoft wrote:http://www.rcollins.org/articles/loadall/tspec_a3_doc.html
I found this document which speaks about this strange instruction.
It is powerfull... very powerfull I'd like to use it. Does anyone know if is implemented on newer processors under an other opcode or something similar? Is there any way to emulate it in a complete way?
I'm not sure it's powerful. The problem with this kind of opcodes that they save and load a full set of processor state (registers, paging etc. depending on opcode), and it's usually MUCH faster to keep track what's changed and save and load only those. That's the reason why no mainline OS use hardware task switching.
Re: The LOADALL instruction
Posted: Thu Mar 10, 2011 12:58 pm
by Karlosoft
The power of loadall is that you can load everything all the registers the hidden ones too. You can also load you cache descriptors XD this is powerfull XD
Re: The LOADALL instruction
Posted: Thu Mar 10, 2011 11:54 pm
by Tosi
Did you read the article? Only two processors (286 and 386) supported LOADALL, and then the opcodes and format of the data were different. Would you like an operating system that only supports 386, or even worse, 286?
Not only that, it's really not that useful. You can load all of the registers, including the "hidden" ones, by setting up your descriptor tables correctly and loading most of the rest in the usual way.
Re: The LOADALL instruction
Posted: Fri Mar 11, 2011 12:02 am
by Karlosoft
I read the article, but it was a bit old, It has been written more than 10 years ago, this is why I wanted to know if it was any other more modern instruction of that kind on newer processors. I never take for granted what an article on a undocumented feature says
The most but not all. And the cache descriptors have to be valid one, and you have to switch in protected mode in order to update them (unreal mode isn' it?)