70 likes | 183 Views
Advantages of Operating Systems vs. Raw Hardware. Do you need an OS?. Only if you need a flexible environment. The 3 Roles of an OS. Process Management Control what tasks happen when and in what order/priority Memory Management Allocate memory resources to processes
E N D
Advantages of Operating Systems vs. Raw Hardware Do you need an OS? Only if you need a flexible environment
The 3 Roles of an OS • Process Management • Control what tasks happen when and in what order/priority • Memory Management • Allocate memory resources to processes • Protect processes from one accessing each others’ memory spaces. • I/O (Device) Management • Provide an API for device interaction • Protect devices from misuse (abstraction barrier!) • Arbitrate between processes who would like to use a device
Device Drivers • Part of the OS or integrated with the OS (from a 3rd party/manufacturer) • In raw hardware systems, a function library for HW support is ~= a device driver • Provide the interface between the HW device and the user software. • Usually implemented through a series of system calls • Software-triggered interrupt which the OS handles • Function often based upon register states when the call happened
Components of Drivers • A typical device driver will contain at least a subset of these functions: • Install (someone plugged it into the system – think USB) • Uninstall (removed) • Enable (give a device power/ set it up) • Disable • Acquire (acquire permission to use the device – for process protection) • Release (relinquish control of the device) • Read • Write • Startup (on boot-up) • Shutdown (on shut-down) • These functions, besides manipulating data and devices, also move the device between 3 (normally) different states: Inactive – Busy – Idle(Finished)
The Boot Process • “Bootstrap” is the method by which a system brings itself up from reset/power on to a normal running state • Some tasks to consider for this sequence (not ordered): • Self-diagnostics • Initializing registers • Initializing MMRs (clocks, power settings, memory map, bus settings) • Setting up ABI standards (starting the stack/heap, etc) • Enabling/Configuring interrupts • Move programs into memory • Transfer control to a program (main())
CodeWarrior/MPC 555 Boot Process Our CodeWarrior projects implement a configurable boot process. You can find the code for it in these files: eppc_exception.asm MPC555CME_init.c __ppc_eabi_init.c __start.c • Not in project – located in: C:\Program Files\Freescale\CodeWarrior EPPC 5xx V8.7\PowerPC_EABI_Support\Runtime\src (numbers used to denote which file functions are in on next slide) (1) (2) (3) (4)
CodeWarrior/MPC 555 Boot Process • Reset Interrupt starts everything • Interrupt handler table calls __reset() function • _reset() enables machine check exceptions (for sanity) and calls _start() • Note that everything is using nofralloc – there’s no stack yet! • _start() calls _init_registers() to set up SP and other EABI reserved regs • _start() calls _init_hardware() • _init_hardware() takes care of some special cases and calls usr_init() • usr_init() is where the developer can configure the machine MMR setup that will be used at boot time. Sets up clock, power, interrupts, and most importantly, the memory controller. • _start() allocates the stack base and the heaps • _start() calls main() • main() returns, leading to an exit()-type routine (1) (1) (4) (4) (3) (2) (4) (4) (4)