亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? apc.c

?? 該項目主要是將wingdows程序直接運行在linux上
?? C
字號:
/* * apc.c * * Copyright (C) 2006  Insigme Co., Ltd * * Authors:  * - Limin Jin * * This software has been developed while working on the Linux Unified Kernel * project (http://linux.insigma.com.cn) in the Insigma Reaserch Institute,   * which is a subdivision of Insigma Co., Ltd (http://www.insigma.com.cn). *  * The project is sponsored by Insigma Co., Ltd. * * The authors can be reached at linux@insigma.com.cn. * * This program is free software; you can redistribute it and/or modify it * under the terms of  the GNU General  Public License as published by the * Free Software Foundation; either version 2 of the  License, or (at your * option) any later version. * * Revision History: *   Jan 2006 - Created. *//*  * apc.c: apc implementation * Reference to ReactOS code */#include <linux/module.h>#include "apc.h"#include "thread.h"#include "process.h"#include "w32syscall.h"#include <linux/winternl.h>#include <linux/list.h>#ifdef CONFIG_UNIFIED_KERNELunsigned long get_apc_dispatcher(void);/*  * KiFreeApcRoutine * Free apc */VOIDSTDCALLKiFreeApcRoutine(PKAPC Apc,		PKNORMAL_ROUTINE* NormalRoutine,		PVOID* NormalContext,		PVOID* SystemArgument1,		PVOID* SystemArgument2){	/* Free the APC */	kfree(Apc);} /* end KiFreeApcRoutine *//* PsExitSpecialApc*/VOIDSTDCALLPsExitSpecialApc(PKAPC Apc,    		PKNORMAL_ROUTINE* NormalRoutine,		PVOID* NormalContext,		PVOID* SystemArgument1,		PVOID* SystemArguemnt2){	int exit_status = (int) Apc->normal_routine;		ktrace("PsExitSpecialApc called to exit thread: 0x%p\n",thread_find());	/* Free the APC */	kfree(Apc);		/* Terminate the Thread */	ExitCurrentThread(current, exit_status);  } /* end PsExitSpecialApc *//* * FUNCTION: Tests whether there are any pending APCs for the current thread * and if so the APCs will be delivered on exit from kernel mode */BOOLEANSTDCALLKeTestAlertThread(IN KPROCESSOR_MODE AlertMode){	/* FIXME; */	return 0;}/*  * KeInitializeApc * Initialize Apc */VOIDSTDCALLKeInitializeApc(IN PKAPC Apc,		IN PKTHREAD Thread,		IN KAPC_ENVIRONMENT TargetEnvironment,		IN PKKERNEL_ROUTINE KernelRoutine,		IN PKRUNDOWN_ROUTINE RundownRoutine OPTIONAL,		IN PKNORMAL_ROUTINE NormalRoutine,		IN KPROCESSOR_MODE Mode,		IN PVOID Context){	ktrace("KeInitializeApc(Apc %p, Thread %p, Environment %d, KernelRoutine %p, \		RundownRoutine %p, NormalRoutine %p, Mode %d, Context %p)\n", 		Apc, &Thread, TargetEnvironment, KernelRoutine, 		RundownRoutine, NormalRoutine, Mode, Context);		Apc->type = ApcObject;	Apc->size = sizeof(struct kapc);	if (TargetEnvironment == CurrentApcEnvironment) 		Apc->apc_state_index = Thread->apc_state_index;	else Apc->apc_state_index = TargetEnvironment;		/* Set the Thread and Routines */	Apc->thread = Thread;	Apc->kernel_routine = KernelRoutine;	Apc->rundown_routine = NULL;   /*RundownRoutine has't been implemented*/	Apc->normal_routine = NormalRoutine;	/* Check if this is a Special APC, in which case we use KernelMode and no Context */	if (NormalRoutine!=NULL) {		Apc->apc_mode = Mode;		Apc->normal_context = Context;	} else 	Apc->apc_mode = KernelMode;		Apc->inserted = 0;	return;} /* end KiInitializeUserApc *//*  * KiInsertQueueApc * Insert apc to apc queue */BOOLEANSTDCALLKiInsertQueueApc(PKAPC Apc, KPRIORITY PriorityBoost){	struct kthread *thread = Apc->thread; 	struct list_head *head, *apc_listentry;	struct kapc *queued_apc;	struct kapc_state *apc_state;	ktrace("KiInsertQueueApc\n");	/* Don't do anything if the APC is already inserted */	if (Apc->inserted) return 0;	/*	 * Three scenarios:	 * 1) Kernel APC with Normal Routine or User APC = Put it at the end of the List	 * 2) User APC which is PsExitSpecialApc = Put it at the front of the List	 * 3) Kernel APC without Normal Routine = Put it at the end of the No-Normal Routine 	 *    Kernel APC list	 */	apc_state = thread->apc_state_pointer[(int)Apc->apc_state_index];	head = &apc_state->apc_list_head[(int)(Apc->apc_mode)];	if ((Apc->apc_mode != KernelMode) && 			(Apc->kernel_routine == (PKKERNEL_ROUTINE)PsExitSpecialApc)) { /* 2) */		ktrace("Inserting the Process Exit APC into the Queue\n");		list_add(&Apc->apc_list_entry, head);	} else if (!Apc->normal_routine) {                                             /* 3) */		ktrace("Inserting Special APC %p into the Queue\n", Apc);		for (apc_listentry = head->next;				apc_listentry != head;				apc_listentry = apc_listentry->next) {			queued_apc = list_entry(apc_listentry, struct kapc, apc_list_entry);			if (queued_apc->normal_routine != NULL) break;		}		/* We found the first "Normal" APC, so write right before it */		apc_listentry = apc_listentry->prev;		list_add(&Apc->apc_list_entry, apc_listentry);	} else {                                                                       /* 1) */		ktrace("Inserting Normal APC %p into the %x Queue\n", Apc, Apc->apc_mode);		list_add_tail(&Apc->apc_list_entry, head);	}	/* FIXME	 * Three possibilites here again:	 *  1) Kernel APC, The thread is Running: Request an Interrupt	 *  2) Kernel APC, The Thread is Waiting at PASSIVE_LEVEL and APCs are enabled 	 *     and not in progress: Unwait the Thread	 *  3) User APC, Unwait the Thread if it is alertable	 */		/* Confirm Insertion */	Apc->inserted = 1;	if (Apc->apc_mode == KernelMode) thread->apc_state.kapc_pending = 1;	else thread->apc_state.uapc_pending = 1;		return 1;} /* end KiInsertQueueApc *//* * KeInsertQueueApc */BOOLEANSTDCALLKeInsertQueueApc(PKAPC Apc,		PVOID SystemArgument1,		PVOID SystemArgument2,		KPRIORITY PriorityBoost){	BOOL inserted;	struct kthread *thread;		ktrace("KeInsertQueueApc(Apc %p, SystemArgument1 %p, SystemArgument2 %p)\n", 			Apc, SystemArgument1, SystemArgument2);	/* Get the Thread specified in the APC */	thread = Apc->thread;			/* Disable interrupt and lock shared resource */	spin_lock_irq(&thread->apc_queue_lock);		if (!thread->apc_queueable) {                       		kdebug("Thread doesn't allow APC Queues\n");		spin_unlock_irq(&thread->apc_queue_lock);		return 0;	}		Apc->system_argument1 = SystemArgument1;	Apc->system_argument2 = SystemArgument2;	inserted = KiInsertQueueApc(Apc, PriorityBoost);	/* Enable interrupt and unlock shared resource */	spin_unlock_irq(&thread->apc_queue_lock);		return inserted;} /* end KeInsertQueueApc *//* * NtQueueApcThread   * system call NtQueueApcThread * which called from user   */NTSTATUS STDCALLNtQueueApcThread(HANDLE ThreadHandle,		PKNORMAL_ROUTINE ApcRoutine,		PVOID NormalContext,		PVOID SystemArgument1,		PVOID SystemArgument2){	struct kapc *apc;	struct ethread *thread;	NTSTATUS status;	ktrace("NtQueueApcThread\n");	if (!(thread = thread_find())) {		return -EINVAL;	}        	/* Set thread_info's flag */ 		set_tsk_thread_flag(thread->et_task, TIF_APC);	if (!(apc = kmalloc(sizeof(struct kapc),GFP_KERNEL))) {		kdebug("***error malloc, No memory\n");		return -EINVAL;	}		KeInitializeApc(apc,			&thread->tcb,			OriginalApcEnvironment,			KiFreeApcRoutine,			NULL,			ApcRoutine,			UserMode,			NormalContext);	if (!KeInsertQueueApc(apc, SystemArgument1, SystemArgument2, IO_NO_INCREMENT)) 		status = STATUS_UNSUCCESSFUL;	else	status = STATUS_SUCCESS;		return status;} /* end NtQueueApcThread *//*  * KiDeliverApc * Dequeue the apc queue , and call apc function one by one */VOID STDCALLKiDeliverApc(KPROCESSOR_MODE DeliveryMode,	    PVOID Reserved,	    struct pt_regs * TrapFrame){	struct ethread *thread;	struct list_head * apc_listentry; 	struct kapc *apc;	kernel_routine_t kernel_routine;	void * normal_context;	normal_routine_t normal_routine;	void *system_argument1;	void *system_argument2;	ktrace("KiDeliverApc(DeliverMode 0x%x, Reserved 0x%p, TrapFrame 0x%p)\n", 			DeliveryMode, Reserved, TrapFrame);	if (!(thread = thread_find())) {			kdebug("***error find thread\n");		clear_tsk_thread_flag(thread->et_task,TIF_APC);		return;	}	/* Disable interrupt and lock shared resource */	spin_lock_irq(&thread->tcb.apc_queue_lock);		/* Do the Kernel APCs first */	while (!list_empty(&thread->tcb.apc_state.apc_list_head[KernelMode])) {		/* Get the next Entry */		apc_listentry = thread->tcb.apc_state.apc_list_head[KernelMode].next;		apc = list_entry(apc_listentry, struct kapc, apc_list_entry);		/* Save Parameters so that it's safe to free the Object in Kernel Routine*/		normal_routine = apc->normal_routine;		kernel_routine = apc->kernel_routine;		normal_context = apc->normal_context;		system_argument1 = apc->system_argument1;		system_argument2 = apc->system_argument2;				if (!normal_routine) {			ktrace("2) Delivering Special APC: 0x%p\n", apc);			/* Remove the APC from the list */			apc->inserted= 0;			list_del(apc_listentry);			/* Enable interrupt and unlock shared resource */			spin_unlock_irq(&thread->tcb.apc_queue_lock);			/* Call the Special APC */			kernel_routine(apc,					&normal_routine,					&normal_context,					&system_argument1,					&system_argument2);						/* Disable interrupt and lock shared resource again */			spin_lock_irq(&thread->tcb.apc_queue_lock);		} else {			ktrace("1) Delivering a Normal APC: 0x%p\n", apc);					/* FIXME			 * DeliveryMode must be KernelMode in this case, since one may not			 * return to umode while being inside a critical section or while 			 * a regular kmode apc is running (the latter should be impossible btw).			 */					/* Dequeue the APC */			list_del(apc_listentry);			apc->inserted = 0;						/* Enable interrupt and unlock shared resource */			spin_unlock_irq(&thread->tcb.apc_queue_lock);			/* Call the Kernel APC */			kernel_routine(apc,					&normal_routine,					&normal_context,					&system_argument1,					&system_argument2);			/* If There still is a Normal Routine, then we need to call it */			if (normal_routine) {				/* which is unplemented for premting by special apc */  				thread->tcb.apc_state.kapc_inprogress = 1; 								normal_routine(&normal_context, &system_argument1, &system_argument2);			}			/* Disable interrupt and lock shared resource again */			spin_lock_irq(&thread->tcb.apc_queue_lock);						thread->tcb.apc_state.kapc_inprogress = 0;		}	}	/* Clear APC Pending */	thread->tcb.apc_state.kapc_pending = 0;		/* Now we do the User APCs */	if ((!list_empty(&thread->tcb.apc_state.apc_list_head[UserMode])) &&		(thread->tcb.apc_state.uapc_pending)) {		/* && (DeliveryMode == UserMode) */ 		ktrace("3) Delivering a User APC: 0x%p\n", apc);		/* Get the APC Object */		apc_listentry = thread->tcb.apc_state.apc_list_head[UserMode].next;		apc = list_entry(apc_listentry, struct kapc, apc_list_entry);		/* Save Parameters so that it's safe to free the Object in Kernel Routine*/		normal_routine = apc->normal_routine;		kernel_routine = apc->kernel_routine;		normal_context = apc->normal_context;		system_argument1 = apc->system_argument1;		system_argument2 = apc->system_argument2; 		/* Remove the APC from Queue, call the APC */		list_del(apc_listentry);		apc->inserted = 0;				/* Enable interrupt and unlock shared resource */		spin_unlock_irq(&thread->tcb.apc_queue_lock);				kernel_routine(apc,				&normal_routine,				&normal_context,				&system_argument1,				&system_argument2);		if (!normal_routine) {				KeTestAlertThread(UserMode);   /* Unimplements */		} else {			/* Set up the Trap Frame and prepare for Execution in NTDLL.DLL */			KiInitializeUserApc(Reserved, 					TrapFrame,					normal_routine,					normal_context,					system_argument1,					system_argument2); 		}	} else {		/* It's not pending anymore */		thread->tcb.apc_state.uapc_pending = 0;		/* Enable interrupt and unlock shared resource */		spin_unlock_irq(&thread->tcb.apc_queue_lock);		/* Clear thread_info's flag */		clear_tsk_thread_flag(thread->et_task,TIF_APC);	}	return;} /* end KiDeliverApc *//* * KiInitializeUserApc * Save the trapframe and set the esp for returning to user space to call apc function */VOIDSTDCALLKiInitializeUserApc(IN PVOID Reserved,		IN PKTRAP_FRAME TrapFrame,		IN PKNORMAL_ROUTINE NormalRoutine,		IN PVOID NormalContext,		IN PVOID SystemArgument1,		IN PVOID SystemArgument2)  {	PContext context;	PULONG esp;		ktrace("KiInitializeUserApc, ESP 0x%lx\n", TrapFrame->esp);	/*	 * Save the thread's current context (in other words the registers	 * that will be restored when it returns to user mode) so the	 * APC dispatcher can restore them later	 */	context = (PContext)(((PUCHAR)TrapFrame->esp) - sizeof(*context));	memcpy(context, TrapFrame, sizeof(*context));	/*	 * Setup the trap frame so the thread will start executing at the	 * APC Dispatcher when it returns to user-mode	 */	esp = (PULONG)(((PUCHAR)TrapFrame->esp) - (sizeof(CONTEXT) + (6 * sizeof(ULONG))));	esp[0] = 0xdeadbeef;	esp[1] = (ULONG)NormalRoutine;	esp[2] = (ULONG)NormalContext;	esp[3] = (ULONG)SystemArgument1;	esp[4] = (ULONG)SystemArgument2;	esp[5] = (ULONG)context;	TrapFrame->eip = get_apc_dispatcher();	TrapFrame->esp = (ULONG)esp;} /* end KiInitializeUserApc *//* * NtContinue * Go back to kernel space */NTSTATUS STDCALLNtContinue(IN PContext Context,	  IN BOOLEAN TestAlert){	PKTRAP_FRAME trap_frame = (PKTRAP_FRAME)current->ethread->tcb.trap_frame;	/*	 * Copy the supplied context over the register information that was saved	 * on entry to kernel mode, it will then be restored on exit	 * FIXME: Validate the context	 */	memcpy(trap_frame, Context, sizeof(*trap_frame));        /* FIXME	 * Copy floating point context into the thread's FX_SAVE_AREA	 */		__asm__(		"andl %%esp, %%ecx;\n\t"		"movl %%ecx, %%ebp;\n\t"		"movl %%ebx, %%esp;\n\t"		"jmp w32syscall_exit\n\t"		:		: "b" (trap_frame), "c" (-THREAD_SIZE));		/* This doesn't actually happen b/c KeRosTrapReturn() won't return */	return STATUS_SUCCESS;} /* NtContinue */#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲第一久久影院| 亚洲丰满少妇videoshd| 最新国产の精品合集bt伙计| 亚洲色图一区二区三区| 欧美a级理论片| 欧美日韩一本到| 国产欧美精品国产国产专区| 青青草97国产精品免费观看无弹窗版| 成人免费看视频| 欧美成人一级视频| 日日欢夜夜爽一区| 欧美怡红院视频| 亚洲人成7777| 成人理论电影网| 久久久久久久久久看片| 午夜精品久久久久久久| 91精品办公室少妇高潮对白| 日韩精品电影在线观看| 国产美女精品在线| 欧美一区二区观看视频| 亚洲高清在线精品| 在线观看网站黄不卡| 亚洲视频一区二区在线观看| 国产高清久久久| 欧美精品一区二区三区久久久| 亚洲一区在线播放| 日本韩国欧美三级| 亚洲精品成人精品456| 高清成人在线观看| 国产精品网站一区| www.视频一区| 国产精品久久久久久亚洲毛片| 国产成人亚洲精品青草天美| 欧美精品一区二| 国产精品中文字幕一区二区三区| 日韩精品一区二区三区中文精品| 毛片av一区二区三区| 日韩亚洲欧美在线| 蜜臀av在线播放一区二区三区| 欧美一区二区三区婷婷月色| 免费高清在线一区| 日韩精品一区二| 国产精品一区二区无线| 国产欧美一区二区三区沐欲| 成人91在线观看| 亚洲精品国产无天堂网2021| 综合久久国产九一剧情麻豆| 黄色资源网久久资源365| 日韩精品一区二区三区swag | 欧美精选在线播放| 三级一区在线视频先锋| 精品美女被调教视频大全网站| 激情久久久久久久久久久久久久久久| 久久九九全国免费| 93久久精品日日躁夜夜躁欧美| 亚洲国产日日夜夜| 久久综合色之久久综合| 91啪亚洲精品| 蜜臀久久久99精品久久久久久| 国产夜色精品一区二区av| 91黄色免费版| 精品综合免费视频观看| **性色生活片久久毛片| 7777精品伊人久久久大香线蕉超级流畅 | 国产精品丝袜一区| 欧美亚洲一区三区| 极品销魂美女一区二区三区| 亚洲欧美在线观看| 日韩欧美一级在线播放| 91亚洲永久精品| 麻豆精品新av中文字幕| 一区二区三区中文字幕精品精品 | 91视频在线观看| 欧美aaaaa成人免费观看视频| 亚洲国产经典视频| 5858s免费视频成人| a在线欧美一区| 久久99国产精品免费网站| 国产精品传媒入口麻豆| 日韩精品综合一本久道在线视频| 972aa.com艺术欧美| 国产精品亚洲成人| 日本三级亚洲精品| 一区二区三区视频在线观看| 国产亚洲一区二区在线观看| 6080午夜不卡| 欧美日韩精品系列| 一道本成人在线| 国产精品资源在线观看| 日韩国产欧美在线播放| 一区二区三区免费看视频| 国产精品污网站| 久久网站热最新地址| 国产一区二区三区综合| 肉色丝袜一区二区| 中文字幕色av一区二区三区| 精品日韩av一区二区| 欧美日韩在线免费视频| 99久久精品免费看国产| 国内欧美视频一区二区| 琪琪久久久久日韩精品| 午夜精品一区二区三区电影天堂| 亚洲天堂成人在线观看| 欧美经典一区二区三区| 26uuu色噜噜精品一区| 欧美大片一区二区| 日韩一区二区在线看片| 欧美伦理影视网| 欧美日韩国产一区| 欧美性生活影院| 欧美三级一区二区| 欧美色综合久久| 欧美高清视频一二三区| 9191精品国产综合久久久久久| 在线国产电影不卡| 欧美日韩成人综合| 欧美精品一二三四| 欧美日韩电影在线播放| 欧美探花视频资源| 91麻豆精品国产91久久久 | 亚洲国产精品t66y| 在线观看免费视频综合| 色av成人天堂桃色av| 色综合久久综合网97色综合| 91日韩精品一区| 奇米色一区二区三区四区| 丰满少妇久久久久久久| 亚洲动漫第一页| 亚洲444eee在线观看| 亚洲精品免费视频| 欧美国产精品v| 国产日韩欧美精品一区| 欧美猛男男办公室激情| 制服丝袜日韩国产| 在线播放/欧美激情| 欧美国产精品一区| 国产91丝袜在线播放0| 国产在线国偷精品产拍免费yy| 日韩精品成人一区二区在线| 日本v片在线高清不卡在线观看| 欧美a一区二区| 国产精品一区三区| 91精彩视频在线观看| 欧美福利视频导航| 国产亚洲女人久久久久毛片| 亚洲女爱视频在线| 日韩精品色哟哟| 国产成人av网站| 欧美日本韩国一区二区三区视频 | 亚洲男人的天堂一区二区| 亚洲影视在线观看| 精品一区二区三区在线观看国产| 成人国产精品视频| 91精品国产综合久久精品app| 国产亚洲va综合人人澡精品| 亚洲二区在线观看| 国产成人免费视频网站高清观看视频 | 亚洲丝袜另类动漫二区| 美女视频一区二区| 日本精品免费观看高清观看| www激情久久| 午夜日韩在线观看| 成人国产在线观看| 欧美成人一级视频| 视频一区二区中文字幕| 成人h动漫精品| 精品国产区一区| 亚洲成av人影院在线观看网| 99在线精品视频| 久久久午夜精品| 久久er精品视频| 欧美日韩免费不卡视频一区二区三区 | 9久草视频在线视频精品| 日韩精品一区二区三区老鸭窝| 亚洲国产毛片aaaaa无费看| 国产传媒久久文化传媒| 欧美一级理论性理论a| 一级精品视频在线观看宜春院| 成人美女在线观看| 日韩欧美电影一区| 日韩专区在线视频| 欧美日韩一区二区三区视频| 中文字幕一区二区三区蜜月 | 国产精品久久久久久久蜜臀| 精品一区二区免费在线观看| 制服丝袜日韩国产| 午夜亚洲福利老司机| 在线精品国精品国产尤物884a| 国产精品成人一区二区艾草| 国产69精品久久99不卡| 久久男人中文字幕资源站| 免费xxxx性欧美18vr| 91精品国产综合久久久蜜臀图片 | 日韩视频免费直播| 视频在线观看一区| 337p亚洲精品色噜噜噜| 亚洲成人激情av| 欧美高清视频一二三区 | 中文在线免费一区三区高中清不卡| 紧缚奴在线一区二区三区|