bootable programs building an o/s. basic requirements of any o/s respond to interrupts (all kinds)...

10
Bootable Programs Building an O/S

Upload: dennis-burns

Post on 18-Jan-2018

219 views

Category:

Documents


0 download

DESCRIPTION

Responding to ANY interrupt Hardware loads a pre-defined state vector – Context switch occurs – NSI is inside kernel at primary interrupt handler Primary handler determines type of interrupt – I/O completion – Service call – Program error – Paging/addressing exception Save user’s environment (stack, registers) in process’s PCB or thread’s TCB Branch to detail interrupt handler

TRANSCRIPT

Page 1: Bootable Programs Building an O/S. Basic Requirements of any O/S Respond to interrupts (all kinds) Preserve user environment Protect users and self from

Bootable Programs

Building an O/S

Page 2: Bootable Programs Building an O/S. Basic Requirements of any O/S Respond to interrupts (all kinds) Preserve user environment Protect users and self from

Basic Requirements of any O/S• Respond to interrupts (all kinds)• Preserve user environment• Protect users and self from corruption• Handle I/O errors• Handle user errors

Page 3: Bootable Programs Building an O/S. Basic Requirements of any O/S Respond to interrupts (all kinds) Preserve user environment Protect users and self from

Responding to ANY interrupt• Hardware loads a pre-defined state vector– Context switch occurs– NSI is inside kernel at primary interrupt handler

• Primary handler determines type of interrupt– I/O completion– Service call– Program error– Paging/addressing exception

• Save user’s environment (stack, registers) in process’s PCB or thread’s TCB

• Branch to detail interrupt handler

Page 4: Bootable Programs Building an O/S. Basic Requirements of any O/S Respond to interrupts (all kinds) Preserve user environment Protect users and self from

Detail interrupt handler• Take required action– All instructions valid– Must not cause another interrupt• Therefore must not do I/O - one exception:

– Handling I/O errors may require I/O to device– Interrupt for this 2ndary I/O must be deleted

• Must allow for all possible (and improbable) errors

• Return to common return point

Page 5: Bootable Programs Building an O/S. Basic Requirements of any O/S Respond to interrupts (all kinds) Preserve user environment Protect users and self from

Common return to user• Determine next thread/process to run– New user– Interrupted user

• Locate PCB/TCB for selected user• Prep state vector, could be:– Old vector (in reserved RAM) from previously interrupted

program– New vector data determined for a new program

• Save kernel’s registers in reserved storage• Restore user’s registers & stack from PCB/TCB• Load prepared state vector for user• Context switch occurs

Page 6: Bootable Programs Building an O/S. Basic Requirements of any O/S Respond to interrupts (all kinds) Preserve user environment Protect users and self from

SOS• A Small Operating System• “built-in” user command-line shell • Written in z/390 assembler language– 32-bit mode– Runs in a z/390 virtual machine

• You will – Modify it to provide service call handling– Install it as a bootable program– Boot it– Test it

Page 7: Bootable Programs Building an O/S. Basic Requirements of any O/S Respond to interrupts (all kinds) Preserve user environment Protect users and self from

SOS – bootable drive• Virtual device at address 222• Preformatted as a CMS disk– Simplifies putting programs on the drive– Reserved space for the bootable program (SOS)– Boot loader (IBM supplied) installed by student– Allows seeing disk content from CMS shell

Page 8: Bootable Programs Building an O/S. Basic Requirements of any O/S Respond to interrupts (all kinds) Preserve user environment Protect users and self from

SOS – original contents• Device address discovery– Operator’s terminal– Boot drive

• Locate volume TOC• Locates file directory• Displays content of directory in hexadecimal• Terminates

Page 9: Bootable Programs Building an O/S. Basic Requirements of any O/S Respond to interrupts (all kinds) Preserve user environment Protect users and self from

SOS - Lab 1 • Copy the SOSSAMP file to your “a-disk”• Rename it to: SOS• Assemble it using HLASM• Prepare the bootable drive• Boot it

Page 10: Bootable Programs Building an O/S. Basic Requirements of any O/S Respond to interrupts (all kinds) Preserve user environment Protect users and self from

SOS – Lab 2• Add “shell” code to the single compile• Add state-vector loading to “activate” shell• Shell displays your prompt, waits for input• Shell issues SVC n in response to input– 0<= n <= 7– See lab assignment for details

• SOS gets control and performs service “n”• SOS – returns control to shell – loads “terminate” state vector