资源描述:
《linux信号与软中断(linux signal and soft interrupt)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、linux信号与软中断(Linuxsignalandsoftinterrupt)SoftinterruptSoftinterruptisgenerallyreferredtoasapseudointerruptactioncausedbyinstructionint-anartifactthatinterruptsCPU,whileahardinterruptisarealinterrupttriggeredbya8259line.Therefore,strictlyspeaking,intandIRQhavenothingtodowitheachother,butthetwoarere
2、latedtotheinterruptvector.IntinduceddisruptionofCPU,istheinterruptvectornumberfromtheinstructioninIRQ;thebreakcausedbyCPUfromthedatalinemustretrievetheinterruptnumber(hardwareinterrupttriggeredfirstto8259AIRQpin8259,accordingtothedefinedrulesconversioninterruptvectornumber,thecorrespondingplacein
3、thedatalinethennotifytheCPUinterruptarrival).Next,CPUworksjustthesame:protectingthescene,breakingtheprogramaddress,executinginterruptprocessing,restoringthefield,andcontinuingtoexecutetheinterruptedinstructions.TheWindowsdrivercannottakeovertheinterruptdirectly.TheinterruptistakenoverbytheVPICDof
4、thekernel.ThedriverjustregisterstheinterruptservicetotheVPICD,andtheinterruptservicewillbecalledbyVPICD.Thiscaneffectivelyimplementvirtualdevices:virtualdevicesthatdonotexistorchangethebehaviorofexistingphysicaldevices.Linuxusesint$80toimplementsystemcallexceptions.Thisinstructiontransfersthecont
5、roltothekernelbyusinginterrupt/exceptionvectornumber128(i.e.,80of16).Inordertoachievethesystemcallwithoutusingmachineinstructionprogramming,inthestandardClanguagelibraryforeachsystemcallprovidesashortsubroutine,completethemachinecodeprogramming.Infact,themachinecodesectionisveryshort.Allithastodo
6、isloadtheparametersthatcallthesystemintotheCPUregister,andthenexecutetheint$0x80instructions.Then,thesystemcallisinvoked,andthereturnvalueofthesystemcallissenttoaregisterinCPU.ThestandardlibrarysubroutineobtainsthereturnvalueandsendsitbacktotheuserprogramThereareabout190systemcallsinthegeneralcor
7、eYoucanseethe/usr/src/linux/codedirectory5.init/main.c6.arch/i386/kernel/traps.c7.arch/i386/kernel/entry.S8.arch/i386/kernel/irq.h9.include/asm-386/unistd.hSeveraldocumentsHopetomakeprogresswithyou1,internalinterrupt(s