|  |  |  |  |  |  | 
					            
						            
							            
								            |  | 
	Windows内核调试帖子发起人: pch   发起时间: 2008-09-08 15:18 下午   回复: 5
 
	 
		
			| 
					
						|         | 
						      
						        | 帖子排序: |  |  |  |  
				
					| 
							
								| 
										
											|  2008-09-08, 15:18 下午 |  
											| 
													 pch 
 
   注册: 2008-08-26
 发 贴: 28
 |  |  
											| 
													
														|   |  |  
														|  | IP 地址: 已记录 | 报告 |  |  |  |  
				
					| 
							
								| 
										
											|  2008-09-08, 22:51 下午 |  
											| 
													 格蠹老雷 
 
   注册: 2005-12-19
 发 贴: 1,303
 |  |  
											| 
													
														|   | 
																
																	| 如果不是64位的驱动,那么可以使用嵌入式汇编: _asm {
 cli
 }
 
 
 
 
 |  |  
														|  | IP 地址: 已记录 | 报告 |  |  |  |  
				
					| 
							
								| 
										
											|  2008-09-09, 09:06 上午 |  
											| 
													 王宇 
 
  
   注册: 2007-05-08
 发 贴: 306
 |  |  
											| 
													
														|   | 
																
																	| 类似的,开中断也是一样,请参看Win源码: 
 ; arg6 - LoaderBlock
 ; arg5 - processor number
 ; arg4 - addr of prcb
 ; arg3 - idle thread's stack
 ; arg2 - addr of current thread obj
 ; arg1 - addr of current process obj
 
 ; initialize system data structures
 ; and HAL.
 
 stdCall    _KiInitializeKernel,
 
 ;
 ; Set idle thread priority.
 ;
 
 mov     ebx,PCR[PcPrcbData+PbCurrentThread] ; get idle thread address
 mov     byte ptr [ebx]+ThPriority, 0 ; set idle thread priority
 
 ;
 ; Control is returned to the idle thread with IRQL at HIGH_LEVEL. Lower IRQL
 ; to DISPATCH_LEVEL and set wait IRQL of idle thread.
 ;
 
 sti        /* Force interrupts enabled */
 LowerIrql DISPATCH_LEVEL
 mov     byte ptr [ebx]+ThWaitIrql, DISPATCH_LEVEL
 
 .........
 
 
 其中 KiInitializeKernel() 是核心启动例程。
 
 |  |  
														|  | IP 地址: 已记录 | 报告 |  |  |  |  
				
					| 
							
								| 
										
											|  2008-09-09, 09:12 上午 |  
											| 
													 王宇 
 
  
   注册: 2007-05-08
 发 贴: 306
 |  |  
											| 
													
														|   | 
																
																	| 论坛似乎将 尖括号对 认为是“注释”? 上面的 _KiInitializeKernel 例程参数被截断了(这里的masm语法格式将参数置于尖括号内),它的完整参数如下: 
 offset _KiInitialProcess,ebx,edx,dword ptr PCR[PcPrcb],eax,_KeLoaderBlock
 
 另外,看着 KPCR 和 KPCRB 长起来的感觉很不错~
 
 |  |  
														|  | IP 地址: 已记录 | 报告 |  |  |  |  
				
					| 
							
								| 
										
											|  2008-10-30, 15:50 下午 |  
											| 
													 skyworth 
 
   注册: 2008-06-07
 发 贴: 55
 |  |  
											| 
													
														|   |  |  
														|  | IP 地址: 已记录 | 报告 |  |  |  |  
				
					| 
							
								| 
										
											|  2008-10-30, 21:21 下午 |  
											| 
													 格蠹老雷 
 
   注册: 2005-12-19
 发 贴: 1,303
 |  |  
											| 
													
														|   | 
																
																	| 是Windows SDK/DDK/WDK在编译64位程序时不再支持嵌入式汇编。 
 |  |  
														|  | IP 地址: 已记录 | 报告 |  |  |  |  
		
			| 高端调试 » 软件调试 » Windows内核调试 » Re: 请教:在内核中如何关中断? |  |  
 |  |  |  |