-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflmap_test.go
More file actions
78 lines (69 loc) · 1.44 KB
/
flmap_test.go
File metadata and controls
78 lines (69 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package intelifd
import (
"github.com/stretchr/testify/assert"
"testing"
)
var (
testIFDHeaderMapped = IFDHeader{
Offset: 0x10,
Flvalsig: 0xff0a55a,
Flmap0: FLMAP0{
IFDEntry: IFDEntry{
Raw: 0x00040003,
},
NumberOfRegions: 0,
RegionBase: 0x40,
NumberOfFlashComponents: 0,
ComponentBase: 0x30,
},
Flmap1: FLMAP1{
IFDEntry: IFDEntry{
Raw: 0x58100208,
},
NumberOfPCHStraps: 0x58,
PCHStrapsBase: 0x100,
NumberOfMasters: 2,
MasterBase: 0x80,
},
Flmap2: FLMAP2{
IFDEntry: IFDEntry{
Raw: 0x00310330,
},
IccTableBase: 0x310,
NumberOfIccTableEntries: 0x00,
NumberOfProcessorStraps: 0x3,
ProcessorStrapsBase: 0x300,
},
Flmap3: FLMAP3{
IFDEntry: IFDEntry{
Raw: 0xFFFFFFFF,
},
NumberOfDMITableEntries: 0xFF,
DMITableBase: 0xFF0,
Reserved0: 0xFF,
Reserved1: 0xFF,
},
Flumap1: FLUMAP1{
IFDEntry: IFDEntry{
Raw: 0x000002df,
},
VTL: 2,
VTBA: 0xdf0,
},
}
)
func TestIFDHeader_ParseMaps(t *testing.T) {
target := testIFDHeader
target.ParseMaps()
assert.Equal(t, testIFDHeaderMapped, target)
}
func TestIFDHeader_WriteMaps(t *testing.T) {
target := testIFDHeaderMapped
target.Flmap0.Raw = 0
target.Flmap1.Raw = 0
target.Flmap2.Raw = 0
target.Flmap3.Raw = 0
target.Flumap1.Raw = 0
target.WriteMaps()
assert.Equal(t, testIFDHeaderMapped, target)
}