Maximilian Stein has uploaded this change for review. ( https://gem5-review.googlesource.com/7601

Change subject: arch-x86: Granularity bit and segment limit
......................................................................

arch-x86: Granularity bit and segment limit

If set, the granularity bit indicates that the segment limit of segment
descriptors shall be interpreted as number of 4K blocks rather than
bytes.

The high part (bit 48 to 51) of segment descriptor limits is only 4 bits
wide while the low part (bit 0 to 15) spans 16 bits.

Change-Id: Ie386224ca815275fdb31498fe68310ed9c62cc87
---
M src/arch/x86/system.cc
1 file changed, 6 insertions(+), 2 deletions(-)



diff --git a/src/arch/x86/system.cc b/src/arch/x86/system.cc
index ecde836..69e013f 100644
--- a/src/arch/x86/system.cc
+++ b/src/arch/x86/system.cc
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2007 The Hewlett-Packard Development Company
+ * Copyright (c) 2018 TU Dresden
  * All rights reserved.
  *
  * The license below extends only to copyright in the software and shall
@@ -35,6 +36,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * Authors: Gabe Black
+ *          Maximilian Stein
  */

 #include "arch/x86/system.hh"
@@ -67,6 +69,8 @@
                                   seg == SEGMENT_REG_TSL ||
                                   seg == SYS_SEGMENT_REG_TR;
     uint64_t limit = desc.limitLow | (desc.limitHigh << 16);
+    if (desc.g)
+        limit = (limit << 12) | mask(12);

     SegAttr attr = 0;

@@ -155,8 +159,8 @@
     initDesc.d = 0;               // operand size
     initDesc.g = 1;               // granularity
     initDesc.s = 1;               // system segment
-    initDesc.limitHigh = 0xFFFF;
-    initDesc.limitLow = 0xF;
+    initDesc.limitHigh = 0xF;
+    initDesc.limitLow = 0xFFFF;
     initDesc.baseHigh = 0x0;
     initDesc.baseLow = 0x0;


--
To view, visit https://gem5-review.googlesource.com/7601
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie386224ca815275fdb31498fe68310ed9c62cc87
Gerrit-Change-Number: 7601
Gerrit-PatchSet: 1
Gerrit-Owner: Maximilian Stein <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to