Re: Some Questions about continuing with OS and hardware
Posted: Tue Aug 23, 2016 9:44 am
Running programs in ring 0 is pointless and horribly unreliable and insecure. If you want to tinker with hardware you can write a kernel module.
The Place to Start for Operating System Developers
http://f.osdev.org/
The truth is that you are not talking about making assembler portable (an obviously impossible task because of the fundamental differences between different processors), but in creating a layer on top of assembler; a higher-level language. You are many years too late in doing this; languages such as BCPL and C were created many years ago and serve exactly the purpose that you are looking at. And the truth is that well written C libraries are likely to be far more efficient, and perform better, than an assembler programmer can manage (unless they are an extremely good assembler programmer). You can take it that, after many years of development, there are efficient libraries available.~ wrote:If the C language can be portable with all of its confusing syntax and nested expressions, then Assembly can perfectly be done.
Even 64-bit Linux is capable of running Win16 and giving the impression that they are native. What's good about DOS is that if somebody writes a driver and if it runs in DOS, it will be tiny, easy to understand, the device will be well implemented and well oriented to final applications while keeping the intended power it should offer, and would run well in bigger OSes, and the same for existing applications, even the more modern web browser under DOS. A program can expand itself to 32 or 64-bit and with its own functions without having to get through Windows or Linux or having them monopolize the whole machine (bad for a machine intended for very heavy development at all levels where you need to switch from low to high-level development without delays to be efficient).Kazinsal wrote:No one in their right mind cares about DOS linkers and executables anymore. That technology is so old and obsolete Microsoft decided it wasn't worth supporting going forward on modern architectures eleven years ago.
I don't understand your obsession with trying to revive such ancient and dead technology. It was supplanted for a reason, and that reason is because it sucked like explosive decompression.
It's not impossible. Think about porting an application that has been properly encapsulated and defined, which is intended to write on the screen, or functions to perform arithmetic operations for a calculator. If you think about how to compile x86 assembly to other native executable code, you will find that it's basically the same as compiling C, and we aren't using anything exotic, just clean x86 assembly well-defined to be cross-platform. If for example we are masters in using SSE and we want to use it in other architecture, it would be very useful if we already wrote an x86 application.iansjack wrote:The truth is that you are not talking about making assembler portable (an obviously impossible task because of the fundamental differences between different processors), but in creating a layer on top of assembler; a higher-level language. You are many years too late in doing this; languages such as BCPL and C were created many years ago and serve exactly the purpose that you are looking at. And the truth is that well written C libraries are likely to be far more efficient, and perform better, than an assembler programmer can manage (unless they are an extremely good assembler programmer). You can take it that, after many years of development, there are efficient libraries available.~ wrote:If the C language can be portable with all of its confusing syntax and nested expressions, then Assembly can perfectly be done.
You are trying to reinvent the wheel. Unfortunately, your concept of the wheel is a square one rather than the well rounded examples that already exist. By all means go and develop your ideas; but I think that they, and your rather quaint ideas about DOS, have little place in these forums - perhaps stick to the "General Programming" category if you really must, but they are only an unnecessary distraction in the forums aimed at operating system development.
I begin to wonder if you actually understand what assembler is, or appreciate the differences between different CPU architectures.~ wrote: If it wasn't possible to compile one assembler into a different object code, then it wouldn't be possible to use PCI, accelerated 3D graphics cards, IEEE-754-compliant FPUs or USB in architectures other than x86 PCs either.
The guys are right mate, not sure if you really understand the difference or where you are trying to head.iansjack wrote:I begin to wonder if you actually understand what assembler is, or appreciate the differences between different CPU architectures.~ wrote: If it wasn't possible to compile one assembler into a different object code, then it wouldn't be possible to use PCI, accelerated 3D graphics cards, IEEE-754-compliant FPUs or USB in architectures other than x86 PCs either.
What on earth has the native language of the CPU got to do with PCI, 3D graphics cards, USB, etc.?
LOL!iansjack wrote:What on earth has the native language of the CPU got to do with PCI, 3D graphics cards, USB, etc.?
If we feel better in Real Mode or if we feel constantly going back using, finding and learning from resources from the 90's and from the ISA/PS/2 PC's, then it's because that's our current level of knowledge and expertise, and we would do best to just agree with ourselves that fact, and accelerate our learning to other levels by learning the basics from the environment that actually holds all of the basics, which happens to be Real Mode/DOS/DPMI/Win9x/loadlin, whatever looks slightly like software fore bare-metal standard hardware/software/firmware.Antti wrote:It is easy to say that wasting time on real mode programming was a mistake. Nevertheless, people saying that have very often done that by themselves and think that they wasted their time on it but still totally neglect to mention (admit) the fact that they still learnt from it and it affected their point of view. In retrospect, it is easy to say that one should have learnt only the things that end up being in the final "understanding" state.
The problem is not learning and using the real mode, in this case, but learning and using it far too long and getting stuck with it.
Code: Select all
a32 o32 call ???
a32 o32 ret
If you feel better in real mode, you haven't done very much in protected mode. The initial setup is a bit more work than real mode, but the improved flexibility is worth it.~ wrote:If we feel better in Real Mode or if we feel constantly going back using, finding and learning from resources from the 90's and from the ISA/PS/2 PC's, then it's because that's our current level of knowledge and expertise, and we would do best to just agree with ourselves that fact, and accelerate our learning to other levels by learning the basics from the environment that actually holds all of the basics, which happens to be Real Mode/DOS/DPMI/Win9x/loadlin, whatever looks slightly like software fore bare-metal standard hardware/software/firmware, including usual and useful file formats of all kinds.
Had you read the wiki page on unreal mode, you would already know that the answer to this question is yes. However, it has some severe limitations that make it useless for anything serious. It would be less work to just switch to protected mode and be done with it.~ wrote:The question is: Will there really be a way to intensively hack the CPU so that we can use EIP and ESP/EBP in pure Real Mode so we can use huge 16-bit programs without worrying about segment registers, leaving them loaded with 0?
I'm honestly not sure if that would work. That's pretty obviously going beyond what the CPU was ever intended to support, so you'll probably stumble across some unexpected behavior.~ wrote:Could we maybe use 32-bit prefixes like...?:
Switching to protected mode without actually enabling any protection features is trivial. You should try it, it's actually less work than setting up unreal mode!~ wrote:Protected mode without protection
No.~ wrote:Will there be a possible way to enable 16/32/64-bit code/data/stack/instruction pointer from Real Mode, like Short Mode?