flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
typedef 13 Jan 2012, 02:28
you mean at runtime ?
|
|||
![]() |
|
Apos 13 Jan 2012, 02:30
Yeah, at run-time. (While programs are running.)
(Programs can use registers while they are not running?) (If you mean the little programs, I was loading a character into a register using program A (And making it wait) and tried to print out what was loaded in the register with program B while A was still running. B would fail and A would be able to print the right character after the wait.)(This was just as a test before asking the question on here.) _________________ "A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away." - Antoine de Saint-Exupéry Last edited by Apos on 13 Jan 2012, 14:56; edited 1 time in total |
|||
![]() |
|
Tyler 13 Jan 2012, 03:06
It's something that's taken care of by the operating system when it switches from one task to another. It stores the values of the registers set by the current task into memory and loads the values previously set by the next task into the registers from memory.
As far as anything concerning other tasks, for programs, it is all taken care of by the operating system. It keeps their memory and everything else separate. From the perspective of a normal program, it's almost like they're the only program running on the computer. |
|||
![]() |
|
typedef 13 Jan 2012, 04:51
Apos wrote: Yeah, at run-time. (While programs are running.) Well then I would be able to hack online games easily by making an application and modify some registers so that all other applications get affected. You see the logic there ? |
|||
![]() |
|
DOS386 13 Jan 2012, 08:39
Almost nothing is shared ... because the multitasking OS isolates the apps from each other
![]() |
|||
![]() |
|
Apos 13 Jan 2012, 14:51
That's good to know. I was worried that some of the values I put in the registers could end up being changed without my program knowing.
_________________ "A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away." - Antoine de Saint-Exupéry |
|||
![]() |
|
shutdownall 15 Jan 2012, 01:27
Depends on the cpu mode used by the OS. In Real Mode memory areas (and registers) are not safe for use of other programs. Anyway programs normally respect this private area but its not really protected.
In Protected Mode this is done by the CPU itself, operating system only does a general configuration. This is the main goal of the protected mode to do all activities by the cpu itself from hardware and not via software when switching between tasks. ![]() |
|||
![]() |
|
Tyler 15 Jan 2012, 04:43
shutdownall wrote: In Protected Mode this is done by the CPU itself, operating system only does a general configuration. This is the main goal of the protected mode to do all activities by the cpu itself from hardware and not via software when switching between tasks. ![]() |
|||
![]() |
|
shutdownall 15 Jan 2012, 12:21
I don't think so. If you use software task switching it is in my opinion impossible to protect memory areas of different processes against each other. So one of the main features of the protected mode (the other one is memory addressing and paging) is lost. If I am wrong, please correct me.
![]() |
|||
![]() |
|
revolution 15 Jan 2012, 12:46
shutdownall wrote: I don't think so. If you use software task switching it is in my opinion impossible to protect memory areas of different processes against each other. So one of the main features of the protected mode (the other one is memory addressing and paging) is lost. If I am wrong, please correct me. ![]() |
|||
![]() |
|
cod3b453 15 Jan 2012, 12:55
The software switch can perform (most of) the same state swapping; the protection aspect is provided by the page tables and other memory settings. The IOPB is unlikely to be changed across user processes, except in the case of user mode drivers.
---- Also some operating systems do-/did- not save the FPU and SSE registers across processes without explicitly notifying the OS first. |
|||
![]() |
|
shutdownall 15 Jan 2012, 12:58
I read a book about real time OS'es which explained the facilities of protected mode and I thought this would be used in this way. So I am a bit surprised that this is not reality. Anyway I can imagine that it's possible to do this internal by software, choose privilege level 3 and some memory limits when giving control to a task and just give control to other task when interrupted and save registers manually.
In fact I did not do much with protected mode by now. How much faster is this in practice not to use hardware task switching ? I thought at leest Microsoft would use it this way. But you never learn out. In fact it's not very different to old DOS TSR switching. ![]() |
|||
![]() |
|
revolution 15 Jan 2012, 13:05
IIRC Windows uses software task switching. Or at least the older versions did, for performance reasons. Although that may have changed now with newer processors and newer OSes. However, I really doubt there is any perceivable or measurable difference with CPUs being vastly faster now, the amount of time spent task switching is a very tiny fraction of total run time, and most of that task switching time would be spent reading/writing saved values to/from the slower memory.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.