CPU modes
CPU modes (also called processor modes, CPU states, CPU privilege levels and other names) are operating modes for the central processing unit of most computer architectures that place restrictions on the type and scope of operations that can be performed by instructions being executed by the CPU. For example, this design allows an operating system to run with more privileges than application software by running the operating systems and applications in different modes.[1]
Ideally, only highly trusted kernel code is allowed to execute in the unrestricted mode; everything else (including non-supervisory portions of the operating system) runs in a restricted mode and must use a system call (via interrupt) to request the kernel perform on its behalf any operation that could damage or compromise the system, making it impossible for untrusted programs to alter or damage other programs (or the computing system itself). Device drivers are designed to be part of the kernel due to the need for frequent I/O access.
Multiple modes can be implemented, e.g. allowing a hypervisor to run multiple operating system supervisors beneath it, which is the basic design of many virtual machine systems available today.
Mode types
The unrestricted mode is often called kernel mode, but many other designations exist (master mode, supervisor mode, privileged mode, etc.). Restricted modes are usually referred to as user modes, but are also known by many other names (slave mode,problem state, etc.).[2]
- Hypervisor
- Hypervisor mode is used to support virtualization, allowing the simultaneous operation of multiple operating systems.
- Kernel and user
- In kernel mode, the CPU may perform any operation allowed by its architecture; any instruction may be executed, any I/O operation initiated, any area of memory accessed, and so on. In the other CPU modes, certain restrictions on CPU operations are enforced by the hardware. Typically, certain instructions are not permitted (especially those—including I/O operations—that could alter the global state of the machine), some memory areas cannot be accessed, etc. User-mode capabilities of the CPU are typically a subset of those available in kernel mode, but in some cases, such as hardware emulation of non-native architectures, they may be significantly different from those available in standard kernel mode.
تدعم بعض معمارية المعالجات المركزية أوضاعًا أكثر من تلك المذكورة، وغالبًا ما يكون ذلك عبر تسلسل هرمي للصلاحيات. يُقال عادةً أن هذه المعماريات تتمتع بأمان حلقي، حيث يشبه التسلسل الهرمي للصلاحيات مجموعة من الحلقات متحدة المركز، مع وجود وضع النواة في المركز. كانت أجهزة Multics أول تطبيق مهم للأمان الحلقي، ولكن تم تصميم العديد من منصات الأجهزة الأخرى على غرار ذلك، بما في ذلك وضع الحماية في معالج Intel 80286 ، وكذلك معالج IA-64 ، على الرغم من أنه يُشار إليه باسم مختلف في هذه الحالات.
قد يمتد نطاق حماية الوضع ليشمل موارد تتجاوز وحدة المعالجة المركزية نفسها. تسجل سجلات الأجهزة وضع التشغيل الحالي لوحدة المعالجة المركزية، ولكن قد تسجل سجلات الذاكرة الافتراضية الإضافية، وإدخالات جدول الصفحات ، وبيانات أخرى، معرّفات الوضع لموارد أخرى. على سبيل المثال، قد تعمل وحدة المعالجة المركزية في الحلقة 0 كما هو موضح بكلمة حالة في وحدة المعالجة المركزية نفسها، ولكن قد يتم التحقق من كل وصول إلى الذاكرة أيضًا مقابل رقم حلقة منفصل لجزء الذاكرة الافتراضية المستهدف، و/أو مقابل رقم حلقة للصفحة الفعلية (إن وجدت) المستهدفة. وقد تم إثبات ذلك باستخدام جهاز PSP المحمول.
إنّ الأجهزة التي تستوفي متطلبات بوبك وغولدبيرغ للمحاكاة الافتراضية تُسهّل كتابة البرامج التي تدعم الآلة الافتراضية بكفاءة. إذ يمكن لهذا النظام تشغيل برامج "تعتقد" أنها تعمل في وضع الإشراف، بينما هي في الواقع تعمل في وضع المستخدم.
الهندسة المعمارية
تدعم العديد من أنظمة الحاسوب التي طُرحت في ستينيات القرن الماضي، مثل IBM System/360 و DEC PDP-6 / PDP-10 وسلسلة GE -600 / Honeywell 6000 وسلسلة Burroughs B5000 و B6500 ، نمطين لوحدة المعالجة المركزية؛ نمط يمنح صلاحيات كاملة للبرنامج الذي يعمل فيه، ونمط يمنع الوصول المباشر إلى أجهزة الإدخال/الإخراج وبعض وظائف الأجهزة الأخرى للبرنامج الذي يعمل فيه. يُشار إلى النمط الأول بأسماء مثل حالة المشرف (System/360)، والنمط التنفيذي (PDP-6/PDP-10)، والنمط الرئيسي (سلسلة GE-600)، ونمط التحكم (سلسلة B5000)، وحالة التحكم (سلسلة B6500). أما النمط الثاني فيُشار إليه بأسماء مثل حالة المشكلة (System/360)، ونمط المستخدم (PDP-6/PDP-10)، ونمط التابع (سلسلة GE-600)، والحالة العادية (سلسلة B6500). توجد أوضاع متعددة غير متعلقة بالتحكم في سلسلة B5000.
RISC-V
يحتوي معالج RISC-V على ثلاثة أوضاع رئيسية لوحدة المعالجة المركزية: وضع المستخدم (U)، ووضع المشرف (S)، ووضع الآلة (M). [ 3 ] يتم دعم المحاكاة الافتراضية عبر إعداد CSR مستقل بدلاً من وضع رابع.
مراجع
- ↑ "أوضاع المعالج" . flint.cs.yale.edu . مؤرشف من الأصل بتاريخ 12-05-2018 . تم الاطلاع عليه بتاريخ 23-08-2023 .
- ↑ أفيفينو (2022-11-04). "وضع المستخدم ووضع النواة - برامج تشغيل ويندوز" . learn.microsoft.com . تم الاطلاع عليه بتاريخ 23-08-2023 .
- ↑ هاريس، سارة؛ هاريس، ديفيد (12 يوليو 2021). التصميم الرقمي وهندسة الحاسوب، إصدار RISC-V . مورغان كوفمان. ISBN 978-0-12-820065-0.
- وحدات المعالجة المركزية
- أمن الحاسوب
