/* ‘P n...=r...’ Writes the new value of n-th register received into the input buffer to the n-th register  */
VOID WriteNthRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
/* ‘P n...=r...’ Writes the new value of n-th register received into the input buffer to the n-th register  */
VOID WriteNthRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
{
  UINTN  RegNumber;
  CHAR8  RegNumBuffer[MAX_REG_NUM_BUF_SIZE];
  CHAR8  *RegNumBufPtr;
  CHAR8  *InBufPtr;
  InBufPtr     = &InBuffer[1];
  RegNumBufPtr = RegNumBuffer;
  while (*InBufPtr != '=') {
    *RegNumBufPtr++ = *InBufPtr++;
  }
  *RegNumBufPtr = '\0';
  RegNumber     = AsciiStrHexToUintn (RegNumBuffer);
  if (RegNumber >= MaxRegisterCount ()) {
    SendError (GDB_EINVALIDREGNUM);
    return;
  }
  InBufPtr++;
  BasicWriteRegister (SystemContext, RegNumber, InBufPtr);
  SendSuccess ();
}