ReactOS  0.4.14-dev-991-g696cdc6
ppc_irq.c File Reference
#include <ntoskrnl.h>
#include <ppcmmu/mmu.h>
#include <debug.h>
Include dependency graph for ppc_irq.c:

Go to the source code of this file.

Classes

struct  ISR_TABLE
 

Macros

#define NDEBUG
 
#define NR_TRAPS   16
 
#define TAG_ISR_LOCK   'LRSI'
 

Typedefs

typedef struct ISR_TABLEPISR_TABLE
 
typedef ULONG(* PSYSCALL_FUN) (ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG)
 

Functions

void PearPCDebug (int ch)
 
void trap_handler_0 (void)
 
void trap_handler_1 (void)
 
void trap_handler_2 (void)
 
void trap_handler_3 (void)
 
void trap_handler_4 (void)
 
void trap_handler_5 (void)
 
void trap_handler_6 (void)
 
void trap_handler_7 (void)
 
void trap_handler_8 (void)
 
void trap_handler_9 (void)
 
void trap_handler_10 (void)
 
void trap_handler_11 (void)
 
void trap_handler_12 (void)
 
void trap_handler_13 (void)
 
void trap_handler_14 (void)
 
void trap_handler_15 (void)
 
static unsigned int trap_handler [NR_TRAPS__attribute__ ((unused))
 
VOID INIT_FUNCTION NTAPI KeInitInterrupts (VOID)
 
static VOID KeIRQTrapFrameToTrapFrame (PKIRQ_TRAPFRAME IrqTrapFrame, PKTRAP_FRAME TrapFrame)
 
static VOID KeTrapFrameToIRQTrapFrame (PKTRAP_FRAME TrapFrame, PKIRQ_TRAPFRAME IrqTrapFrame)
 
VOID NTAPI KeUpdateRunTime (IN PKTRAP_FRAME TrapFrame, IN KIRQL Irql)
 
VOID NTAPI KeUpdateSystemTime (IN PKTRAP_FRAME TrapFrame, IN KIRQL Irql, IN ULONG Increment)
 
VOID NTAPI KiInterruptDispatch2 (ULONG vector, KIRQL old_level)
 
VOID KiInterruptDispatch3 (ULONG vector, PKIRQ_TRAPFRAME Trapframe)
 
static VOID KeDumpIrqList (VOID)
 
BOOLEAN NTAPI KeConnectInterrupt (PKINTERRUPT InterruptObject)
 
BOOLEAN NTAPI KeDisconnectInterrupt (PKINTERRUPT InterruptObject)
 
VOID NTAPI KeInitializeInterrupt (PKINTERRUPT Interrupt, PKSERVICE_ROUTINE ServiceRoutine, PVOID ServiceContext, PKSPIN_LOCK SpinLock, ULONG Vector, KIRQL Irql, KIRQL SynchronizeIrql, KINTERRUPT_MODE InterruptMode, BOOLEAN ShareVector, CHAR ProcessorNumber, BOOLEAN FloatingSave)
 
VOID KePrintInterruptStatistic (VOID)
 
BOOLEAN NTAPI KeDisableInterrupts (VOID)
 
ULONG NTAPI KdpServiceDispatcher (ULONG Service, PVOID Buffer1, ULONG Buffer1Length, KPROCESSOR_MODE PreviousMode)
 
VOID NTAPI KiSystemService (ppc_trap_frame_t *trap_frame)
 

Variables

KDPC KiExpireTimerDpc
 
ULONG KiMaximumDpcQueueDepth
 
ULONG KiMinimumDpcRate
 
ULONG KiAdjustDpcThreshold
 
ULONG KiIdealDpcRate
 
LONG KiTickOffset
 
ULONG KeMaximumIncrement
 
ULONG KeMinimumIncrement
 
ULONG KeTimeAdjustment
 
static ISR_TABLE IsrTable [NR_TRAPS][1]
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 22 of file ppc_irq.c.

◆ NR_TRAPS

#define NR_TRAPS   16

Definition at line 41 of file ppc_irq.c.

◆ TAG_ISR_LOCK

#define TAG_ISR_LOCK   'LRSI'

Definition at line 144 of file ppc_irq.c.

Typedef Documentation

◆ PISR_TABLE

◆ PSYSCALL_FUN

typedef ULONG(* PSYSCALL_FUN) (ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG)

Definition at line 754 of file ppc_irq.c.

Function Documentation

◆ __attribute__()

static unsigned int trap_handler [NR_TRAPS] __attribute__ ( (unused )
static

◆ KdpServiceDispatcher()

ULONG NTAPI KdpServiceDispatcher ( ULONG  Service,
PVOID  Buffer1,
ULONG  Buffer1Length,
KPROCESSOR_MODE  PreviousMode 
)

Definition at line 65 of file kdmain.c.

69 {
70  ULONG Result = 0;
71 
72  switch (Service)
73  {
74  case BREAKPOINT_PRINT: /* DbgPrint */
75  {
76  /* Call KDBG */
80  (PCHAR)Buffer1,
81  (USHORT)Buffer1Length,
83  NULL, // TrapFrame,
84  NULL, // ExceptionFrame,
85  &Handled);
86  break;
87  }
88 
89 #if DBG
90  case ' soR': /* ROS-INTERNAL */
91  {
92  switch ((ULONG_PTR)Buffer1)
93  {
94  case DumpAllThreads:
96  break;
97 
98  case DumpUserThreads:
100  break;
101 
102  case KdSpare3:
104  break;
105 
106  default:
107  break;
108  }
109  break;
110  }
111 
112 #if defined(_M_IX86) && !defined(_WINKD_) // See ke/i386/traphdlr.c
113  /* Register a debug callback */
114  case 'CsoR':
115  {
116  switch (Buffer1Length)
117  {
118  case ID_Win32PreServiceHook:
119  KeWin32PreServiceHook = Buffer1;
120  break;
121 
122  case ID_Win32PostServiceHook:
123  KeWin32PostServiceHook = Buffer1;
124  break;
125 
126  }
127  break;
128  }
129 #endif
130 
131  /* Special case for stack frame dumps */
132  case 'DsoR':
133  {
134  KeRosDumpStackFrames((PULONG_PTR)Buffer1, Buffer1Length);
135  break;
136  }
137 
138 #if defined(KDBG)
139  /* Register KDBG CLI callback */
140  case 'RbdK':
141  {
142  Result = KdbRegisterCliCallback(Buffer1, Buffer1Length);
143  break;
144  }
145 #endif /* KDBG */
146 #endif /* DBG */
147  default:
148  DPRINT1("Invalid debug service call!\n");
149  HalDisplayString("Invalid debug service call!\r\n");
150  break;
151  }
152 
153  return Result;
154 }
NTSTATUS NTAPI KdpPrint(_In_ ULONG ComponentId, _In_ ULONG Level, _In_reads_bytes_(Length) PCHAR String, _In_ USHORT Length, _In_ KPROCESSOR_MODE PreviousMode, _In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame, _Out_ PBOOLEAN Handled)
Definition: kdprint.c:331
signed char * PCHAR
Definition: retypes.h:7
#define KeRosDumpStackFrames(Frames, Count)
Definition: gdidebug.h:11
#define TRUE
Definition: types.h:120
VOID NTAPI MmDumpArmPfnDatabase(IN BOOLEAN StatusOnly)
Definition: mminit.c:1474
#define DPFLTR_INFO_LEVEL
Definition: kdtypes.h:33
VOID NTAPI PspDumpThreads(BOOLEAN SystemThreads)
uint32_t ULONG_PTR
Definition: typedefs.h:64
BOOLEAN NTAPI KdbRegisterCliCallback(PVOID Callback, BOOLEAN Deregister)
Definition: kdb_cli.c:3498
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
_In_ BOOLEAN Handled
Definition: ketypes.h:337
#define BREAKPOINT_PRINT
Definition: kdtypes.h:51
#define MAXULONG
Definition: typedefs.h:251
unsigned short USHORT
Definition: pedump.c:61
NTHALAPI VOID NTAPI HalDisplayString(PUCHAR String)
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
uint32_t * PULONG_PTR
Definition: typedefs.h:64

Referenced by KdSystemDebugControl(), and KiSystemService().

◆ KeConnectInterrupt()

BOOLEAN NTAPI KeConnectInterrupt ( PKINTERRUPT  InterruptObject)

Definition at line 540 of file ppc_irq.c.

541 {
542  KIRQL oldlvl,synch_oldlvl;
543  PKINTERRUPT ListHead;
544  ULONG Vector;
545  PISR_TABLE CurrentIsr;
546  BOOLEAN Result;
547 
548  DPRINT("KeConnectInterrupt()\n");
549 
550  Vector = InterruptObject->Vector;
551 
553  return FALSE;
554 
556 
558 
559  CurrentIsr = &IsrTable[Vector][(ULONG)InterruptObject->Number];
560 
561  KeRaiseIrql(Vector,&oldlvl);
562  KiAcquireSpinLock(&CurrentIsr->Lock);
563 
564  /*
565  * Check if the vector is already in use that we can share it
566  */
567  if (!IsListEmpty(&CurrentIsr->ListHead))
568  {
569  ListHead = CONTAINING_RECORD(CurrentIsr->ListHead.Flink,KINTERRUPT,InterruptListEntry);
570  if (InterruptObject->ShareVector == FALSE || ListHead->ShareVector==FALSE)
571  {
572  KiReleaseSpinLock(&CurrentIsr->Lock);
573  KeLowerIrql(oldlvl);
575  return FALSE;
576  }
577  }
578 
580 
581  DPRINT("%x %x\n",CurrentIsr->ListHead.Flink, CurrentIsr->ListHead.Blink);
582 
584  if (Result)
585  {
586  InsertTailList(&CurrentIsr->ListHead,&InterruptObject->InterruptListEntry);
587  DPRINT("%x %x\n",InterruptObject->InterruptListEntry.Flink, InterruptObject->InterruptListEntry.Blink);
588  }
589 
590  InterruptObject->Connected = TRUE;
592 
593  /*
594  * Release the table spinlock
595  */
596  KiReleaseSpinLock(&CurrentIsr->Lock);
597  KeLowerIrql(oldlvl);
598 
599  KeDumpIrqList();
600 
602 
603  return Result;
604 }
BOOLEAN NTAPI HalEnableSystemInterrupt(IN ULONG Vector, IN KIRQL Irql, IN KINTERRUPT_MODE InterruptMode)
Definition: pic.c:295
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define TRUE
Definition: types.h:120
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
struct _LIST_ENTRY * Blink
Definition: typedefs.h:121
VOID NTAPI KeRevertToUserAffinityThread(VOID)
Definition: thrdobj.c:1030
LIST_ENTRY ListHead
Definition: ppc_irq.c:132
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
VOID NTAPI KeSetSystemAffinityThread(IN KAFFINITY Affinity)
Definition: thrdobj.c:1116
UCHAR KIRQL
Definition: env_spec_w32.h:591
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:35
VOID NTAPI KeReleaseInterruptSpinLock(IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
Definition: spinlock.c:165
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
BOOLEAN ShareVector
Definition: ketypes.h:844
KIRQL NTAPI KeAcquireInterruptSpinLock(IN PKINTERRUPT Interrupt)
Definition: spinlock.c:148
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
KSPIN_LOCK Lock
Definition: ppc_irq.c:133
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG Vector
Definition: iofuncs.h:798
VOID FASTCALL KiAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:28
unsigned int ULONG
Definition: retypes.h:1
static ISR_TABLE IsrTable[NR_TRAPS][1]
Definition: ppc_irq.c:141
#define NR_TRAPS
Definition: ppc_irq.c:41
static VOID KeDumpIrqList(VOID)
Definition: ppc_irq.c:499

◆ KeDisableInterrupts()

BOOLEAN NTAPI KeDisableInterrupts ( VOID  )

Definition at line 733 of file ppc_irq.c.

734 {
735  ULONG Flags = 0;
736  BOOLEAN Return;
737 
738  Flags = __readmsr();
739  Return = (Flags & 0x8000) ? TRUE: FALSE;
740 
741  /* Disable interrupts */
742  _disable();
743  return Return;
744 }
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
unsigned char BOOLEAN
PPC_QUAL unsigned long long __readmsr()
Definition: intrin_ppc.h:741
void __cdecl _disable(void)
Definition: intrin_arm.h:365
unsigned int ULONG
Definition: retypes.h:1

◆ KeDisconnectInterrupt()

BOOLEAN NTAPI KeDisconnectInterrupt ( PKINTERRUPT  InterruptObject)

Definition at line 615 of file ppc_irq.c.

616 {
617  KIRQL oldlvl,synch_oldlvl;
618  PISR_TABLE CurrentIsr;
619  BOOLEAN State;
620 
621  DPRINT1("KeDisconnectInterrupt\n");
623 
624  /* Set the affinity */
626 
627  /* Get the ISR Tabe */
628  CurrentIsr = &IsrTable[InterruptObject->Vector]
629  [(ULONG)InterruptObject->Number];
630 
631  /* Raise IRQL to required level and lock table */
632  KeRaiseIrql(InterruptObject->Vector,&oldlvl);
633  KiAcquireSpinLock(&CurrentIsr->Lock);
634 
635  /* Check if it's actually connected */
636  if ((State = InterruptObject->Connected))
637  {
638  /* Lock the Interrupt */
640 
641  /* Remove this one, and check if all are gone */
642  RemoveEntryList(&InterruptObject->InterruptListEntry);
643  if (IsListEmpty(&CurrentIsr->ListHead))
644  {
645  /* Completely Disable the Interrupt */
647  }
648 
649  /* Disconnect it */
650  InterruptObject->Connected = FALSE;
651 
652  /* Release the interrupt lock */
654  }
655  /* Release the table spinlock */
656  KiReleaseSpinLock(&CurrentIsr->Lock);
657  KeLowerIrql(oldlvl);
658 
659  /* Go back to default affinity */
661 
662  /* Return Old Interrupt State */
663  return State;
664 }
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
VOID NTAPI KeRevertToUserAffinityThread(VOID)
Definition: thrdobj.c:1030
LIST_ENTRY ListHead
Definition: ppc_irq.c:132
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
VOID NTAPI KeSetSystemAffinityThread(IN KAFFINITY Affinity)
Definition: thrdobj.c:1116
VOID NTAPI HalDisableSystemInterrupt(IN ULONG Vector, IN KIRQL Irql)
Definition: pic.c:309
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:35
VOID NTAPI KeReleaseInterruptSpinLock(IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
Definition: spinlock.c:165
unsigned char BOOLEAN
KIRQL NTAPI KeAcquireInterruptSpinLock(IN PKINTERRUPT Interrupt)
Definition: spinlock.c:148
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
KSPIN_LOCK Lock
Definition: ppc_irq.c:133
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
enum State_ State
Definition: pofuncs.h:54
VOID FASTCALL KiAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:28
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
static ISR_TABLE IsrTable[NR_TRAPS][1]
Definition: ppc_irq.c:141

◆ KeDumpIrqList()

static VOID KeDumpIrqList ( VOID  )
static

Definition at line 499 of file ppc_irq.c.

500 {
502  PLIST_ENTRY current_entry;
503  LONG i, j;
504  KIRQL oldlvl;
505  BOOLEAN printed;
506 
507  for (i=0;i<NR_TRAPS;i++)
508  {
509  printed = FALSE;
510  KeRaiseIrql(i,&oldlvl);
511 
512  for (j=0; j < KeNumberProcessors; j++)
513  {
515 
516  current_entry = IsrTable[i][j].ListHead.Flink;
517  current = CONTAINING_RECORD(current_entry,KINTERRUPT,InterruptListEntry);
518  while (current_entry!=&(IsrTable[i][j].ListHead))
519  {
520  if (printed == FALSE)
521  {
522  printed = TRUE;
523  DPRINT("For irq %x:\n",i);
524  }
525  DPRINT(" Isr %x\n",current);
526  current_entry = current_entry->Flink;
527  current = CONTAINING_RECORD(current_entry,KINTERRUPT,InterruptListEntry);
528  }
530  }
531  KeLowerIrql(oldlvl);
532  }
533 }
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define TRUE
Definition: types.h:120
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
LIST_ENTRY ListHead
Definition: ppc_irq.c:132
UCHAR KIRQL
Definition: env_spec_w32.h:591
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:35
long LONG
Definition: pedump.c:60
unsigned char BOOLEAN
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
Definition: typedefs.h:118
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
VOID FASTCALL KiAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:28
static ISR_TABLE IsrTable[NR_TRAPS][1]
Definition: ppc_irq.c:141
#define NR_TRAPS
Definition: ppc_irq.c:41
struct task_struct * current
Definition: linux.c:32

Referenced by KeConnectInterrupt().

◆ KeInitializeInterrupt()

VOID NTAPI KeInitializeInterrupt ( PKINTERRUPT  Interrupt,
PKSERVICE_ROUTINE  ServiceRoutine,
PVOID  ServiceContext,
PKSPIN_LOCK  SpinLock,
ULONG  Vector,
KIRQL  Irql,
KIRQL  SynchronizeIrql,
KINTERRUPT_MODE  InterruptMode,
BOOLEAN  ShareVector,
CHAR  ProcessorNumber,
BOOLEAN  FloatingSave 
)

Definition at line 671 of file ppc_irq.c.

682 {
683  /* Set the Interrupt Header */
684  Interrupt->Type = InterruptObject;
685  Interrupt->Size = sizeof(KINTERRUPT);
686 
687  /* Check if we got a spinlock */
688  if (SpinLock)
689  {
690  Interrupt->ActualLock = SpinLock;
691  }
692  else
693  {
694  /* This means we'll be usin the built-in one */
695  KeInitializeSpinLock(&Interrupt->SpinLock);
696  Interrupt->ActualLock = &Interrupt->SpinLock;
697  }
698 
699  /* Set the other settings */
700  Interrupt->ServiceRoutine = ServiceRoutine;
701  Interrupt->ServiceContext = ServiceContext;
702  Interrupt->Vector = Vector;
703  Interrupt->Irql = Irql;
704  Interrupt->SynchronizeIrql = SynchronizeIrql;
705  Interrupt->Mode = InterruptMode;
706  Interrupt->ShareVector = ShareVector;
707  Interrupt->Number = ProcessorNumber;
708  Interrupt->FloatingSave = FloatingSave;
709 
710  /* Disconnect it at first */
711  Interrupt->Connected = FALSE;
712 }
BOOLEAN Connected
Definition: ketypes.h:842
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE InterruptMode
Definition: iofuncs.h:798
KSPIN_LOCK SpinLock
Definition: ketypes.h:834
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE _In_ BOOLEAN ShareVector
Definition: iofuncs.h:798
CSHORT Type
Definition: ketypes.h:825
_Out_ PKIRQL Irql
Definition: csq.h:179
BOOLEAN FloatingSave
Definition: ketypes.h:841
KINTERRUPT_MODE Mode
Definition: ketypes.h:845
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL SynchronizeIrql
Definition: iofuncs.h:798
CCHAR Number
Definition: ketypes.h:843
KIRQL Irql
Definition: ketypes.h:839
BOOLEAN ShareVector
Definition: ketypes.h:844
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:798
ULONG Vector
Definition: ketypes.h:838
PKSERVICE_ROUTINE ServiceRoutine
Definition: ketypes.h:828
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE _In_ BOOLEAN _In_ KAFFINITY _In_ BOOLEAN FloatingSave
Definition: iofuncs.h:798
PKSPIN_LOCK ActualLock
Definition: ketypes.h:836
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG Vector
Definition: iofuncs.h:798
KIRQL SynchronizeIrql
Definition: ketypes.h:840
CSHORT Size
Definition: ketypes.h:826
struct _KINTERRUPT KINTERRUPT
PVOID ServiceContext
Definition: ketypes.h:833
_In_ PKSERVICE_ROUTINE ServiceRoutine
Definition: iofuncs.h:798

◆ KeInitInterrupts()

VOID INIT_FUNCTION NTAPI KeInitInterrupts ( VOID  )

Definition at line 151 of file ppc_irq.c.

152 {
153  int i, j;
154 
155  /*
156  * Setup the IDT entries to point to the interrupt handlers
157  */
158  for (i=0;i<NR_TRAPS;i++)
159  {
160 #ifdef CONFIG_SMP
161  for (j = 0; j < MAXIMUM_PROCESSORS; j++)
162 #else
163  j = 0;
164 #endif
165  {
166  InitializeListHead(&IsrTable[i][j].ListHead);
168  IsrTable[i][j].Count = 0;
169  }
170  }
171 }
#define MAXIMUM_PROCESSORS
Definition: rwlock.h:5
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
ULONG Count
Definition: ppc_irq.c:134
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
static ISR_TABLE IsrTable[NR_TRAPS][1]
Definition: ppc_irq.c:141
#define NR_TRAPS
Definition: ppc_irq.c:41

◆ KeIRQTrapFrameToTrapFrame()

static VOID KeIRQTrapFrameToTrapFrame ( PKIRQ_TRAPFRAME  IrqTrapFrame,
PKTRAP_FRAME  TrapFrame 
)
static

Definition at line 174 of file ppc_irq.c.

176 {
177 }

Referenced by KiInterruptDispatch3().

◆ KePrintInterruptStatistic()

VOID KePrintInterruptStatistic ( VOID  )

Definition at line 714 of file ppc_irq.c.

715 {
716  LONG i, j;
717 
718  for (j = 0; j < KeNumberProcessors; j++)
719  {
720  DPRINT1("CPU%d:\n", j);
721  for (i = 0; i < NR_TRAPS; i++)
722  {
723  if (IsrTable[i][j].Count)
724  {
725  DPRINT1(" Irq %x(%d): %d\n", i, i, IsrTable[i][j].Count);
726  }
727  }
728  }
729 }
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
#define DPRINT1
Definition: precomp.h:8
static ISR_TABLE IsrTable[NR_TRAPS][1]
Definition: ppc_irq.c:141
#define NR_TRAPS
Definition: ppc_irq.c:41

◆ KeTrapFrameToIRQTrapFrame()

static VOID KeTrapFrameToIRQTrapFrame ( PKTRAP_FRAME  TrapFrame,
PKIRQ_TRAPFRAME  IrqTrapFrame 
)
static

Definition at line 180 of file ppc_irq.c.

182 {
183 }

Referenced by KiInterruptDispatch3().

◆ KeUpdateRunTime()

VOID NTAPI KeUpdateRunTime ( IN PKTRAP_FRAME  TrapFrame,
IN KIRQL  Irql 
)

Definition at line 194 of file ppc_irq.c.

196 {
197  PKPRCB Prcb = KeGetCurrentPrcb();
198  PKTHREAD CurrentThread;
200 
201  /* Make sure we don't go further if we're in early boot phase. */
202  if (!(Prcb) || !(Prcb->CurrentThread)) return;
203 
204  /* Get the current thread and process */
205  CurrentThread = Prcb->CurrentThread;
206  CurrentProcess = CurrentThread->ApcState.Process;
207 
208  /* Check if we came from user mode */
209  if (TrapFrame->PreviousMode != KernelMode)
210  {
211  /* Update user times */
212  CurrentThread->UserTime++;
214  Prcb->UserTime++;
215  }
216  else
217  {
218  /* Check IRQ */
219  if (Irql > DISPATCH_LEVEL)
220  {
221  /* This was an interrupt */
222  Prcb->InterruptTime++;
223  }
224  else if ((Irql < DISPATCH_LEVEL) || !(Prcb->DpcRoutineActive))
225  {
226  /* This was normal kernel time */
227  CurrentThread->KernelTime++;
229  }
230  else if (Irql == DISPATCH_LEVEL)
231  {
232  /* This was DPC time */
233  Prcb->DpcTime++;
234  }
235 
236  /* Update CPU kernel time in all cases */
237  Prcb->KernelTime++;
238  }
239 
240  /* Set the last DPC Count and request rate */
241  Prcb->DpcLastCount = Prcb->DpcData[0].DpcCount;
242  Prcb->DpcRequestRate = ((Prcb->DpcData[0].DpcCount - Prcb->DpcLastCount) +
243  Prcb->DpcRequestRate) / 2;
244 
245  /* Check if we should request a DPC */
246  if ((Prcb->DpcData[0].DpcQueueDepth) && !(Prcb->DpcRoutineActive))
247  {
248  /* Request one */
250 
251  /* Update the depth if needed */
252  if ((Prcb->DpcRequestRate < KiIdealDpcRate) &&
253  (Prcb->MaximumDpcQueueDepth > 1))
254  {
255  /* Decrease the maximum depth by one */
256  Prcb->MaximumDpcQueueDepth--;
257  }
258  }
259  else
260  {
261  /* Decrease the adjustment threshold */
262  if (!(--Prcb->AdjustDpcThreshold))
263  {
264  /* We've hit 0, reset it */
266 
267  /* Check if we've hit queue maximum */
269  {
270  /* Increase maximum by one */
271  Prcb->MaximumDpcQueueDepth++;
272  }
273  }
274  }
275 
276  /*
277  * If we're at end of quantum request software interrupt. The rest
278  * is handled in KiDispatchInterrupt.
279  *
280  * NOTE: If one stays at DISPATCH_LEVEL for a long time the DPC routine
281  * which checks for quantum end will not be executed and decrementing
282  * the quantum here can result in overflow. This is not a problem since
283  * we don't care about the quantum value anymore after the QuantumEnd
284  * flag is set.
285  */
286  if ((CurrentThread->Quantum -= 3) <= 0)
287  {
288  Prcb->QuantumEnd = TRUE;
290  }
291 }
ULONG KiIdealDpcRate
Definition: dpc.c:22
#define TRUE
Definition: types.h:120
ULONG InterruptTime
Definition: ketypes.h:736
KDPC_DATA DpcData[2]
Definition: ketypes.h:676
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1063
UCHAR QuantumEnd
Definition: ketypes.h:696
_Out_ PKIRQL Irql
Definition: csq.h:179
ULONG DpcTime
Definition: ketypes.h:735
ULONG DpcLastCount
Definition: ketypes.h:694
KAPC_STATE ApcState
Definition: ketypes.h:1668
struct _KTHREAD * CurrentThread
Definition: ketypes.h:566
ULONG KernelTime
Definition: ketypes.h:733
ULONG DpcCount
Definition: ketypes.h:748
ULONG KernelTime
Definition: ketypes.h:1877
ULONG CurrentProcess
Definition: shell.c:125
UCHAR DpcRoutineActive
Definition: ketypes.h:688
ULONG UserTime
Definition: ketypes.h:734
ULONG KiMaximumDpcQueueDepth
Definition: dpc.c:19
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
VOID FASTCALL HalRequestSoftwareInterrupt(IN KIRQL Irql)
Definition: pic.c:271
volatile ULONG DpcQueueDepth
Definition: ketypes.h:746
ULONG KiAdjustDpcThreshold
Definition: dpc.c:21
#define InterlockedIncrement
Definition: armddk.h:53
ULONG UserTime
Definition: ketypes.h:1893
ULONG DpcRequestRate
Definition: ketypes.h:684
LONG MaximumDpcQueueDepth
Definition: ketypes.h:683
signed int * PLONG
Definition: retypes.h:5
ULONG AdjustDpcThreshold
Definition: ketypes.h:737

Referenced by KeUpdateSystemTime().

◆ KeUpdateSystemTime()

VOID NTAPI KeUpdateSystemTime ( IN PKTRAP_FRAME  TrapFrame,
IN KIRQL  Irql,
IN ULONG  Increment 
)

Definition at line 304 of file ppc_irq.c.

307 {
308  LONG OldOffset;
311 
312  /* Update interrupt time */
313  Time.LowPart = SharedUserData->InterruptTime.LowPart;
314  Time.HighPart = SharedUserData->InterruptTime.High1Time;
316  SharedUserData->InterruptTime.High2Time = Time.u.HighPart;
317  SharedUserData->InterruptTime.LowPart = Time.u.LowPart;
318  SharedUserData->InterruptTime.High1Time = Time.u.HighPart;
319 
320  /* Increase the tick offset */
323 
324  /* Check if this isn't a tick yet */
325  if (KiTickOffset > 0)
326  {
327  /* Expire timers */
329  }
330  else
331  {
332  /* Setup time structure for system time */
333  Time.LowPart = SharedUserData->SystemTime.LowPart;
334  Time.HighPart = SharedUserData->SystemTime.High1Time;
336  SharedUserData->SystemTime.High2Time = Time.HighPart;
337  SharedUserData->SystemTime.LowPart = Time.LowPart;
338  SharedUserData->SystemTime.High1Time = Time.HighPart;
339 
340  /* Setup time structure for tick time */
343  Time.QuadPart += 1;
347  SharedUserData->TickCount.High2Time = Time.HighPart;
348  SharedUserData->TickCount.LowPart = Time.LowPart;
349  SharedUserData->TickCount.High1Time = Time.HighPart;
350 
351  /* Queue a DPC that will expire timers */
353  }
354 
355  /* Update process and thread times */
356  if (OldOffset <= 0)
357  {
358  /* This was a tick, calculate the next one */
360  KeUpdateRunTime(TrapFrame, Irql);
361  }
362 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
ULONG LowPart
Definition: ketypes.h:910
ULONG OldOffset
Definition: shell.c:90
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:724
ULONG KeMaximumIncrement
Definition: clock.c:20
_Out_ PKIRQL Irql
Definition: csq.h:179
long LONG
Definition: pedump.c:60
LONG High1Time
Definition: ketypes.h:911
struct _LARGE_INTEGER::@2216 u
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define SharedUserData
NTKERNELAPI volatile KSYSTEM_TIME KeTickCount
Definition: clock.c:19
ULONG LowPart
Definition: typedefs.h:105
LONG High2Time
Definition: ketypes.h:912
#define PROFILE_LEVEL
Definition: env_spec_w32.h:698
VOID NTAPI KeUpdateRunTime(IN PKTRAP_FRAME TrapFrame, IN KIRQL Irql)
Definition: ppc_irq.c:194
ULONG KeTimeAdjustment
Definition: time.c:18
KDPC KiExpireTimerDpc
Definition: ppc_irq.c:25
LONG KiTickOffset
Definition: time.c:17
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:42
static PLARGE_INTEGER Time
Definition: time.c:105
LONGLONG QuadPart
Definition: typedefs.h:113

Referenced by KiInterruptDispatch3().

◆ KiInterruptDispatch2()

VOID NTAPI KiInterruptDispatch2 ( ULONG  vector,
KIRQL  old_level 
)

Definition at line 365 of file ppc_irq.c.

373 {
374  PKINTERRUPT isr;
376  KIRQL oldlvl;
377  PISR_TABLE CurrentIsr;
378 
379  DPRINT("I(0x%.08x, 0x%.08x)\n", vector, old_level);
380 
381  /*
382  * Iterate the list until one of the isr tells us its device interrupted
383  */
385 
386  KiAcquireSpinLock(&CurrentIsr->Lock);
387 
388  CurrentIsr->Count++;
389  current = CurrentIsr->ListHead.Flink;
390 
391  while (current != &CurrentIsr->ListHead)
392  {
393  isr = CONTAINING_RECORD(current,KINTERRUPT,InterruptListEntry);
394  oldlvl = KeAcquireInterruptSpinLock(isr);
395  if (isr->ServiceRoutine(isr, isr->ServiceContext))
396  {
397  KeReleaseInterruptSpinLock(isr, oldlvl);
398  break;
399  }
400  KeReleaseInterruptSpinLock(isr, oldlvl);
401  current = current->Flink;
402  }
403  KiReleaseSpinLock(&CurrentIsr->Lock);
404 }
LIST_ENTRY ListHead
Definition: ppc_irq.c:132
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:337
UCHAR KIRQL
Definition: env_spec_w32.h:591
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:35
VOID NTAPI KeReleaseInterruptSpinLock(IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
Definition: spinlock.c:165
ULONG Count
Definition: ppc_irq.c:134
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
KIRQL NTAPI KeAcquireInterruptSpinLock(IN PKINTERRUPT Interrupt)
Definition: spinlock.c:148
PKSERVICE_ROUTINE ServiceRoutine
Definition: ketypes.h:828
KSPIN_LOCK Lock
Definition: ppc_irq.c:133
Definition: typedefs.h:118
VOID FASTCALL KiAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:28
unsigned int ULONG
Definition: retypes.h:1
static ISR_TABLE IsrTable[NR_TRAPS][1]
Definition: ppc_irq.c:141
PVOID ServiceContext
Definition: ketypes.h:833
struct task_struct * current
Definition: linux.c:32

Referenced by KiInterruptDispatch3().

◆ KiInterruptDispatch3()

VOID KiInterruptDispatch3 ( ULONG  vector,
PKIRQ_TRAPFRAME  Trapframe 
)

Definition at line 407 of file ppc_irq.c.

413 {
414  KIRQL old_level;
415  KTRAP_FRAME KernelTrapFrame;
416  PKTHREAD CurrentThread;
417  PKTRAP_FRAME OldTrapFrame=NULL;
418 
419  /*
420  * At this point we have interrupts disabled, nothing has been done to
421  * the PIC.
422  */
423 
424  KeGetCurrentPrcb()->InterruptCount++;
425 
426  /*
427  * Notify the rest of the kernel of the raised irq level. For the
428  * default HAL this will send an EOI to the PIC and alter the IRQL.
429  */
431  vector,
432  &old_level))
433  {
434  return;
435  }
436 
437 
438  /*
439  * Enable interrupts
440  * NOTE: Only higher priority interrupts will get through
441  */
442  _enable();
443 
444 #ifndef CONFIG_SMP
445  if (vector == 0)
446  {
447  KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame);
448  KeUpdateSystemTime(&KernelTrapFrame, old_level, 100000);
449  }
450  else
451 #endif
452  {
453  /*
454  * Actually call the ISR.
455  */
456  KiInterruptDispatch2(vector, old_level);
457  }
458 
459  /*
460  * End the system interrupt.
461  */
462  _disable();
463 
464  if (old_level==PASSIVE_LEVEL)
465  {
467 
468  CurrentThread = KeGetCurrentThread();
469  if (CurrentThread!=NULL && CurrentThread->ApcState.UserApcPending)
470  {
471  if (CurrentThread->TrapFrame == NULL)
472  {
473  OldTrapFrame = CurrentThread->TrapFrame;
474  KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame);
475  CurrentThread->TrapFrame = &KernelTrapFrame;
476  }
477 
478  _enable();
480  _disable();
481 
482  ASSERT(KeGetCurrentThread() == CurrentThread);
483  if (CurrentThread->TrapFrame == &KernelTrapFrame)
484  {
485  KeTrapFrameToIRQTrapFrame(&KernelTrapFrame, Trapframe);
486  CurrentThread->TrapFrame = OldTrapFrame;
487  }
488  }
490  }
491  else
492  {
493  HalEndSystemInterrupt (old_level, 0);
494  }
495 
496 }
VOID NTAPI HalEndSystemInterrupt(IN KIRQL OldIrql, IN PKTRAP_FRAME TrapFrame)
Definition: pic.c:335
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
void __cdecl _enable(void)
Definition: intrin_arm.h:373
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1063
VOID NTAPI KiInterruptDispatch2(ULONG vector, KIRQL old_level)
Definition: ppc_irq.c:365
BOOLEAN NTAPI HalBeginSystemInterrupt(IN KIRQL Irql, IN ULONG Vector, OUT PKIRQL OldIrql)
Definition: pic.c:321
PKTRAP_FRAME TrapFrame
Definition: ketypes.h:1664
UCHAR KIRQL
Definition: env_spec_w32.h:591
KAPC_STATE ApcState
Definition: ketypes.h:1668
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame, IN KIRQL Irql, IN ULONG Increment)
Definition: ppc_irq.c:304
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static VOID KeTrapFrameToIRQTrapFrame(PKTRAP_FRAME TrapFrame, PKIRQ_TRAPFRAME IrqTrapFrame)
Definition: ppc_irq.c:180
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
void __cdecl _disable(void)
Definition: intrin_arm.h:365
#define KeGetCurrentThread
Definition: hal.h:44
VOID NTAPI KiDeliverApc(IN KPROCESSOR_MODE DeliveryMode, IN PKEXCEPTION_FRAME ExceptionFrame, IN PKTRAP_FRAME TrapFrame)
Definition: apc.c:302
#define APC_LEVEL
Definition: env_spec_w32.h:695
static VOID KeIRQTrapFrameToTrapFrame(PKIRQ_TRAPFRAME IrqTrapFrame, PKTRAP_FRAME TrapFrame)
Definition: ppc_irq.c:174

◆ KiSystemService()

VOID NTAPI KiSystemService ( ppc_trap_frame_t trap_frame)

Definition at line 758 of file ppc_irq.c.

759 {
760  int i;
761  PKSYSTEM_ROUTINE SystemRoutine;
762  PSYSCALL_FUN SyscallFunction;
763 
764  switch(trap_frame->gpr[0])
765  {
766  case 0x10000: /* DebugService */
767  for( i = 0; i < trap_frame->gpr[5]; i++ )
768  {
769  PearPCDebug(((PCHAR)trap_frame->gpr[4])[i]);
770  WRITE_PORT_UCHAR((PVOID)0x800003f8, ((PCHAR)trap_frame->gpr[4])[i]);
771  }
772  trap_frame->gpr[3] = KdpServiceDispatcher
773  (trap_frame->gpr[3],
774  (PCHAR)trap_frame->gpr[4],
775  trap_frame->gpr[5],
776  UserMode /*KernelMode*/);
777  break;
778  case 0xf0000: /* Thread startup */
779  /* XXX how to use UserThread (gpr[6]) */
780  SystemRoutine = (PKSYSTEM_ROUTINE)trap_frame->gpr[3];
781  SystemRoutine((PKSTART_ROUTINE)trap_frame->gpr[4],
782  (PVOID)trap_frame->gpr[5]);
783  break;
784 
785  /* Handle a normal system call */
786  default:
787  SyscallFunction =
789  [trap_frame->gpr[0] >> 12].Base)[trap_frame->gpr[0] & 0xfff];
790  trap_frame->gpr[3] = SyscallFunction
791  (trap_frame->gpr[3],
792  trap_frame->gpr[4],
793  trap_frame->gpr[5],
794  trap_frame->gpr[6],
795  trap_frame->gpr[7],
796  trap_frame->gpr[8],
797  trap_frame->gpr[9],
798  trap_frame->gpr[10],
799  trap_frame->gpr[11],
800  trap_frame->gpr[12]);
801  break;
802  }
803 }
signed char * PCHAR
Definition: retypes.h:7
ULONG NTAPI KdpServiceDispatcher(ULONG Service, PVOID Buffer1, ULONG Buffer1Length, KPROCESSOR_MODE PreviousMode)
Definition: kdmain.c:65
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID(NTAPI * PKSYSTEM_ROUTINE)(PKSTART_ROUTINE StartRoutine, PVOID StartContext)
Definition: ketypes.h:625
KSTART_ROUTINE * PKSTART_ROUTINE
Definition: ketypes.h:487
void * PVOID
Definition: retypes.h:9
ULONG(* PSYSCALL_FUN)(ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG)
Definition: ppc_irq.c:754
unsigned long gpr[32]
Definition: mmu.h:113
void PearPCDebug(int ch)
KSERVICE_TABLE_DESCRIPTOR KeServiceDescriptorTable[SSDT_MAX_ENTRIES]
Definition: procobj.c:23
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

◆ PearPCDebug()

void PearPCDebug ( int  ch)

Referenced by KiSystemService().

◆ trap_handler_0()

void trap_handler_0 ( void  )

◆ trap_handler_1()

void trap_handler_1 ( void  )

◆ trap_handler_10()

void trap_handler_10 ( void  )

◆ trap_handler_11()

void trap_handler_11 ( void  )

◆ trap_handler_12()

void trap_handler_12 ( void  )

◆ trap_handler_13()

void trap_handler_13 ( void  )

◆ trap_handler_14()

void trap_handler_14 ( void  )

◆ trap_handler_15()

void trap_handler_15 ( void  )

◆ trap_handler_2()

void trap_handler_2 ( void  )

◆ trap_handler_3()

void trap_handler_3 ( void  )

◆ trap_handler_4()

void trap_handler_4 ( void  )

◆ trap_handler_5()

void trap_handler_5 ( void  )

◆ trap_handler_6()

void trap_handler_6 ( void  )

◆ trap_handler_7()

void trap_handler_7 ( void  )

◆ trap_handler_8()

void trap_handler_8 ( void  )

◆ trap_handler_9()

void trap_handler_9 ( void  )

Variable Documentation

◆ IsrTable

◆ KeMaximumIncrement

ULONG KeMaximumIncrement

Definition at line 20 of file clock.c.

Referenced by KeUpdateSystemTime().

◆ KeMinimumIncrement

ULONG KeMinimumIncrement

Definition at line 21 of file clock.c.

◆ KeTimeAdjustment

ULONG KeTimeAdjustment

Definition at line 18 of file time.c.

Referenced by KeUpdateSystemTime().

◆ KiAdjustDpcThreshold

ULONG KiAdjustDpcThreshold

Definition at line 21 of file dpc.c.

Referenced by KeUpdateRunTime().

◆ KiExpireTimerDpc

KDPC KiExpireTimerDpc

Definition at line 25 of file ppc_irq.c.

Referenced by KeUpdateSystemTime().

◆ KiIdealDpcRate

ULONG KiIdealDpcRate

Definition at line 22 of file dpc.c.

Referenced by KeUpdateRunTime().

◆ KiMaximumDpcQueueDepth

ULONG KiMaximumDpcQueueDepth

Definition at line 19 of file dpc.c.

Referenced by KeUpdateRunTime().

◆ KiMinimumDpcRate

ULONG KiMinimumDpcRate

Definition at line 20 of file dpc.c.

◆ KiTickOffset

LONG KiTickOffset

Definition at line 17 of file time.c.

Referenced by KeUpdateSystemTime().