mirror of https://github.com/acidanthera/audk.git
Use RLE (Run Length Encoding) to improve debugging performance.
DEBUG_AGENT_REVISION is DEBUG_AGENT_REVISION_03 to disable this feature and will be changed to DEBUG_AGENT_REVISION_04 when new version of HOST is released. Reduce the stack usage by re-using the same buffer to send/receive packet. Zero out the buffer before fxsave so that the reserved field in the buffer remains 0 for better RLE compression ratio. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16628 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
6a39a6a1a8
commit
d9044ec555
|
@ -2,7 +2,7 @@
|
||||||
Transfer protocol defintions used by debug agent and host. It is only
|
Transfer protocol defintions used by debug agent and host. It is only
|
||||||
intended to be used by Debug related module implementation.
|
intended to be used by Debug related module implementation.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -20,12 +20,15 @@
|
||||||
|
|
||||||
//
|
//
|
||||||
// Current revision of transfer protocol
|
// Current revision of transfer protocol
|
||||||
|
// 0.4: Packet compression and decompression.
|
||||||
//
|
//
|
||||||
#define DEBUG_AGENT_REVISION ((0 << 16) | 03)
|
#define DEBUG_AGENT_REVISION_03 ((0 << 16) | 03)
|
||||||
|
#define DEBUG_AGENT_REVISION_04 ((0 << 16) | 04)
|
||||||
|
#define DEBUG_AGENT_REVISION DEBUG_AGENT_REVISION_03
|
||||||
#define DEBUG_AGENT_CAPABILITIES 0
|
#define DEBUG_AGENT_CAPABILITIES 0
|
||||||
|
|
||||||
//
|
//
|
||||||
// Definitions for attach command
|
// Definitions for the (A)ttach command
|
||||||
//
|
//
|
||||||
#define DEBUG_STARTING_SYMBOL_ATTACH (0xFA)
|
#define DEBUG_STARTING_SYMBOL_ATTACH (0xFA)
|
||||||
|
|
||||||
|
@ -34,10 +37,15 @@
|
||||||
//
|
//
|
||||||
#define DEBUG_STARTING_SYMBOL_NORMAL (0xFE)
|
#define DEBUG_STARTING_SYMBOL_NORMAL (0xFE)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Definition for starting symbol of a (C)ompressed debug packet. Choose a non-ASCII to avoid conflict with other serial output.
|
||||||
|
//
|
||||||
|
#define DEBUG_STARTING_SYMBOL_COMPRESS (0xFC)
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Definition for debug packet header for normal debug packets (not including break/attach command)
|
// Definition for debug packet header for debug packets (not including attach command)
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT8 StartSymbol;
|
UINT8 StartSymbol;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
read/write debug packet to communication with HOST based on transfer
|
read/write debug packet to communication with HOST based on transfer
|
||||||
protocol.
|
protocol.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -956,6 +956,51 @@ SendAckPacket (
|
||||||
UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_LAST_ACK, AckCommand);
|
UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_LAST_ACK, AckCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decompress the Data in place.
|
||||||
|
|
||||||
|
@param[in, out] Data The compressed data buffer.
|
||||||
|
The buffer is assumed large enough to hold the uncompressed data.
|
||||||
|
@param[in] Length The length of the compressed data buffer.
|
||||||
|
|
||||||
|
@return The length of the uncompressed data buffer.
|
||||||
|
**/
|
||||||
|
UINT8
|
||||||
|
DecompressDataInPlace (
|
||||||
|
IN OUT UINT8 *Data,
|
||||||
|
IN UINTN Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Index;
|
||||||
|
UINT16 LastChar;
|
||||||
|
UINTN LastCharCount;
|
||||||
|
UINT8 CurrentChar;
|
||||||
|
|
||||||
|
LastChar = (UINT16) -1;
|
||||||
|
LastCharCount = 0;
|
||||||
|
for (Index = 0; Index < Length; Index++) {
|
||||||
|
CurrentChar = Data[Index];
|
||||||
|
if (LastCharCount == 2) {
|
||||||
|
LastCharCount = 0;
|
||||||
|
CopyMem (&Data[Index + CurrentChar], &Data[Index + 1], Length - Index - 1);
|
||||||
|
SetMem (&Data[Index], CurrentChar, (UINT8) LastChar);
|
||||||
|
LastChar = (UINT16) -1;
|
||||||
|
Index += CurrentChar - 1;
|
||||||
|
Length += CurrentChar - 1;
|
||||||
|
} else {
|
||||||
|
if (LastChar != CurrentChar) {
|
||||||
|
LastCharCount = 0;
|
||||||
|
}
|
||||||
|
LastCharCount++;
|
||||||
|
LastChar = CurrentChar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT (Length <= DEBUG_DATA_MAXIMUM_REAL_DATA);
|
||||||
|
|
||||||
|
return (UINT8) Length;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Receive valid packet from HOST.
|
Receive valid packet from HOST.
|
||||||
|
|
||||||
|
@ -1007,7 +1052,7 @@ ReceivePacket (
|
||||||
return RETURN_TIMEOUT;
|
return RETURN_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DebugHeader->StartSymbol != DEBUG_STARTING_SYMBOL_NORMAL) {
|
if ((DebugHeader->StartSymbol != DEBUG_STARTING_SYMBOL_NORMAL) && (DebugHeader->StartSymbol != DEBUG_STARTING_SYMBOL_COMPRESS)) {
|
||||||
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "Invalid start symbol received [%02x]\n", DebugHeader->StartSymbol);
|
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "Invalid start symbol received [%02x]\n", DebugHeader->StartSymbol);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1017,7 +1062,7 @@ ReceivePacket (
|
||||||
//
|
//
|
||||||
Received = DebugPortReadBuffer (
|
Received = DebugPortReadBuffer (
|
||||||
Handle,
|
Handle,
|
||||||
(UINT8 *)DebugHeader + OFFSET_OF (DEBUG_PACKET_HEADER, Command),
|
(UINT8 *) DebugHeader + OFFSET_OF (DEBUG_PACKET_HEADER, Command),
|
||||||
OFFSET_OF (DEBUG_PACKET_HEADER, Length) + sizeof (DebugHeader->Length) - sizeof (DebugHeader->StartSymbol),
|
OFFSET_OF (DEBUG_PACKET_HEADER, Length) + sizeof (DebugHeader->Length) - sizeof (DebugHeader->StartSymbol),
|
||||||
Timeout
|
Timeout
|
||||||
);
|
);
|
||||||
|
@ -1061,6 +1106,12 @@ ReceivePacket (
|
||||||
|
|
||||||
DebugAgentDataMsgPrint (DEBUG_AGENT_VERBOSE, FALSE, (UINT8 *) DebugHeader, DebugHeader->Length);
|
DebugAgentDataMsgPrint (DEBUG_AGENT_VERBOSE, FALSE, (UINT8 *) DebugHeader, DebugHeader->Length);
|
||||||
|
|
||||||
|
if (DebugHeader->StartSymbol == DEBUG_STARTING_SYMBOL_COMPRESS) {
|
||||||
|
DebugHeader->StartSymbol = DEBUG_STARTING_SYMBOL_NORMAL;
|
||||||
|
DebugHeader->Length = DecompressDataInPlace (
|
||||||
|
(UINT8 *) (DebugHeader + 1), DebugHeader->Length - sizeof (DEBUG_PACKET_HEADER)
|
||||||
|
) + sizeof (DEBUG_PACKET_HEADER);
|
||||||
|
}
|
||||||
return RETURN_SUCCESS;
|
return RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1290,12 +1341,93 @@ CopyMemByWidth (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Compress the data buffer but do not modify the original buffer.
|
||||||
|
|
||||||
|
The compressed data is directly send to the debug channel.
|
||||||
|
Compressing in place doesn't work because the data may become larger
|
||||||
|
during compressing phase. ("3 3 ..." --> "3 3 0 ...")
|
||||||
|
The routine is expected to be called three times:
|
||||||
|
1. Compute the length of the compressed data buffer;
|
||||||
|
2. Compute the CRC of the compressed data buffer;
|
||||||
|
3. Compress the data and send to the debug channel.
|
||||||
|
|
||||||
|
@param[in] Data The data buffer.
|
||||||
|
@param[in] Length The length of the data buffer.
|
||||||
|
@param[out] CompressedLength Return the length of the compressed data buffer.
|
||||||
|
It may be larger than the Length in some cases.
|
||||||
|
@param[out] CompressedCrc Return the CRC of the compressed data buffer.
|
||||||
|
@param[in] Handle The debug channel handle to send the compressed data buffer.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
CompressDataThenSend (
|
||||||
|
IN UINT8 *Data,
|
||||||
|
IN UINT8 Length,
|
||||||
|
OUT UINTN *CompressedLength, OPTIONAL
|
||||||
|
OUT UINT16 *CompressedCrc, OPTIONAL
|
||||||
|
IN DEBUG_PORT_HANDLE Handle OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Index;
|
||||||
|
UINT8 LastChar;
|
||||||
|
UINT8 LastCharCount;
|
||||||
|
UINT8 CurrentChar;
|
||||||
|
UINTN CompressedIndex;
|
||||||
|
|
||||||
|
ASSERT (Length > 0);
|
||||||
|
|
||||||
|
LastChar = Data[0] + 1; // Just ensure it's different from the first byte.
|
||||||
|
LastCharCount = 0;
|
||||||
|
|
||||||
|
for (Index = 0, CompressedIndex = 0; Index <= Length; Index++) {
|
||||||
|
if (Index < Length) {
|
||||||
|
CurrentChar = Data[Index];
|
||||||
|
} else {
|
||||||
|
CurrentChar = (UINT8) LastChar + 1; // just ensure it's different from LastChar
|
||||||
|
}
|
||||||
|
if (LastChar != CurrentChar) {
|
||||||
|
if (LastCharCount == 1) {
|
||||||
|
CompressedIndex++;
|
||||||
|
if (CompressedCrc != NULL) {
|
||||||
|
*CompressedCrc = CalculateCrc16 (&LastChar, 1, *CompressedCrc);
|
||||||
|
}
|
||||||
|
if (Handle != NULL) {
|
||||||
|
DebugPortWriteBuffer (Handle, &LastChar, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (LastCharCount >= 2) {
|
||||||
|
CompressedIndex += 3;
|
||||||
|
LastCharCount -= 2;
|
||||||
|
if (CompressedCrc != NULL) {
|
||||||
|
*CompressedCrc = CalculateCrc16 (&LastChar, 1, *CompressedCrc);
|
||||||
|
*CompressedCrc = CalculateCrc16 (&LastChar, 1, *CompressedCrc);
|
||||||
|
*CompressedCrc = CalculateCrc16 (&LastCharCount, 1, *CompressedCrc);
|
||||||
|
}
|
||||||
|
if (Handle != NULL) {
|
||||||
|
DebugPortWriteBuffer (Handle, &LastChar, 1);
|
||||||
|
DebugPortWriteBuffer (Handle, &LastChar, 1);
|
||||||
|
DebugPortWriteBuffer (Handle, &LastCharCount, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LastCharCount = 0;
|
||||||
|
}
|
||||||
|
LastCharCount++;
|
||||||
|
LastChar = CurrentChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CompressedLength != NULL) {
|
||||||
|
*CompressedLength = CompressedIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read memory with speicifed width and send packet with response data to HOST.
|
Read memory with speicifed width and send packet with response data to HOST.
|
||||||
|
|
||||||
@param[in] Data Pointer to response data buffer.
|
@param[in] Data Pointer to response data buffer.
|
||||||
@param[in] Count The number of data with specified Width.
|
@param[in] Count The number of data with specified Width.
|
||||||
@param[in] Width Data width in byte.
|
@param[in] Width Data width in byte.
|
||||||
|
@param[in] DebugHeader Pointer to a buffer for creating response packet and receiving ACK packet,
|
||||||
|
to minimize the stack usage.
|
||||||
|
|
||||||
@retval RETURN_SUCCESS Response data was sent successfully.
|
@retval RETURN_SUCCESS Response data was sent successfully.
|
||||||
|
|
||||||
|
@ -1304,30 +1436,20 @@ RETURN_STATUS
|
||||||
ReadMemoryAndSendResponsePacket (
|
ReadMemoryAndSendResponsePacket (
|
||||||
IN UINT8 *Data,
|
IN UINT8 *Data,
|
||||||
IN UINT16 Count,
|
IN UINT16 Count,
|
||||||
IN UINT8 Width
|
IN UINT8 Width,
|
||||||
|
IN DEBUG_PACKET_HEADER *DebugHeader
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
RETURN_STATUS Status;
|
RETURN_STATUS Status;
|
||||||
DEBUG_PACKET_HEADER *DebugHeader;
|
|
||||||
BOOLEAN LastPacket;
|
BOOLEAN LastPacket;
|
||||||
DEBUG_PACKET_HEADER *AckDebugHeader;
|
|
||||||
UINT8 DebugPacket[DEBUG_DATA_UPPER_LIMIT + sizeof (UINT64) - 1];
|
|
||||||
UINT8 InputPacketBuffer[DEBUG_DATA_UPPER_LIMIT];
|
|
||||||
DEBUG_PORT_HANDLE Handle;
|
DEBUG_PORT_HANDLE Handle;
|
||||||
UINT8 SequenceNo;
|
UINT8 SequenceNo;
|
||||||
UINTN RemainingDataSize;
|
UINTN RemainingDataSize;
|
||||||
UINTN CurrentDataSize;
|
UINT8 CurrentDataSize;
|
||||||
|
UINTN CompressedDataSize;
|
||||||
|
|
||||||
Handle = GetDebugPortHandle();
|
Handle = GetDebugPortHandle();
|
||||||
|
|
||||||
//
|
|
||||||
// Data is appended end of Debug Packet header, make sure data address
|
|
||||||
// in Debug Packet 8-byte alignment always
|
|
||||||
//
|
|
||||||
DebugHeader = (DEBUG_PACKET_HEADER *) (ALIGN_VALUE ((UINTN)&DebugPacket + sizeof (DEBUG_PACKET_HEADER), sizeof (UINT64))
|
|
||||||
- sizeof (DEBUG_PACKET_HEADER));
|
|
||||||
DebugHeader->StartSymbol = DEBUG_STARTING_SYMBOL_NORMAL;
|
|
||||||
|
|
||||||
RemainingDataSize = Count * Width;
|
RemainingDataSize = Count * Width;
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
SequenceNo = GetMailboxPointer()->HostSequenceNo;
|
SequenceNo = GetMailboxPointer()->HostSequenceNo;
|
||||||
|
@ -1335,7 +1457,7 @@ ReadMemoryAndSendResponsePacket (
|
||||||
//
|
//
|
||||||
// If the remaining data is less one real packet size, this is the last data packet
|
// If the remaining data is less one real packet size, this is the last data packet
|
||||||
//
|
//
|
||||||
CurrentDataSize = RemainingDataSize;
|
CurrentDataSize = (UINT8) RemainingDataSize;
|
||||||
LastPacket = TRUE;
|
LastPacket = TRUE;
|
||||||
DebugHeader->Command = DEBUG_COMMAND_OK;
|
DebugHeader->Command = DEBUG_COMMAND_OK;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1350,10 +1472,60 @@ ReadMemoryAndSendResponsePacket (
|
||||||
//
|
//
|
||||||
// Construct the rest Debug header
|
// Construct the rest Debug header
|
||||||
//
|
//
|
||||||
DebugHeader->Length = (UINT8)(CurrentDataSize + sizeof (DEBUG_PACKET_HEADER));
|
DebugHeader->StartSymbol = DEBUG_STARTING_SYMBOL_NORMAL;
|
||||||
|
DebugHeader->Length = CurrentDataSize + sizeof (DEBUG_PACKET_HEADER);
|
||||||
DebugHeader->SequenceNo = SequenceNo;
|
DebugHeader->SequenceNo = SequenceNo;
|
||||||
DebugHeader->Crc = 0;
|
DebugHeader->Crc = 0;
|
||||||
CopyMemByWidth ((UINT8 *)(DebugHeader + 1), Data, (UINT16) CurrentDataSize / Width, Width);
|
CopyMemByWidth ((UINT8 *) (DebugHeader + 1), Data, CurrentDataSize / Width, Width);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Compression/decompression support was added since revision 0.4.
|
||||||
|
// Revision 0.3 shouldn't compress the packet.
|
||||||
|
//
|
||||||
|
if (DEBUG_AGENT_REVISION >= DEBUG_AGENT_REVISION_04) {
|
||||||
|
//
|
||||||
|
// Get the compressed data size without modifying the packet.
|
||||||
|
//
|
||||||
|
CompressDataThenSend (
|
||||||
|
(UINT8 *) (DebugHeader + 1),
|
||||||
|
CurrentDataSize,
|
||||||
|
&CompressedDataSize,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
CompressedDataSize = CurrentDataSize;
|
||||||
|
}
|
||||||
|
if (CompressedDataSize < CurrentDataSize) {
|
||||||
|
DebugHeader->Length = (UINT8) CompressedDataSize + sizeof (DEBUG_PACKET_HEADER);
|
||||||
|
DebugHeader->StartSymbol = DEBUG_STARTING_SYMBOL_COMPRESS;
|
||||||
|
//
|
||||||
|
// Compute the CRC of the packet head without modifying the packet.
|
||||||
|
//
|
||||||
|
DebugHeader->Crc = CalculateCrc16 ((UINT8 *) DebugHeader, sizeof (DEBUG_PACKET_HEADER), 0);
|
||||||
|
CompressDataThenSend (
|
||||||
|
(UINT8 *) (DebugHeader + 1),
|
||||||
|
CurrentDataSize,
|
||||||
|
NULL,
|
||||||
|
&DebugHeader->Crc,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
//
|
||||||
|
// Send out the packet head.
|
||||||
|
//
|
||||||
|
DebugPortWriteBuffer (Handle, (UINT8 *) DebugHeader, sizeof (DEBUG_PACKET_HEADER));
|
||||||
|
//
|
||||||
|
// Compress and send out the packet data.
|
||||||
|
//
|
||||||
|
CompressDataThenSend (
|
||||||
|
(UINT8 *) (DebugHeader + 1),
|
||||||
|
CurrentDataSize,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
Handle
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Calculate and fill the checksum, DebugHeader->Crc should be 0 before invoking CalculateCrc16 ()
|
// Calculate and fill the checksum, DebugHeader->Crc should be 0 before invoking CalculateCrc16 ()
|
||||||
//
|
//
|
||||||
|
@ -1362,33 +1534,30 @@ ReadMemoryAndSendResponsePacket (
|
||||||
DebugAgentDataMsgPrint (DEBUG_AGENT_VERBOSE, TRUE, (UINT8 *) DebugHeader, DebugHeader->Length);
|
DebugAgentDataMsgPrint (DEBUG_AGENT_VERBOSE, TRUE, (UINT8 *) DebugHeader, DebugHeader->Length);
|
||||||
|
|
||||||
DebugPortWriteBuffer (Handle, (UINT8 *) DebugHeader, DebugHeader->Length);
|
DebugPortWriteBuffer (Handle, (UINT8 *) DebugHeader, DebugHeader->Length);
|
||||||
|
}
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
Status = ReceivePacket (InputPacketBuffer, NULL, NULL, READ_PACKET_TIMEOUT, FALSE);
|
Status = ReceivePacket ((UINT8 *) DebugHeader, NULL, NULL, READ_PACKET_TIMEOUT, FALSE);
|
||||||
if (Status == RETURN_TIMEOUT) {
|
if (Status == RETURN_TIMEOUT) {
|
||||||
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Timeout in SendDataResponsePacket()\n");
|
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Timeout in SendDataResponsePacket()\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
AckDebugHeader = (DEBUG_PACKET_HEADER *) InputPacketBuffer;
|
if ((DebugHeader->Command == DEBUG_COMMAND_OK) && (DebugHeader->SequenceNo == SequenceNo) && LastPacket) {
|
||||||
SequenceNo = AckDebugHeader->SequenceNo;
|
|
||||||
if (AckDebugHeader->Command == DEBUG_COMMAND_OK &&
|
|
||||||
SequenceNo == DebugHeader->SequenceNo &&
|
|
||||||
LastPacket) {
|
|
||||||
//
|
//
|
||||||
// If this is the last packet, return RETURN_SUCCESS.
|
// If this is the last packet, return RETURN_SUCCESS.
|
||||||
//
|
//
|
||||||
return RETURN_SUCCESS;
|
return RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
if ((SequenceNo == (UINT8) (DebugHeader->SequenceNo + 1)) && (AckDebugHeader->Command == DEBUG_COMMAND_CONTINUE)) {
|
if ((DebugHeader->Command == DEBUG_COMMAND_CONTINUE) && (DebugHeader->SequenceNo == (UINT8) (SequenceNo + 1))) {
|
||||||
//
|
//
|
||||||
// Calculate the rest data size
|
// Calculate the rest data size
|
||||||
//
|
//
|
||||||
Data += CurrentDataSize;
|
Data += CurrentDataSize;
|
||||||
RemainingDataSize -= CurrentDataSize;
|
RemainingDataSize -= CurrentDataSize;
|
||||||
UpdateMailboxContent (GetMailboxPointer(), DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX, (UINT8) SequenceNo);
|
UpdateMailboxContent (GetMailboxPointer(), DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX, DebugHeader->SequenceNo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (SequenceNo >= DebugHeader->SequenceNo) {
|
if (DebugHeader->SequenceNo >= SequenceNo) {
|
||||||
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Received one old or new command(SequenceNo is %x, last SequenceNo is %x)\n", SequenceNo, DebugHeader->SequenceNo);
|
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Received one old or new command(SequenceNo is %x, last SequenceNo is %x)\n", SequenceNo, DebugHeader->SequenceNo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1401,6 +1570,8 @@ ReadMemoryAndSendResponsePacket (
|
||||||
|
|
||||||
@param[in] Data Pointer to response data buffer.
|
@param[in] Data Pointer to response data buffer.
|
||||||
@param[in] DataSize Size of response data in byte.
|
@param[in] DataSize Size of response data in byte.
|
||||||
|
@param[in, out] DebugHeader Pointer to a buffer for creating response packet and receiving ACK packet,
|
||||||
|
to minimize the stack usage.
|
||||||
|
|
||||||
@retval RETURN_SUCCESS Response data was sent successfully.
|
@retval RETURN_SUCCESS Response data was sent successfully.
|
||||||
|
|
||||||
|
@ -1408,34 +1579,11 @@ ReadMemoryAndSendResponsePacket (
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
SendDataResponsePacket (
|
SendDataResponsePacket (
|
||||||
IN UINT8 *Data,
|
IN UINT8 *Data,
|
||||||
IN UINT16 DataSize
|
IN UINT16 DataSize,
|
||||||
|
IN OUT DEBUG_PACKET_HEADER *DebugHeader
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return ReadMemoryAndSendResponsePacket (Data, DataSize, 1);
|
return ReadMemoryAndSendResponsePacket (Data, DataSize, 1, DebugHeader);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Send break cause packet to HOST.
|
|
||||||
|
|
||||||
@param[in] Vector Vector value of exception or interrutp.
|
|
||||||
@param[in] CpuContext Pointer to save CPU context.
|
|
||||||
|
|
||||||
@retval RETURN_SUCCESS Response data was sent successfully.
|
|
||||||
@retval RETURN_DEVICE_ERROR Cannot receive DEBUG_COMMAND_OK from HOST.
|
|
||||||
|
|
||||||
**/
|
|
||||||
RETURN_STATUS
|
|
||||||
SendBreakCausePacket (
|
|
||||||
IN UINTN Vector,
|
|
||||||
IN DEBUG_CPU_CONTEXT *CpuContext
|
|
||||||
)
|
|
||||||
{
|
|
||||||
DEBUG_DATA_RESPONSE_BREAK_CAUSE DebugDataBreakCause;
|
|
||||||
|
|
||||||
DebugDataBreakCause.StopAddress = CpuContext->Eip;
|
|
||||||
DebugDataBreakCause.Cause = GetBreakCause (Vector, CpuContext);
|
|
||||||
|
|
||||||
return SendDataResponsePacket ((UINT8 *) &DebugDataBreakCause, (UINT16) sizeof (DEBUG_DATA_RESPONSE_BREAK_CAUSE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1580,6 +1728,7 @@ CommandCommunication (
|
||||||
DEBUG_DATA_READ_MSR *MsrRegisterRead;
|
DEBUG_DATA_READ_MSR *MsrRegisterRead;
|
||||||
DEBUG_DATA_WRITE_MSR *MsrRegisterWrite;
|
DEBUG_DATA_WRITE_MSR *MsrRegisterWrite;
|
||||||
DEBUG_DATA_CPUID *Cpuid;
|
DEBUG_DATA_CPUID *Cpuid;
|
||||||
|
DEBUG_DATA_RESPONSE_BREAK_CAUSE BreakCause;
|
||||||
DEBUG_DATA_RESPONSE_CPUID CpuidResponse;
|
DEBUG_DATA_RESPONSE_CPUID CpuidResponse;
|
||||||
DEBUG_DATA_SEARCH_SIGNATURE *SearchSignature;
|
DEBUG_DATA_SEARCH_SIGNATURE *SearchSignature;
|
||||||
DEBUG_DATA_RESPONSE_GET_EXCEPTION Exception;
|
DEBUG_DATA_RESPONSE_GET_EXCEPTION Exception;
|
||||||
|
@ -1646,7 +1795,7 @@ CommandCommunication (
|
||||||
DebugHeader =(DEBUG_PACKET_HEADER *) InputPacketBuffer;
|
DebugHeader =(DEBUG_PACKET_HEADER *) InputPacketBuffer;
|
||||||
|
|
||||||
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "TARGET: Try to get command from HOST...\n");
|
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "TARGET: Try to get command from HOST...\n");
|
||||||
Status = ReceivePacket ((UINT8 *)DebugHeader, &BreakReceived, NULL, READ_PACKET_TIMEOUT, TRUE);
|
Status = ReceivePacket ((UINT8 *) DebugHeader, &BreakReceived, NULL, READ_PACKET_TIMEOUT, TRUE);
|
||||||
if (Status != RETURN_SUCCESS || !IS_REQUEST (DebugHeader)) {
|
if (Status != RETURN_SUCCESS || !IS_REQUEST (DebugHeader)) {
|
||||||
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Get command[%x] sequenceno[%x] returned status is [%x] \n", DebugHeader->Command, DebugHeader->SequenceNo, Status);
|
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Get command[%x] sequenceno[%x] returned status is [%x] \n", DebugHeader->Command, DebugHeader->SequenceNo, Status);
|
||||||
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Get command failed or it's response packet not expected! \n");
|
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Get command failed or it's response packet not expected! \n");
|
||||||
|
@ -1808,14 +1957,13 @@ CommandCommunication (
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_BREAK_CAUSE:
|
case DEBUG_COMMAND_BREAK_CAUSE:
|
||||||
|
BreakCause.StopAddress = CpuContext->Eip;
|
||||||
if (MultiProcessorDebugSupport() && ProcessorIndex != mDebugMpContext.BreakAtCpuIndex) {
|
if (MultiProcessorDebugSupport() && ProcessorIndex != mDebugMpContext.BreakAtCpuIndex) {
|
||||||
Status = SendBreakCausePacket (DEBUG_TIMER_VECTOR, CpuContext);
|
BreakCause.Cause = GetBreakCause (DEBUG_TIMER_VECTOR, CpuContext);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Status = SendBreakCausePacket (Vector, CpuContext);
|
BreakCause.Cause = GetBreakCause (Vector, CpuContext);
|
||||||
}
|
}
|
||||||
|
SendDataResponsePacket ((UINT8 *) &BreakCause, (UINT16) sizeof (DEBUG_DATA_RESPONSE_BREAK_CAUSE), DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_SET_HW_BREAKPOINT:
|
case DEBUG_COMMAND_SET_HW_BREAKPOINT:
|
||||||
|
@ -1855,12 +2003,12 @@ CommandCommunication (
|
||||||
Data64 = (UINTN) (((DEBUG_DATA_SET_SW_BREAKPOINT *) (DebugHeader + 1))->Address);
|
Data64 = (UINTN) (((DEBUG_DATA_SET_SW_BREAKPOINT *) (DebugHeader + 1))->Address);
|
||||||
Data8 = *(UINT8 *) (UINTN) Data64;
|
Data8 = *(UINT8 *) (UINTN) Data64;
|
||||||
*(UINT8 *) (UINTN) Data64 = DEBUG_SW_BREAKPOINT_SYMBOL;
|
*(UINT8 *) (UINTN) Data64 = DEBUG_SW_BREAKPOINT_SYMBOL;
|
||||||
Status = SendDataResponsePacket ((UINT8 *) &Data8, (UINT16) sizeof (UINT8));
|
Status = SendDataResponsePacket ((UINT8 *) &Data8, (UINT16) sizeof (UINT8), DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_READ_MEMORY:
|
case DEBUG_COMMAND_READ_MEMORY:
|
||||||
MemoryRead = (DEBUG_DATA_READ_MEMORY *) (DebugHeader + 1);
|
MemoryRead = (DEBUG_DATA_READ_MEMORY *) (DebugHeader + 1);
|
||||||
Status = ReadMemoryAndSendResponsePacket ((UINT8 *) (UINTN) MemoryRead->Address, MemoryRead->Count, MemoryRead->Width);
|
Status = ReadMemoryAndSendResponsePacket ((UINT8 *) (UINTN) MemoryRead->Address, MemoryRead->Count, MemoryRead->Width, DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_WRITE_MEMORY:
|
case DEBUG_COMMAND_WRITE_MEMORY:
|
||||||
|
@ -1894,7 +2042,7 @@ CommandCommunication (
|
||||||
default:
|
default:
|
||||||
Data64 = (UINT64) -1;
|
Data64 = (UINT64) -1;
|
||||||
}
|
}
|
||||||
Status = SendDataResponsePacket ((UINT8 *) &Data64, IoRead->Width);
|
Status = SendDataResponsePacket ((UINT8 *) &Data64, IoRead->Width, DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_WRITE_IO:
|
case DEBUG_COMMAND_WRITE_IO:
|
||||||
|
@ -1919,7 +2067,7 @@ CommandCommunication (
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_READ_ALL_REGISTERS:
|
case DEBUG_COMMAND_READ_ALL_REGISTERS:
|
||||||
Status = SendDataResponsePacket ((UINT8 *) CpuContext, sizeof (*CpuContext));
|
Status = SendDataResponsePacket ((UINT8 *) CpuContext, sizeof (*CpuContext), DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_READ_REGISTER:
|
case DEBUG_COMMAND_READ_REGISTER:
|
||||||
|
@ -1927,7 +2075,7 @@ CommandCommunication (
|
||||||
|
|
||||||
if (RegisterRead->Index <= SOFT_DEBUGGER_REGISTER_MAX) {
|
if (RegisterRead->Index <= SOFT_DEBUGGER_REGISTER_MAX) {
|
||||||
RegisterBuffer = ArchReadRegisterBuffer (CpuContext, RegisterRead->Index, &Width);
|
RegisterBuffer = ArchReadRegisterBuffer (CpuContext, RegisterRead->Index, &Width);
|
||||||
Status = SendDataResponsePacket (RegisterBuffer, Width);
|
Status = SendDataResponsePacket (RegisterBuffer, Width, DebugHeader);
|
||||||
} else {
|
} else {
|
||||||
Status = RETURN_UNSUPPORTED;
|
Status = RETURN_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
@ -1947,13 +2095,13 @@ CommandCommunication (
|
||||||
|
|
||||||
case DEBUG_COMMAND_ARCH_MODE:
|
case DEBUG_COMMAND_ARCH_MODE:
|
||||||
Data8 = DEBUG_ARCH_SYMBOL;
|
Data8 = DEBUG_ARCH_SYMBOL;
|
||||||
Status = SendDataResponsePacket ((UINT8 *) &Data8, (UINT16) sizeof (UINT8));
|
Status = SendDataResponsePacket ((UINT8 *) &Data8, (UINT16) sizeof (UINT8), DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_READ_MSR:
|
case DEBUG_COMMAND_READ_MSR:
|
||||||
MsrRegisterRead = (DEBUG_DATA_READ_MSR *) (DebugHeader + 1);
|
MsrRegisterRead = (DEBUG_DATA_READ_MSR *) (DebugHeader + 1);
|
||||||
Data64 = AsmReadMsr64 (MsrRegisterRead->Index);
|
Data64 = AsmReadMsr64 (MsrRegisterRead->Index);
|
||||||
Status = SendDataResponsePacket ((UINT8 *) &Data64, (UINT16) sizeof (UINT64));
|
Status = SendDataResponsePacket ((UINT8 *) &Data64, (UINT16) sizeof (UINT64), DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_WRITE_MSR:
|
case DEBUG_COMMAND_WRITE_MSR:
|
||||||
|
@ -1972,13 +2120,13 @@ CommandCommunication (
|
||||||
case DEBUG_COMMAND_GET_REVISION:
|
case DEBUG_COMMAND_GET_REVISION:
|
||||||
DebugAgentRevision.Revision = DEBUG_AGENT_REVISION;
|
DebugAgentRevision.Revision = DEBUG_AGENT_REVISION;
|
||||||
DebugAgentRevision.Capabilities = DEBUG_AGENT_CAPABILITIES;
|
DebugAgentRevision.Capabilities = DEBUG_AGENT_CAPABILITIES;
|
||||||
Status = SendDataResponsePacket ((UINT8 *) &DebugAgentRevision, (UINT16) sizeof (DEBUG_DATA_RESPONSE_GET_REVISION));
|
Status = SendDataResponsePacket ((UINT8 *) &DebugAgentRevision, (UINT16) sizeof (DEBUG_DATA_RESPONSE_GET_REVISION), DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_GET_EXCEPTION:
|
case DEBUG_COMMAND_GET_EXCEPTION:
|
||||||
Exception.ExceptionNum = (UINT8) Vector;
|
Exception.ExceptionNum = (UINT8) Vector;
|
||||||
Exception.ExceptionData = (UINT32) CpuContext->ExceptionData;
|
Exception.ExceptionData = (UINT32) CpuContext->ExceptionData;
|
||||||
Status = SendDataResponsePacket ((UINT8 *) &Exception, (UINT16) sizeof (DEBUG_DATA_RESPONSE_GET_EXCEPTION));
|
Status = SendDataResponsePacket ((UINT8 *) &Exception, (UINT16) sizeof (DEBUG_DATA_RESPONSE_GET_EXCEPTION), DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_SET_VIEWPOINT:
|
case DEBUG_COMMAND_SET_VIEWPOINT:
|
||||||
|
@ -2004,12 +2152,12 @@ CommandCommunication (
|
||||||
|
|
||||||
case DEBUG_COMMAND_GET_VIEWPOINT:
|
case DEBUG_COMMAND_GET_VIEWPOINT:
|
||||||
Data32 = mDebugMpContext.ViewPointIndex;
|
Data32 = mDebugMpContext.ViewPointIndex;
|
||||||
SendDataResponsePacket((UINT8 *) &Data32, (UINT16) sizeof (UINT32));
|
SendDataResponsePacket((UINT8 *) &Data32, (UINT16) sizeof (UINT32), DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_MEMORY_READY:
|
case DEBUG_COMMAND_MEMORY_READY:
|
||||||
Data8 = (UINT8) GetDebugFlag (DEBUG_AGENT_FLAG_MEMORY_READY);
|
Data8 = (UINT8) GetDebugFlag (DEBUG_AGENT_FLAG_MEMORY_READY);
|
||||||
SendDataResponsePacket (&Data8, (UINT16) sizeof (UINT8));
|
SendDataResponsePacket (&Data8, (UINT16) sizeof (UINT8), DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_DETACH:
|
case DEBUG_COMMAND_DETACH:
|
||||||
|
@ -2024,7 +2172,7 @@ CommandCommunication (
|
||||||
&CpuidResponse.Eax, &CpuidResponse.Ebx,
|
&CpuidResponse.Eax, &CpuidResponse.Ebx,
|
||||||
&CpuidResponse.Ecx, &CpuidResponse.Edx
|
&CpuidResponse.Ecx, &CpuidResponse.Edx
|
||||||
);
|
);
|
||||||
SendDataResponsePacket ((UINT8 *) &CpuidResponse, (UINT16) sizeof (CpuidResponse));
|
SendDataResponsePacket ((UINT8 *) &CpuidResponse, (UINT16) sizeof (CpuidResponse), DebugHeader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_COMMAND_SEARCH_SIGNATURE:
|
case DEBUG_COMMAND_SEARCH_SIGNATURE:
|
||||||
|
@ -2059,7 +2207,7 @@ CommandCommunication (
|
||||||
Data64 = (UINT64) -1;
|
Data64 = (UINT64) -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SendDataResponsePacket ((UINT8 *) &Data64, (UINT16) sizeof (Data64));
|
SendDataResponsePacket ((UINT8 *) &Data64, (UINT16) sizeof (Data64), DebugHeader);
|
||||||
} else {
|
} else {
|
||||||
Status = RETURN_UNSUPPORTED;
|
Status = RETURN_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Command header of for Debug Agent library instance.
|
Command header of for Debug Agent library instance.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -207,6 +207,8 @@ ArchReadRegisterBuffer (
|
||||||
|
|
||||||
@param[in] Data Pointer to response data buffer.
|
@param[in] Data Pointer to response data buffer.
|
||||||
@param[in] DataSize Size of response data in byte.
|
@param[in] DataSize Size of response data in byte.
|
||||||
|
@param[in, out] DebugHeader Pointer to a buffer for creating response packet and receiving ACK packet,
|
||||||
|
to minimize the stack usage.
|
||||||
|
|
||||||
@retval RETURN_SUCCESS Response data was sent successfully.
|
@retval RETURN_SUCCESS Response data was sent successfully.
|
||||||
@retval RETURN_DEVICE_ERROR Cannot receive DEBUG_COMMAND_OK from HOST.
|
@retval RETURN_DEVICE_ERROR Cannot receive DEBUG_COMMAND_OK from HOST.
|
||||||
|
@ -215,7 +217,8 @@ ArchReadRegisterBuffer (
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
SendDataResponsePacket (
|
SendDataResponsePacket (
|
||||||
IN UINT8 *Data,
|
IN UINT8 *Data,
|
||||||
IN UINT16 DataSize
|
IN UINT16 DataSize,
|
||||||
|
IN OUT DEBUG_PACKET_HEADER *DebugHeader
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
|
; Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
; This program and the accompanying materials
|
; This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
; which accompanies this distribution. The full text of the license may be found at
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -302,17 +302,22 @@ NoExtrPush:
|
||||||
mov eax, dr0
|
mov eax, dr0
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
|
;; Clear Direction Flag
|
||||||
|
cld
|
||||||
|
|
||||||
;; FX_SAVE_STATE_IA32 FxSaveState;
|
;; FX_SAVE_STATE_IA32 FxSaveState;
|
||||||
sub esp, 512
|
sub esp, 512
|
||||||
mov edi, esp
|
mov edi, esp
|
||||||
|
;; Clear the buffer
|
||||||
|
xor eax, eax
|
||||||
|
mov ecx, 128 ;= 512 / 4
|
||||||
|
rep stosd
|
||||||
|
mov edi, esp
|
||||||
db 0fh, 0aeh, 00000111y ;fxsave [edi]
|
db 0fh, 0aeh, 00000111y ;fxsave [edi]
|
||||||
|
|
||||||
;; save the exception data
|
;; save the exception data
|
||||||
push dword ptr [ebp + 8]
|
push dword ptr [ebp + 8]
|
||||||
|
|
||||||
;; Clear Direction Flag
|
|
||||||
cld
|
|
||||||
|
|
||||||
; call the C interrupt process function
|
; call the C interrupt process function
|
||||||
push esp ; Structure
|
push esp ; Structure
|
||||||
push ebx ; vector
|
push ebx ; vector
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
|
; Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
; This program and the accompanying materials
|
; This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
; which accompanies this distribution. The full text of the license may be found at
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -286,16 +286,23 @@ NoExtrPush:
|
||||||
mov rax, dr0
|
mov rax, dr0
|
||||||
push rax
|
push rax
|
||||||
|
|
||||||
|
;; Clear Direction Flag
|
||||||
|
cld
|
||||||
|
|
||||||
sub rsp, 512
|
sub rsp, 512
|
||||||
mov rdi, rsp
|
mov rdi, rsp
|
||||||
|
;; Clear the buffer
|
||||||
|
xor rax, rax
|
||||||
|
push rcx
|
||||||
|
mov rcx, 64 ;= 512 / 8
|
||||||
|
rep stosq
|
||||||
|
pop rcx
|
||||||
|
mov rdi, rsp
|
||||||
db 0fh, 0aeh, 00000111y ;fxsave [rdi]
|
db 0fh, 0aeh, 00000111y ;fxsave [rdi]
|
||||||
|
|
||||||
;; save the exception data
|
;; save the exception data
|
||||||
push qword ptr [rbp + 16]
|
push qword ptr [rbp + 16]
|
||||||
|
|
||||||
;; Clear Direction Flag
|
|
||||||
cld
|
|
||||||
|
|
||||||
; call the C interrupt process function
|
; call the C interrupt process function
|
||||||
mov rdx, rsp ; Structure
|
mov rdx, rsp ; Structure
|
||||||
mov r15, rcx ; save vector in r15
|
mov r15, rcx ; save vector in r15
|
||||||
|
|
Loading…
Reference in New Issue