Upload
kourtney-warren
View
20
Download
1
Embed Size (px)
DESCRIPTION
Developing a minimal kernel with testing environment. Starting Point Goals Development Results. Hüseyin Uslu. Starting point. Fast developing technology Many alternatives Users always expecting more and more performance. Benchmark Software. Goals. Hardware Performance Tests CPU - PowerPoint PPT Presentation
Citation preview
Developing a minimal kernel Developing a minimal kernel with testing environmentwith testing environment
• Starting Point• Goals• Development• Results
Hüseyin Uslu
Starting pointStarting point
► Fast developing technologyFast developing technology► Many alternativesMany alternatives► Users always expecting more and more Users always expecting more and more
performanceperformance
Benchmark Software
GoalsGoals
Hardware Performance TestsHardware Performance Tests► CPUCPU
Floating PointFloating Point Processing CapacityProcessing Capacity
► MemoryMemory Access TimeAccess Time Corrupt Memory BanksCorrupt Memory Banks
► DiscDisc► etc.etc.
Need for a kernelNeed for a kernel
► Effect of a operating system on performance testsEffect of a operating system on performance tests ServicesServices DriversDrivers ProcessesProcesses
► Ensure equal conditions for similar configured computersEnsure equal conditions for similar configured computers► Enabling direct access of performance analyse codes to Enabling direct access of performance analyse codes to
hardwarehardware Ring0Ring0 Getting rid of operating system limitationsGetting rid of operating system limitations
Benchmark Software based on a kernel
Test EnvironmentTest Environment
► Kernel based platform for performance analysis codeKernel based platform for performance analysis code► No installation (live cd, USB sticks)No installation (live cd, USB sticks)► Parameter based testsParameter based tests► While a performance test, only vital kernel code runsWhile a performance test, only vital kernel code runs► While a performance test, user input is blockedWhile a performance test, user input is blocked
Development EnvironmentDevelopment Environment
► Concurrent Development: Concurrent Development: SubversionSubversion
► Compilers: GCC, NASMCompilers: GCC, NASM► Make system: MAKEMake system: MAKE► Debugger: GDBDebugger: GDB► Emulator: bochs, qemu, vmwareEmulator: bochs, qemu, vmware► Bootloader: GRUBBootloader: GRUB
Boot LoaderBoot Loader
GNU GRUB StableStable Widely usedWidely used Supports different boot optionsSupports different boot options
►CDCD►FloppyFloppy►USB driveUSB drive
Bootloader - 2Bootloader - 2
► boot.S (GRUB Multiboot Specification )boot.S (GRUB Multiboot Specification )► kernel.c - main() , entrance point for kernelkernel.c - main() , entrance point for kernel
GDTGDT
Global Descriptor Table (gtd.c)Global Descriptor Table (gtd.c) Memory SegmentsMemory Segments Access Privileges (ring0)Access Privileges (ring0)
gdt_flush.asmgdt_flush.asm kernel.c -> install_gdt() -> gdt_flush() [lgdt]kernel.c -> install_gdt() -> gdt_flush() [lgdt]
IDTIDT
Interrupt Descriptor TablesInterrupt Descriptor Tables InterruptsInterrupts ExceptionsExceptions
idt.cidt.c ISR definitions (ISR0 – ISR31)ISR definitions (ISR0 – ISR31) IRQ definitions (IRQ0, IRQ1…)IRQ definitions (IRQ0, IRQ1…)
kernel.c-> install_idt()kernel.c-> install_idt() Relocating ISR & IRQsRelocating ISR & IRQs Matching handler fuctions for ISR & IRQsMatching handler fuctions for ISR & IRQs load_idt() [lidt]load_idt() [lidt]
Reprogramming the PICReprogramming the PIC
► CPU ExceptionsCPU Exceptions 0-31 -> interrupt table 0 - 310-31 -> interrupt table 0 - 31
► PIC ( hardware IRQs ) PIC ( hardware IRQs ) Master (IRQ0 – IRQ7) -> interrupt table 8 - 15Master (IRQ0 – IRQ7) -> interrupt table 8 - 15 Slave (IRQ8 – IRQ15) -> interrupt table 112 - 120 Slave (IRQ8 – IRQ15) -> interrupt table 112 - 120
► Interrupt Table, location 8Interrupt Table, location 8 Double Fault ExceptionDouble Fault Exception IRQ0, timer interruptIRQ0, timer interrupt
► Need reprogramming [pic.c – remap_pics()]Need reprogramming [pic.c – remap_pics()] 0 Division By Zero Exception 0 Division By Zero Exception 1 Debug Exception 1 Debug Exception …… 7 No Coprocessor Exception 7 No Coprocessor Exception 8 Double Fault Exception 8 Double Fault Exception 9 Coprocessor Segment Overrun Exception 9 Coprocessor Segment Overrun Exception 10 Bad TSS Exception 10 Bad TSS Exception .... 31 Reserved Exception 31 Reserved Exception 32 IRQ0 Timer 32 IRQ0 Timer 33 IRQ1 Keyboard 33 IRQ1 Keyboard …… 39 IRQ7 Parallel Port 39 IRQ7 Parallel Port …… 47 IRQ15 Secondary IDE channel47 IRQ15 Secondary IDE channel
Interrupt HandlersInterrupt Handlers
►Handler functions (irq_handler.c)Handler functions (irq_handler.c) Timer [timer_handler()]Timer [timer_handler()] Keyboard [keyboard_handler()]Keyboard [keyboard_handler()]
Exception HandlersException Handlers
►exception.cexception.c Fires on a CPU exceptionFires on a CPU exception
►Name of exceptionName of exception►Error codeError code►System statusSystem status►Register statusRegister status►Code Segment: Instruction Point (CS:IP)Code Segment: Instruction Point (CS:IP)
Finding CPU (CPUID)Finding CPU (CPUID)
►cpuid.asm, cpu_info.asmcpuid.asm, cpu_info.asm CPU BrandCPU Brand CPU VendorCPU Vendor CPU FeaturesCPU Features
Console DriverConsole Driver
►User I/O (console.c, keyboard.c)User I/O (console.c, keyboard.c) User inputUser input Test results, reportsTest results, reports
TimerTimer
► PIT [irq_handler.c, timer_handler()]PIT [irq_handler.c, timer_handler()]► Realtime Clock (RTC) [time.c, read_system_time() ]Realtime Clock (RTC) [time.c, read_system_time() ]
Read current value from CMOS Read current value from CMOS ► Stop Timer [ start_time(), stop_time()Stop Timer [ start_time(), stop_time()
Stop timer for performance analysis – 1ms sensivityStop timer for performance analysis – 1ms sensivity
SMBIOSSMBIOS
► Basic SMBIOS support [ smbios.c, read_smbios() ]Basic SMBIOS support [ smbios.c, read_smbios() ] Searches 000F0000h-000FFFFFh for SMBIOS signatureSearches 000F0000h-000FFFFFh for SMBIOS signature Basic BIOS, system, motherboard infoBasic BIOS, system, motherboard info
► Ongoing developmentOngoing development
Makefile targetsMakefile targets
►MakeMake Compile & link sourcesCompile & link sources
►Make imageMake image Disk image with GRUBDisk image with GRUB
►Make isoMake iso ISO image ISO image
DocumentationDocumentation
►/doc folder under Subversion Repo./doc folder under Subversion Repo. PIC, PIT, RTC…PIC, PIT, RTC… Compiling, Development EnvironmentCompiling, Development Environment Technical topics, specificationsTechnical topics, specifications
ResultResult►BootstrapBootstrap►Vital kernel functionsVital kernel functions►Base platform for performance analysisBase platform for performance analysis