ChipTune: Fix invalid memory access

This commit is contained in:
vit9696 2020-02-23 19:24:53 +03:00
parent 643c14b219
commit 574dd5aaa9
7 changed files with 23 additions and 22 deletions

View File

@ -41,7 +41,7 @@ UefiMain (
gBS->SetWatchdogTimer (0, 0, 0, NULL);
OcProvideConsoleGop ();
OcProvideConsoleGop (FALSE);
OcSetConsoleResolution (0, 0, 0);

View File

@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Uefi.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcConsoleLib.h>
#include <Library/OcMiscLib.h>
@ -69,7 +69,7 @@ UefiMain (
gBS->SetWatchdogTimer (0, 0, 0, NULL);
OcProvideConsoleGop ();
OcProvideConsoleGop (FALSE);
OcConsoleControlSetMode (EfiConsoleControlScreenText);

View File

@ -475,10 +475,10 @@ typedef enum {
_(BOOLEAN , PointerSupport , , FALSE , ()) \
_(OC_STRING , PointerSupportMode , , OC_STRING_CONSTR ("", _, __) , OC_DESTR (OC_STRING)) \
_(UINT32 , TimerResolution , , 0 , ())
OC_DECLARE (OC_UEFI_INPUT)
OC_DECLARE (OC_UEFI_INPUT)
///
/// Input is a set of options to support advanced output.
/// Output is a set of options to support advanced output.
///
#define OC_UEFI_OUTPUT_FIELDS(_, __) \
_(OC_STRING , ConsoleMode , , OC_STRING_CONSTR ("", _, __), OC_DESTR (OC_STRING)) \
@ -491,7 +491,7 @@ OC_DECLARE (OC_UEFI_INPUT)
_(BOOLEAN , ReconnectOnResChange , , FALSE , ()) \
_(BOOLEAN , SanitiseClearScreen , , FALSE , ()) \
_(BOOLEAN , DirectGopRendering , , FALSE , ())
OC_DECLARE (OC_UEFI_OUTPUT)
OC_DECLARE (OC_UEFI_OUTPUT)
///
/// Prefer own protocol implementation for these protocols.

View File

@ -131,7 +131,7 @@ OcSetConsoleMode (
**/
VOID
OcProvideConsoleGop (
VOID
IN BOOLEAN Route
);
/**

View File

@ -84,4 +84,3 @@ OcHdaCodecGetName (
);
#endif // OC_HDA_DEVICES_LIB_H

View File

@ -78,21 +78,21 @@ typedef enum {
Port surface.
**/
typedef enum {
EfiAudioIoSurfaceExternal = 0,
EfiAudioIoSurfaceInternal,
EfiAudioIoSurfaceOther,
EfiAudioIoSurfaceMaximum
EfiAudioIoSurfaceExternal,
EfiAudioIoSurfaceInternal,
EfiAudioIoSurfaceOther,
EfiAudioIoSurfaceMaximum
} EFI_AUDIO_IO_PROTOCOL_SURFACE;
/**
Size in bits of each sample.
**/
typedef enum {
EfiAudioIoBits8 = BIT0,
EfiAudioIoBits16 = BIT1,
EfiAudioIoBits20 = BIT2,
EfiAudioIoBits24 = BIT3,
EfiAudioIoBits32 = BIT4
EfiAudioIoBits8 = BIT0,
EfiAudioIoBits16 = BIT1,
EfiAudioIoBits20 = BIT2,
EfiAudioIoBits24 = BIT3,
EfiAudioIoBits32 = BIT4
} EFI_AUDIO_IO_PROTOCOL_BITS;
/**

View File

@ -71,7 +71,7 @@ ConsoleHandleProtocol (
VOID
OcProvideConsoleGop (
VOID
IN BOOLEAN Route
)
{
EFI_STATUS Status;
@ -85,10 +85,12 @@ OcProvideConsoleGop (
// Shell may replace gST->ConsoleOutHandle, so we have to ensure
// that HandleProtocol always reports valid chosen GOP.
//
mOriginalHandleProtocol = gBS->HandleProtocol;
gBS->HandleProtocol = ConsoleHandleProtocol;
gBS->Hdr.CRC32 = 0;
gBS->CalculateCrc32 (gBS, gBS->Hdr.HeaderSize, &gBS->Hdr.CRC32);
if (Route) {
mOriginalHandleProtocol = gBS->HandleProtocol;
gBS->HandleProtocol = ConsoleHandleProtocol;
gBS->Hdr.CRC32 = 0;
gBS->CalculateCrc32 (gBS, gBS->Hdr.HeaderSize, &gBS->Hdr.CRC32);
}
OriginalGop = NULL;
Status = gBS->HandleProtocol (