[program-l] Re: assembly help?

  • From: "Mike Gorse" <mike@xxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Mon, 9 Jan 2006 10:06:37 -0500

Thanks Mark and Tyler for the help!
----- Original Message ----- From: "Mark Long" <Mark.Long@xxxxxxxxxxxxx>
To: <program-l@xxxxxxxxxxxxx>
Sent: Sunday, January 08, 2006 7:15 AM
Subject: [program-l] Re: assembly help?



Hello Mike

I have a moment now and so I can take a stab at explaining these things.

The instruction sets of the later processors are rather fuller although the basic operations are as they were. There are a lot of instructions that pretty much have to be there for a Von Neuman architecture CPU and all modern CPUs follow this pattern. The biggest changes have been in bus width. Pretty much everything is 32 bit these days. You can get to individual bytes if you need to but all transfers are 32 bit so there is no real point most of the time.

Assembler is hardly ever used these days. Even virus writers mostly use C++ these days. A very small percentage of Windows is written in assembler and that is mostly in the HAL (Hardware Abstraction Layer). The optimisers on modern compilers are so good that even a skilled low level programmer struggles to write such tight code and it is rare to improve performance much with hand tuning. Even C++ is falling out of use in many areas and managed code is becoming the norm for applications on Windows.

The best reference that I use is the specification documents that I downloaded from the intel site. One page per instruction, all effects of the opcode listed. What more could any programmer want?

Ring 0 access is more commonly called Kernel mode. On Windows, applications run in ring 3 or user mode. They experience a world of processes and flat address space where all memory access to bus devices is impossible - essentially, it is a sandbox. It is a roomy high class sandbox and you can do a lot of things but anything that you need to do outside of your process can only be done with system call. Ring 0 is where the drivers and some of the operating system lives. There is no sandbox there. You can talk directly to hardware or any part of memory. A lot of the abstractions such as processes don't really exist down there. Mistakes are dangerous in ring 0. If your user mode process accesses memory that it shouldn't and there is no handler then you get a grey box popping up telling you that the process is being terminated. If you do the same thing in kernel mode then the machine bluescreens. Only driver writers and OS vendors really live down there. It is a scary place. There is also a time cost for switching to Kernel mode so we try to minimise transistions.

Does that help at all?

Mark

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: