test: 4/alpha/kdpcpu.h File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# kdpcpu.h File Reference

`#include "alphaops.h"`

Go to the source code of this file.

## Defines

#define | KiPcr KdpGetPcr()
#define | KeGetPcr() KdpGetPcr()
#define | KeGetCurrentPrcb() KdpGetCurrentPrcb()
#define | KeGetCurrentThread() KdpGetCurrentThread()
#define | KDP_BREAKPOINT_TYPE ULONG
#define | KDP_BREAKPOINT_ALIGN 3
#define | KDP_BREAKPOINT_VALUE KBPT_FUNC

## Functions

PKPCR | KdpGetPcr ()
ULONG | KdpReadInternalProcessorState (PVOID, ULONG)
ULONG | KdpReadInternalProcessorCounters (PVOID, ULONG)
VOID | KdpReadIoSpaceExtended (IN PDBGKD_MANIPULATE_STATE m, IN PSTRING AdditionalData, IN PCONTEXT Context)
VOID | KdpWriteIoSpaceExtended (IN PDBGKD_MANIPULATE_STATE m, IN PSTRING AdditionalData, IN PCONTEXT Context)
_KPRCB * | KdpGetCurrentPrcb ()
_KTHREAD * | KdpGetCurrentThread ()

## Define Documentation

#define KDP_BREAKPOINT_ALIGN 3

| Definition at line 79 of file 4/alpha/kdpcpu.h.

#define KDP_BREAKPOINT_TYPE ULONG

| Definition at line 76 of file 4/alpha/kdpcpu.h.

#define KDP_BREAKPOINT_VALUE KBPT_FUNC

| Definition at line 82 of file 4/alpha/kdpcpu.h.

#define KeGetCurrentPrcb | (

)

KdpGetCurrentPrcb()

| Definition at line 69 of file 4/alpha/kdpcpu.h.

#define KeGetCurrentThread | (

)

KdpGetCurrentThread()

| Definition at line 70 of file 4/alpha/kdpcpu.h.

#define KeGetPcr | (

)

KdpGetPcr()

| Definition at line 68 of file 4/alpha/kdpcpu.h.

#define KiPcr KdpGetPcr()

| Definition at line 62 of file 4/alpha/kdpcpu.h.

## Function Documentation

struct _KPRCB* KdpGetCurrentPrcb | ( |  | ) |

struct _KTHREAD* KdpGetCurrentThread | ( |  | ) |

PKPCR KdpGetPcr | ( |  | ) |

ULONG KdpReadInternalProcessorCounters | ( | PVOID | ,
|  | ULONG |
| ) |

ULONG KdpReadInternalProcessorState | ( | PVOID | ,
|  | ULONG |
| ) |

VOID KdpReadIoSpaceExtended | ( | IN PDBGKD_MANIPULATE_STATE | m,
|  | IN PSTRING | AdditionalData,
|  | IN PCONTEXT | Context
| ) |

Definition at line 623 of file alpha/kdcpuapi.c.

    00631                    :
    00632
    00633     This function is called in response of a read io space extended state
    00634     manipulation message.  Its function is to read system io
    00635     locations.
    00636
    00637 Arguments:
    00638
    00639     m - Supplies the state manipulation message.
    00640
    00641     AdditionalData - Supplies any additional data for the message.
    00642
    00643     Context - Supplies the current context.
    00644
    00645 Return Value:
    00646
    00647     None.
    00648
    00649 --*/
    00650
    00651 {
    00652     PDBGKD_READ_WRITE_IO_EXTENDED a = &m->u.ReadWriteIoExtended;
    00653     ULONG Length;
    00654     STRING MessageHeader;
    00655     PUCHAR b;
    00656     PUSHORT s;
    00657     PULONG l;
    00658     ULONG BusNumber;
    00659     ULONG AddressSpace;
    00660     ULONG SavedAddressSpace;
    00661     PHYSICAL_ADDRESS IoAddress;
    00662     ULONG DataSize;
    00663     PHYSICAL_ADDRESS TranslatedAddress;
    00664     INTERFACE_TYPE InterfaceType;
    00665
    00666     MessageHeader.Length = sizeof(*m);
    00667     MessageHeader.Buffer = (PCHAR)m;
    00668
    00669     ASSERT(AdditionalData->Length == 0);
    00670
    00671     m->ReturnStatus = STATUS_SUCCESS;
    00672
    00673     InterfaceType = a->InterfaceType;
    00674     BusNumber = a->BusNumber;
    00675     AddressSpace = SavedAddressSpace = a->AddressSpace;
    00676     IoAddress.QuadPart = (ULONG_PTR)a->IoAddress;
    00677     DataSize = a->DataSize;
    00678
    00679     //
    00680     // Zero the return data value.
    00681     //
    00682
    00683     a->DataValue = 0;
    00684
    00685     //
    00686     // Translate the bus address to the physical system address
    00687     // or QVA.
    00688     //
    00689
    00690     if( !HalTranslateBusAddress( InterfaceType,
    00691                                  BusNumber,
    00692                                  IoAddress,
    00693                                  &AddressSpace,
    00694                                  &TranslatedAddress ) ){
    00695         m->ReturnStatus = STATUS_INVALID_PARAMETER;
    00696         goto SendReadIoSpaceExtendedResponse;
    00697     }
    00698
    00699     //
    00700     // N.B. - for the moment we will only support QVAs ie. when AddressSpace
    00701     //        is one.  It may be in later systems that we will have to
    00702     //        check the address space, map it, perform the virtual read
    00703     //        unmap, and then return the data - only we will have to be
    00704     //        careful about what Irql we are to make sure the memory mgmt
    00705     //        stuff will all work
    00706     //
    00707
    00708     if( !AddressSpace ){
    00709         m->ReturnStatus = STATUS_INVALID_PARAMETER;
    00710         goto SendReadIoSpaceExtendedResponse;
    00711     }
    00712
    00713     //
    00714     // Do the IO space read using the appropriate HAL routines based upon
    00715     // the original address space and the data size requested.
    00716     //
    00717
    00718     if( !SavedAddressSpace ){
    00719
    00720         //
    00721         // Memory (buffer) space on the bus
    00722         //
    00723
    00724         switch( DataSize ){
    00725
    00726         case 1:
    00727             a->DataValue = READ_REGISTER_UCHAR( (PUCHAR)TranslatedAddress.LowPart );
    00728             break;
    00729
    00730         case 2:
    00731             a->DataValue = READ_REGISTER_USHORT((PUSHORT)TranslatedAddress.LowPart );
    00732             break;
    00733
    00734         case 4:
    00735             a->DataValue = READ_REGISTER_ULONG((PULONG)TranslatedAddress.LowPart );
    00736             break;
    00737
    00738         default:
    00739             m->ReturnStatus = STATUS_INVALID_PARAMETER;
    00740         }
    00741
    00742     } else {
    00743
    00744         //
    00745         // I/O space on the bus
    00746         //
    00747
    00748         switch( DataSize ){
    00749
    00750         case 1:
    00751             a->DataValue = READ_PORT_UCHAR( (PUCHAR)TranslatedAddress.LowPart );
    00752             break;
    00753
    00754         case 2:
    00755             a->DataValue = READ_PORT_USHORT( (PUSHORT)TranslatedAddress.LowPart );
    00756             break;
    00757
    00758         case 4:
    00759             a->DataValue = READ_PORT_ULONG( (PULONG)TranslatedAddress.LowPart );
    00760             break;
    00761
    00762         default:
    00763             m->ReturnStatus = STATUS_INVALID_PARAMETER;
    00764         }
    00765     }
    00766
    00767
    00768
    00769 SendReadIoSpaceExtendedResponse:
    00770
    00771     KdpSendPacket(
    00772         PACKET_TYPE_KD_STATE_MANIPULATE,
    00773         &MessageHeader,
    00774         NULL
    00775         );
    00776 }

VOID KdpWriteIoSpaceExtended | ( | IN PDBGKD_MANIPULATE_STATE | m,
|  | IN PSTRING | AdditionalData,
|  | IN PCONTEXT | Context
| ) |

Definition at line 899 of file alpha/kdcpuapi.c.

    00907                    :
    00908
    00909     This function is called in response of a read io space extended state
    00910     manipulation message.  Its function is to read system io
    00911     locations.
    00912
    00913 Arguments:
    00914
    00915     m - Supplies the state manipulation message.
    00916
    00917     AdditionalData - Supplies any additional data for the message.
    00918
    00919     Context - Supplies the current context.
    00920
    00921 Return Value:
    00922
    00923     None.
    00924
    00925 --*/
    00926
    00927 {
    00928     PDBGKD_READ_WRITE_IO_EXTENDED a = &m->u.ReadWriteIoExtended;
    00929     ULONG Length;
    00930     STRING MessageHeader;
    00931     PUCHAR b;
    00932     PUSHORT s;
    00933     PULONG l;
    00934     ULONG BusNumber;
    00935     ULONG AddressSpace;
    00936     ULONG SavedAddressSpace;
    00937     PHYSICAL_ADDRESS IoAddress;
    00938     ULONG DataSize;
    00939     PHYSICAL_ADDRESS TranslatedAddress;
    00940     INTERFACE_TYPE InterfaceType;
    00941     ULONG Value;
    00942
    00943     MessageHeader.Length = sizeof(*m);
    00944     MessageHeader.Buffer = (PCHAR)m;
    00945
    00946     ASSERT(AdditionalData->Length == 0);
    00947
    00948     m->ReturnStatus = STATUS_SUCCESS;
    00949
    00950     InterfaceType = a->InterfaceType;
    00951     BusNumber = a->BusNumber;
    00952     AddressSpace = SavedAddressSpace = a->AddressSpace;
    00953     IoAddress.QuadPart = (ULONG_PTR)a->IoAddress;
    00954     DataSize = a->DataSize;
    00955     Value = a->DataValue;
    00956
    00957     //
    00958     // Translate the bus address to the physical system address
    00959     // or QVA.
    00960     //
    00961
    00962     if( !HalTranslateBusAddress( InterfaceType,
    00963                                  BusNumber,
    00964                                  IoAddress,
    00965                                  &AddressSpace,
    00966                                  &TranslatedAddress ) ){
    00967         m->ReturnStatus = STATUS_INVALID_PARAMETER;
    00968         goto SendWriteIoSpaceExtendedResponse;
    00969     }
    00970
    00971     //
    00972     // N.B. - for the moment we will only support QVAs ie. when AddressSpace
    00973     //        is one.  It may be in later systems that we will have to
    00974     //        check the address space, map it, perform the virtual read
    00975     //        unmap, and then return the data - only we will have to be
    00976     //        careful about what Irql we are to make sure the memory mgmt
    00977     //        stuff will all work
    00978     //
    00979
    00980     if( !AddressSpace ){
    00981         m->ReturnStatus = STATUS_INVALID_PARAMETER;
    00982         goto SendWriteIoSpaceExtendedResponse;
    00983     }
    00984
    00985     //
    00986     // Do the IO space read using the appropriate HAL routines based upon
    00987     // the original address space and the data size requested.
    00988     //
    00989
    00990     if( !SavedAddressSpace ){
    00991
    00992         //
    00993         // Memory (buffer) space on the bus
    00994         //
    00995
    00996         switch( DataSize ){
    00997
    00998         case 1:
    00999             WRITE_REGISTER_UCHAR( (PUCHAR)TranslatedAddress.QuadPart, (UCHAR)Value );
    01000             break;
    01001
    01002         case 2:
    01003             WRITE_REGISTER_USHORT( (PUSHORT)TranslatedAddress.QuadPart, (USHORT)Value );
    01004             break;
    01005
    01006         case 4:
    01007             WRITE_REGISTER_ULONG( (PULONG)TranslatedAddress.QuadPart, Value );
    01008             break;
    01009
    01010         default:
    01011             m->ReturnStatus = STATUS_INVALID_PARAMETER;
    01012         }
    01013
    01014     } else {
    01015
    01016         //
    01017         // I/O space on the bus
    01018         //
    01019
    01020         switch( DataSize ){
    01021
    01022         case 1:
    01023             WRITE_PORT_UCHAR( (PUCHAR)TranslatedAddress.QuadPart, (UCHAR)Value );
    01024             break;
    01025
    01026         case 2:
    01027             WRITE_PORT_USHORT( (PUSHORT)TranslatedAddress.QuadPart, (USHORT)Value);
    01028             break;
    01029
    01030         case 4:
    01031             WRITE_PORT_ULONG( (PULONG)TranslatedAddress.QuadPart, Value );
    01032             break;
    01033
    01034         default:
    01035             m->ReturnStatus = STATUS_INVALID_PARAMETER;
    01036         }
    01037     }
    01038
    01039
    01040
    01041 SendWriteIoSpaceExtendedResponse:
    01042
    01043     KdpSendPacket(
    01044         PACKET_TYPE_KD_STATE_MANIPULATE,
    01045         &MessageHeader,
    01046         NULL
    01047         );
    01048 }
    }