X86: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
Dinamik-bot (bicara | kontrib)
k bot Mengubah: ja:X86
Baris 20:
[[Bahasa rakitan]] dari x86 dibahas secara lebih terperinci di artikel [[Bahasa Rakitan x86]].
 
[[Mikroprosesor]] [[x86]] dapat bekerja dalam beberapa modus berikut:
=== Mode Real (Real Mode) ===
* Real-mode (Modus Real)
Intel 8086 dan 8088 dilengkapi dengan 14 16-[[bit]] [[register prosesor|register]]. Empat diantaranya (AX, BX, CX, DX) dirancang sebagai fungsi umum (general purpouse) (meskipun masing-masing juga memiliki fungsi khusus tambahan; misalnya hanya register CX yang dapat digunakan sebagai penghitung (counter) dalam instruksi ''loop''). Setiap register dapat diakses sebagai dua byte (8-bit) terpisah (jadi byte-atas BX's dapat diakses sebagai BH dan byte-bawah-nya sebagai BL). Selain itu, terdapat juga empat register segmen ('''CS, DS, SS dan ES'''). Register ini digunakan untuk membangun alamat memori. Ada juga dua register penunjuk (pointer) (SP yang menunjuk pada titik awal ''stack'', dan BP yang dapat menunjuk pada titik manapun dalam ''stack'' atau memori). Ada dua register indeks (SI dan DI) yang dapat digunakan sebagai penunjuk dalam array. Dan terakhir, ada sebuah register penanda ([[register flag]]) yang terdapat didalamnya penanda-penanda seperti [[carry]], [[overflow]], zero dan lain-lain, dan juga sebuah penunjuk instruksi (instruction pointer - IP) yang menunjuk ke alamat instruksi yang sedang dieksekusi.
* Protected Mode (Modus terproteksi)
* Virtual Protected Mode (Modus Terproteksi Virtual)
* Compatibility Mode
* Long Mode/IA32e Full Mode
 
=== Mode Real (Real -Mode) ===
Dalam mode real, memori diakses secara ''tersegmentasi''. Hal ini dilakukan dengan menggeser (shifting) alamat segmen 4 bit ke kiri dan menambah sebuah ofset untuk menghasilkan alamat akhir sepanjang 20-bit. Contohnya, jika DS berisi nilai A000h dan SI berisi nilai 5677h, DS:SI akan mengacu pada titik alamat ''real'' DS × 16 + SI = A5677h. Jadi jumlah total alamat memori yang dapat diakses dalam mode real adalah 2<sup>20</sup> byte, atau 1 [[Mebibyte|MiB]], jumlah yang sangat mengesankan di tahun 1978. Seluruh alamat memori terbagi dalam segmen dan ofset; dan setiap tipe akses (kode, data, atau ''stack'') memiliki register segmen tertentu (untuk data register yang digunakan DS, untuk kode digunakan register CS, dan untuk ''stack'' digunakan SS). Untuk mengakses data, register segmen dapat secara langsung dipilih (dengan melakukan ubah-paksa (override) prefik segmen) dari empat register segmen yang tersedia.
Real-Mode adalah sebuah modus di mana prosesor Intel [[x86]] berjalan seolah-olah dirinya adalah sebuah prosesor [[Intel 8086]] atau [[Intel 8088]], meski ia merupakan prosesor [[Intel 80286]] atau lebih tinggi. Karenanya, modus ini juga disebut sebagai '''modus 8086''' (''8086 Mode''). Dalam modus ini, prosesor hanya dapat mengeksekusi instruksi 16-bit saja dengan menggunakan register internal yang berukuran [[16-bit]], serta hanya dapat mengakses hanya 1024 KB dari [[memori fisik|memori]] karena hanya menggunakan [[bit|20-bit]] jalur [[bus alamat]]. Semua program DOS berjalan pada modus ini.
 
Prosesor yang dirilis setelah 8086, semacam [[Intel 80286]] juga dapat menjalankan instruksi 16-bit, tapi jauh lebih cepat dibandingkan 8086. Dengan kata lain, Intel 80286 benar-benar kompatibel dengan prosesor Intel 8086 yang didesain sebelumnya. Sehingga prosesor Intel 80286 pun dapat menjalankan program-program 16-bit yang didesain untuk 8086 ([[IBM PC]]), dengan tentunya kecepatan yang jauh lebih tinggi.
Dengan aturan ini, dua pasang segmen/ofset yang berbeda bisa mengacu ke lokasi memori absolut yang sama. Jadi bila DS berisi A111h dan SI 4567h, DS:SI akan menunjuk ke alamat A56777h seperti di atas. Lebih lanjut, CS dan SS berperan vital bagi program agar berfungsi secara benar, sehingga hanya DS dan ES yang dapat dipakai untuk mengacu ke segmen data diluar program (atau lebih tepatnya, diluar segmen program yang sedang dieksekusi) atau stack. Skema ini, yang semula bertujuan mempertahankan kompatibilitas dengan [[Intel 8085]], sering dikeluhkan oleh para programer (walaupun beberapa programer tidak terlalu mempedulikannya, dan popularitas x86 sebelum tahun-tahun mode proteksi diperkenalkan membuktikan bahwa hal ini bukan cacat yang sangat serius).
 
Dalam Real-mode, tidak ada proteksi ruang alamat memori, sehingga tidak dapat melakukan ''multi-tasking''. Inilah sebabnya, mengapa program-program DOS bersifat ''single-tasking''. Jika dalam modus real terdapat ''multi-tasking'', maka kemungkinan besar antara dua program yang sedang berjalan, terjadi tabrakan (''crash'') antara satu dengan lainnya.
Selain itu, 8086 juga memiliki 64 [[Kilobyte|KB]] alamat I/O 8-bit (atau 32 K-word dari 16-bit), dan satu 64 KB (satu segmen) ''stack'' di memori yang didukung oleh hardware (memakai register-register SS, SP, dan BP). Hanya word (2 byte) yang bisa di-''push'' ke ''stack''. ''Stack'' tumbuh ke bawah (ke arah alamat yang lebih rendah secara numerik), dengan ujung bawah diacu oleh SS:SP. Ada 256 ''interrupt'' yang dapat diaktifkan oleh hardware maupun software. ''Interrupt'' tersebut bisa bertingkat, memanfaatkan ''stack'' untuk menyimpan alamat balik.
 
== Protected Mode ==
CPU x86 32-bit yang modern masih mendukung ''real mode'', bahkan memulai operasi pada ''real mode'' setelah reset. Kode ''real mode'' yang dijalankan pada prosesor-prosesor tersebut bisa memanfaatkan register 32-bit dan register segmen tambahan (FS dan GS) yang mulai tersedia sejak 80386.
Modus terproteksi (protected mode) adalah sebuah modus di mana terdapat proteksi ruang alamat memori yang ditawarkan oleh mikroprosesor untuk digunakan oleh sistem operasi. Modus ini datang dengan [[mikroprosesor]] [[Intel 80286]] atau yang lebih tinggi. Karena memiliki proteksi ruang alamat memori, maka dalam modus ini sistem operasi dapat melakukan multitasking.
 
Prosesor Intel 80286 memang dilengkapi kemampuan masuk ke dalam modus terproteksi, tapi tidak dapat keluar dari modus tersebut tanpa harus mengalami reset (''warm boot'' atau ''cold boot''). Kesalahan ini telah diperbaiki oleh Intel dengan merilis prosesor [[Intel 80386]] yang dapat masuk ke dalam modus terproteksi dan keluar darinya tanpa harus melakukan reset. Inilah sebabnya mengapa [[Windows 95]]/[[Windows 98]] dilengkapi dengan modus '''Restart in MS-DOS Mode''', meski sebenarnya [[sistem operasi]] tersebut merupakan sistem operasi yang berjalan dalam modus terproteksi.
=== Mode terproteksi 16-bit (16-bit protected mode) ===
[[Prosesor 80286]] dapat menjalankan [[Operating System]] yang menggunakan [[Mode Real]] 16-bit [[prosesor 8086]] tanpa perubahan pada OS, namun prosesor ini juga mempunyai mode lain, yaitu [[mode terproteksi]]. Mode terproteksi memungkinkan program untuk mengakses [[RAM]] yang berukuran 16MB, dan memiliki memori virtual hingga 1GB. Hal ini dimungkinkan karena mode terproteksi menggunakan register segmen untuk menyimpan index ke sebuah [[tabel segmen]]. Pada 80286, terdapat dua buah tabel segmen, yaitu tabel GDT dan tabel LDT, masing-masing dapat menyimpan hingga 8192 perinci segmen, tiap segment memberi akses untuk memori sebesar hingga 64KB. Tabel segmen ini menyimpan alamat dasar yang berukuran 24-bit, yang akan digunakan untuk menghitung alamat absolut dari memori yang akan digunakan. Selain itu, segmen-segmen ini dapat diberikan salah satu dari empat jenis level akses.
 
== Virtual Protected Mode ==
Walaupun dibuatnya prosesor ini merupakan pengembangan yang baik, prosesor ini sangat jarang digunakan karena mode terproteksi tidak dapat menjalankan program-program yang berjalan mode real yang sudah ada sebagai proses, karena program-program mode real sering mengakses perangkat keras secara langsung dan beberapa ada yang melakukan [[aritmatika segmen]], sehingga tidak dapat dijalankan pada mode terproteksi.
'''Virtual Protected Mode''' juga kadang disebut sebagai '''Virtual Real Mode'''. Dalam modus ini, sebuah prosesor Intel x86 berjalan dalam modus terproteksi tetapi mengizinkan aplikasi-aplikasi 16-bit real-mode agar dapat dijalankan di atas sistem operasi. Microsoft [[Windows 3.x|Windows 3.1]], yang berjalan di dalam modus Enhanced 386, [[Windows 95]], serta [[Windows 98]] mendukung modus ini sepenuhnya. Sistem-sistem operasi dapat menjalankan beberapa aplikasi [[16-bit]] real-mode secara sekaligus, pada window MS-DOS Prompt yang berbeda-beda, karena memang Microsoft mengimplementasikan sebuah lapisan emulasi yang disebut sebagai [[DPMI|DOS Protected Mode Interface (DPMI)]]. Setiap window MS-DOS Prompt yang dibuat, aplikasi hanya berjalan dalam real mode, tapi karena Windows 3.1 (yang berjalan dalam modus Enhanced 386) dan Windows 95/98 berjalan dalam modus terproteksi, aplikasi akan menganggap dirinya berjalan pada komputer yang berbeda, meski pada fisiknya mereka dijalankan pada modus yang sama. Hal ini mengizinkan aplikasi-aplikasi 16-bit real-mode agar dapat dijalankan secara serentak ([[multitasking]]), meski pada awalnya aplikasi 16-bit berjalan dalam kondisi single-tasking.
 
DPMI digunakan oleh Windows 3.1 ke atas untuk mengakses [[Manajemen memori DOS|extended memory]] agar dapat digunakan oleh aplikasi Windows. DPMI mengizinkan program-program dapat menggunakan memori yang lebih banyak, meski pada aslinya program tersebut merupakan program 16-bit. Hal ini populer dilakukan, khususnya bagi program-program game komputer DOS, karena game-game tersebut dapat mengakses lebih dari 1 MB (diberi hak akses oleh sistem operasi). DPMI dapat melakukan switching prosesor dari real-mode ke protected mode atau sebaliknya.
<!-- TRANSLATE
So in the 386, Intel introduced [[Virtual 8086 mode]], in which it is still subject to paging but used the real mode way to form linear address and allowed the OS to trap I/O accesses and, through paging, trap memory accesses.
 
=== IA32e/AMD64/x64/x86-64 Compatibility Mode ===
In the meantime, operating systems like [[OS/2]] tried to ping-pong the processor between protected and real modes. This was both slow and unsafe, as in real mode a program could easily crash the computer. OS/2 also defined restrictive programming rules which allowed a ''Family API'' or ''bound'' program to run either in real mode or in protected mode. This was however about running programs originally designed for protected mode, not vice-versa. By design, protected mode programs did not suppose that there is a relation between selector values and physical addresses. It is sometimes mistakenly believed that problems with running real mode code in 16-bit protected mode resulted from IBM having chosen to use Intel reserved interrupts for BIOS calls. It is actually related to such programs using arbitrary selector values and performing "segment arithmetic" described above on them and also direct hardware access.
Modus kompatibilitas adalah sebuah modus prosesor berbasis IA32e ([[x86-64]], [[AMD64]], [[EM64T]], atau [[x64]]) di mana prosesor sedang menjalankan instruksi [[32-bit]] ([[sistem operasi]] 32-bit dan aplikasinya yang dijalankan di atas prosesor x64 atau sistem operasi 64-bit yang menjalankan aplikasi 32-bit). Dalam modus ini, prosesor tersebut bekerja seolah-olah dirinya adalah prosesor x86 32-bit, sehingga hanya dapat mengalamati memori hingga 4 GB saja.
 
=== IA32e/x86-64/AMD64/x64/EM64T Long Mode ===
This problem also appeared with [[Windows 3.0]]. Optimally, this release wanted to run programs in 16-bit protected mode, while previously they were running in real mode. Theoretically, if a Windows 1.x or 2.x program was written "properly" and avoided segment arithmetic it would run indifferently in both real and protected modes. Windows programs generally avoided segment arithmetic because Windows implemented a software virtual memory scheme and moved program code and data in memory when programs were not running, so manipulating absolute addresses was dangerous; programs were supposed to only keep ''handles'' to memory blocks when not running, and such handles were quite similar to protected-mode selectors already. Starting an old program while Windows 3.0 was running in protected mode triggered a warning dialog, suggesting to either run Windows in real mode (it could presumably still use expanded memory, possibly emulated with [[EMM386]] on 80386 machines, so it was not [[640K barrier|limited to 640 KB]]) or to obtain an updated version from the vendor. Well-behaved programs could be "blessed" using a special tool to avoid this dialog. It was not possible to have some GUI programs running in 16-bit protected mode and other GUI programs running in real mode, probably because this would require having two separate environments and (on 80286) would be subject to the previously mentioned ping-ponging of the processor between modes. In version 3.1 real mode disappeared.
Modus panjang (long mode) adalah sebuah modus prosesor 64-bit IA32e ([[x86-64]]/[[AMD64]]/[[x64]]/[[EM64T]]) yang berjalan di atas sistem operasi 64-bit, sehingga ia dapat mengeluarkan seluruh kemampuannya, seperti halnya mengakses memori lebih besar daripada 4 GB (hingga batasan yang dimiliki oleh prosesor dan sistem operasi), dan menjalankan aplikasi 64-bit. Hanya beberapa sistem operasi yang dapat menjalankan prosesor IA32e dalam modus ini, yakni [[Windows XP|Windows XP Professional x64 Edition]], [[Windows Server 2003]], [[GNU/Linux]] (versi [[kernel Linux|kernel]] 2.6 ke atas), [[Solaris|Solaris 10]] dan beberapa varian UNIX lainnya.
 
===Mode terproteksi 32-bit (32-bit protected mode)===
 
The Intel 80386 introduced, perhaps, the greatest leap so far in the x86 architecture. With the notable exception of the [[Intel 80386SX]], which was 32-bit yet only had 24-bit addressing (and a 16-bit data bus), it was all 32-bit - all the registers, instructions, I/O space and memory. To work with the latter, it used a 32-bit extension of Protected Mode. As it was in the 286, segment registers were used to index inside a segment table that described the division of memory. Unlike the 286, however, inside each segment one could use 32-bit offsets, which allowed every application to access up to 4 [[Gigabyte|GB]] without segmentation and even more if segmentation was used. In addition, 32-bit protected mode supported [[paging]], a mechanism which made it possible to use [[virtual memory]].
 
No new general-purpose registers were added. All 16-bit registers except the segment ones were expanded to 32 bits. Intel represented this by adding "E" to the register mnemonics (thus the expanded AX became EAX, SI became ESI and so on). Since there was a greater number of registers, instructions and operands, the machine code format was expanded as well. In order to provide backwards compatibility, the segments which contain executable code can be marked as containing either 16 or 32 bit instructions. In addition, special prefixes can be used to include 32-bit instructions in a 16-bit segment and vice versa.
 
Paging and segmented memory access were both required in order to support a modern multitasking operating system. [[Linux]], [[386BSD]], [[Windows NT]] were all initially developed for the 386, because it was the first CPU that support paging and 32-bit segment offsets. The basic architecture of the 386 became the basis of all further development in the x86 series.
 
The [[Intel 80387]] math co-processor was integrated into the next CPU in the series, the Intel 80486. The new [[FPU]] could be used to make [[floating point]] calculations, important for scientific calculation and graphic design.
 
===MMX dan generasi sesudahnya===
1996 saw the appearance of the [[MMX]] (Matrix Math Extensions, though sometimes incorrectly referred to as Multi-Media Extensions) technology by Intel. While the new technology has been advertised widely and vaguely, its essence is very simple: MMX defined eight 64-bit [[SIMD]] registers overlayed onto the FPU stack to the [[Intel Pentium]] CPU design. Unfortunately, these instructions were not easily mappable to the code generated by ordinary [[C programming language|C]] [[compiler]]s, and Microsoft, the dominant compiler vendor, was slow to support them even as intrinsics. MMX is also limited to integer operations. These technical shortcomings caused MMX to have little impact in its early existence. Nowadays, MMX is typically used for some 2D video applications.
 
===3DNow!===
In 1997 AMD introduced [[3DNow!]] which consisted of SIMD floating point instruction enhancements to MMX (targeting the same MMX registers). While this did not solve the compiler difficulties, the introduction of this technology coincided with the rise of 3D entertainment applications in the PC space. 3D video game developers and 3D graphics hardware vendors used 3DNow! to help enhance their performance on AMD's [[AMD_K6|K6]] and [[Athlon]] series of processors.
 
===SSE===
Pada tahun 1991 Intel memperkenalkan [[Streaming SIMD Extensions|SSE]] atau yang juga biasa disebut Katmai New Instructions, . SSE pertama dikenalkan pada Processor Pentium III milik Intel sebagai sesuatu paling berbeda antara Pentium III dengan Pentium II. Tujuan utama dari SSE sama seperti MMX dan 3DNow! yaitu mempercepat proses di CPU walaupun SSE menghasilkan peningkatan lebih significan dari pada MMX.
 
===SSE2===
In 2000 Intel introduced the [[SSE2]] instruction set which added 1) a complete complement of integer instructions (analogous to MMX) to the original SSE registers and 2) 64-bit SIMD floating point instructions to the original SSE registers. The first addition made MMX almost obsolete, and the second allowed the instructions to be realistically targeted by conventional compilers.
 
===SSE3===
Introduced in [[2004]] along with the [[Pentium 4#Prescott|''Prescott'']] revision of the [[Pentium 4]] processor, [[SSE3]] added specific memory and [[Thread (software engineering)|thread]]-handling instructions to boost the performance of Intel's [[HyperThreading]] technology. [[AMD]] later licensed the SSE3 instruction set for its latest (E) revision Athlon 64 processors. The SSE3 instruction set included on the new Athlons are only lacking a couple of the instructions that Intel designed for HyperThreading, since the [[Athlon 64]] does not support HyperThreading; however SSE3 is still recognized in software as being supported on the platform.
 
===64-bit===
By 2002, it was obvious that the 32-bit address space of the x86 architecture was limiting its performance in applications requiring large data sets. A 32-bit address space would allow the processor to directly address only 4 GB of data - a size frequently surpassed by applications such as video processing or [[database engine]]s.
 
Intel had originally decided not to extend x86 to 64-bit as they had to 32-bits, and instead introduced a new architecture called [[IA-64]]. IA-64 technology is the basis for its [[Itanium]] line of processors. IA-64 provides a backward compatibility for older 32-bit x86; this mode of operation, however, is exceedingly slow.
 
[[AMD]] took the initiative of extending the 32-bit x86 (which Intel calls [[IA-32]]) to [[64-bit]]. It came up with an architecture, called [[AMD64]] (or [[x86-64]], prior to rebranding), and based the [[Opteron]] and [[Athlon 64]] family of processors on this technology. The success of the AMD64 line of processors coupled with the lukewarm reception of the IA-64 architecture prompted Intel to adopt the AMD64 instruction set, adding some new extensions of its own and branding it the [[EM64T]] architecture. In its literature and product version names, Microsoft refers to this processor architecture as x64.
 
This was the first time that a major upgrade of the x86 architecture was initiated and originated by a manufacturer other than Intel. Perhaps more importantly, it was the first time that Intel actually accepted technology of this nature from an outside source.
 
===Virtualisasi===
x86 [[virtual machine|virtualization]] is difficult because the architecture does not meet the [[Popek and Goldberg virtualization requirements]]. Nevertheless, there are several commercial [[x86 virtualization]] products, such as [[VMware]] and [[Virtual PC|Microsoft Virtual PC]]. There is also an open source virtualization project [[Xen|Xen]]. Intel and AMD have both announced that future x86 processors will have new enhancements to facilitate more efficient virtualization. Intel's code names for their virtualization features are "Vanderpool" and "Silvervale"; AMD uses the code name "Pacifica".
 
===Sistem diatas satu chip - [[System-on-a-chip]] (SOC)===
Sebuah X86 SOC adalah perpaduan antara x86 CPU [[core]] dengan sebuah [[northbridge (computing)|northbridge]] ([[memory controller]]) dan sebuah [[southbridge (computing)|southbridge]] (input/output (I/O) controller) dalam satu chip [[integrated circuit]] (IC).
 
==Daftar Pabrikan==