Assembly language of the operating system for different architectures

I'm new to this thread, so forgive my ignorance?

I was just starting to learn the build for x86 processors on my Linux system. I wrote a simple bootloader that worked, but was specific to x86. I also understand that registers, etc. Strongly different for intel and amd or 32 bit and 64 bit. So, how is the operating system or application written for different architectures simultaneously. Yes, applications are operating system dependent, but should not be processor specific. For example, when they are compiled into machine code, do they need to be done for one type of processor (since registers, etc. are different for different architectures)? So how do they do it?

Or is it possible that all x86 have common registers and a set of commands, such as athlon, pentium, i3, i5, etc., and it differs only between x86 and 64 bit architecture?

+3
source share
2 answers

What you said at the end is true - all x86 has a common set of instructions, although the details of what it does under the hood are obviously very different. For example, on Intel hardware, you really have hidden registers that x86 assembly instructions cannot actually get.

Parts of the operating system written in the assembly will require different assembly instructions for different architectures (x86 vs PPC vs ARM, etc.)

, c, , , x64 , 4 . C, #ifdefs .

, , , .

0

(, , ..), , , - . , , . , , / ( ) ..

, (). , (, #ifdef i386) ( /) ; ( ).

; , CPU " " (, BIOS UEFI). , -.

, 80x86 " " . , 80x86 ( ). ( 16-, 32- 64-), , (3DNow, MMX, SSE, AVX), . (, ), " ".

0

All Articles