summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellDebug1CommandsLib
diff options
context:
space:
mode:
authorJaben Carsey <Jaben.carsey@intel.com>2014-07-25 18:46:23 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2014-07-25 18:46:23 +0000
commit17e59b3346b7486fabbc57a13ef5b8c98d25a5a5 (patch)
treeaa137730c2bf3847cc344db7240a231b6df6cd63 /ShellPkg/Library/UefiShellDebug1CommandsLib
parent6cb9566f264e2fa2dcde695317945114e1b011c7 (diff)
ShellPkg: Fix calls to SimpleTextOut->SetAttribute to not use reserved bits
As the shell inverts foreground and background it needs to be sure that it properly masks off the reserved bits and this is important since the foreground and background are not the same numbers of bits. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com> Reviewed-by: Tapan Shah <tapandshah@hp.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15681 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c6
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c10
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c10
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c8
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c24
5 files changed, 29 insertions, 29 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
index 897700bd34..ed23365363 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
@@ -301,8 +301,8 @@ FileBufferRestoreMousePosition (
//
Orig = MainEditor.ColorAttributes;
New.Data = 0;
- New.Colors.Foreground = Orig.Colors.Background;
- New.Colors.Background = Orig.Colors.Foreground;
+ New.Colors.Foreground = Orig.Colors.Background & 0xF;
+ New.Colors.Background = Orig.Colors.Foreground & 0x7;
//
// clear the old mouse position
@@ -343,7 +343,7 @@ FileBufferRestoreMousePosition (
//
// set the new mouse position
//
- gST->ConOut->SetAttribute (gST->ConOut, New.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
//
// clear the old mouse position
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c
index 58d3477f5f..5c43ffcd9d 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c
@@ -1,7 +1,7 @@
/** @file
Implements inputbar interface functions.
- Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
+ Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR>
This program and the accompanying materials
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
@@ -103,7 +103,7 @@ InputBarPrintInput (
typedef struct {
UINT32 Foreground : 4;
- UINT32 Background : 4;
+ UINT32 Background : 3;
} INPUT_BAR_COLOR_ATTRIBUTES;
typedef union {
@@ -150,10 +150,10 @@ InputBarRefresh (
CursorRow = gST->ConOut->Mode->CursorRow;
Orig.Data = gST->ConOut->Mode->Attribute;
New.Data = 0;
- New.Colors.Foreground = Orig.Colors.Background;
- New.Colors.Background = Orig.Colors.Foreground;
+ New.Colors.Foreground = Orig.Colors.Background & 0xF;
+ New.Colors.Background = Orig.Colors.Foreground & 0x7;
- gST->ConOut->SetAttribute (gST->ConOut, New.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
//
// clear input bar
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c
index cf885c2549..fbf48b7e2b 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c
@@ -1,7 +1,7 @@
/** @file
Implements statusbar interface functions.
- Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
+ Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR>
This program and the accompanying materials
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
@@ -62,7 +62,7 @@ StatusBarCleanup (
typedef struct {
UINT32 Foreground : 4;
- UINT32 Background : 4;
+ UINT32 Background : 3;
} STATUS_BAR_COLOR_ATTRIBUTES;
typedef union {
@@ -112,11 +112,11 @@ StatusBarRefresh (
//
Orig.Data = gST->ConOut->Mode->Attribute;
New.Data = 0;
- New.Colors.Foreground = Orig.Colors.Background;
- New.Colors.Background = Orig.Colors.Foreground;
+ New.Colors.Foreground = Orig.Colors.Background & 0xF;
+ New.Colors.Background = Orig.Colors.Foreground & 0x7;
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
- gST->ConOut->SetAttribute (gST->ConOut, New.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
//
// clear status bar
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c
index 23d26105c2..ce7a2520ce 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c
@@ -2,7 +2,7 @@
Implements titlebar interface functions.
Copyright (c) 2013, Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
+ Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR>
This program and the accompanying materials
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
@@ -109,10 +109,10 @@ MainTitleBarRefresh (
//
Orig.Data = gST->ConOut->Mode->Attribute;
New.Data = 0;
- New.Colors.Foreground = Orig.Colors.Background;
- New.Colors.Background = Orig.Colors.Foreground;
+ New.Colors.Foreground = Orig.Colors.Background & 0xF;
+ New.Colors.Background = Orig.Colors.Foreground & 0x7;
- gST->ConOut->SetAttribute (gST->ConOut, New.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
//
// clear the title line
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c
index 1d770ea0c1..777c2e0199 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c
@@ -2,7 +2,7 @@
Defines HBufferImage - the view of the file that is visible at any point,
as well as the event handlers for editing the file
- Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
+ Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR>
This program and the accompanying materials
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
@@ -318,9 +318,9 @@ HBufferImagePrintLine (
}
if (BeNewColor) {
- gST->ConOut->SetAttribute (gST->ConOut, New.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
} else {
- gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);
}
Pos = 10 + (Index * 3);
@@ -337,7 +337,7 @@ HBufferImagePrintLine (
}
- gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);
while (Index < 0x08) {
Pos = 10 + (Index * 3);
ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" ");
@@ -355,9 +355,9 @@ HBufferImagePrintLine (
}
if (BeNewColor) {
- gST->ConOut->SetAttribute (gST->ConOut, New.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
} else {
- gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);
}
Pos = 10 + (Index * 3) + 1;
@@ -370,7 +370,7 @@ HBufferImagePrintLine (
Index++;
}
- gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);
while (Index < 0x10) {
Pos = 10 + (Index * 3) + 1;
ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" ");
@@ -379,7 +379,7 @@ HBufferImagePrintLine (
//
// restore the original color
//
- gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);
//
// PRINT the buffer content
@@ -581,8 +581,8 @@ HBufferImageRestoreMousePosition (
//
Orig = HMainEditor.ColorAttributes;
New.Data = 0;
- New.Colors.Foreground = Orig.Colors.Background;
- New.Colors.Background = Orig.Colors.Foreground;
+ New.Colors.Foreground = Orig.Colors.Background & 0xF;
+ New.Colors.Background = Orig.Colors.Foreground & 0x7;
//
// if in selected area,
@@ -594,7 +594,7 @@ HBufferImageRestoreMousePosition (
)) {
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
} else {
- gST->ConOut->SetAttribute (gST->ConOut, New.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
}
//
// clear the old mouse position
@@ -646,7 +646,7 @@ HBufferImageRestoreMousePosition (
HBufferImage.MousePosition.Row,
HBufferImage.MousePosition.Column
)) {
- gST->ConOut->SetAttribute (gST->ConOut, New.Data);
+ gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
} else {
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
}