-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexit.go
44 lines (37 loc) · 944 Bytes
/
exit.go
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
// Copyright (c) WithSecure Corporation
//
// Use of this source code is governed by the license
// that can be found in the LICENSE file.
package uefi
// EFI Boot Services offsets
const (
exit = 0xd8
exitBootServices = 0xe8
)
// Exit calls EFI_BOOT_SERVICES.Exit().
func (s *BootServices) Exit(code int) (err error) {
status := callService(s.base+exit,
[]uint64{
uint64(s.imageHandle),
uint64(code),
0,
0,
},
)
return parseStatus(status)
}
// ExitServices calls EFI_BOOT_SERVICES.ExitBootServices(), it is the caller
// responsability to avoid using any EFI Boot Service after this call is
// successful.
func (s *BootServices) ExitBootServices() (memoryMap *MemoryMap, err error) {
if memoryMap, err = s.GetMemoryMap(); err != nil {
return
}
status := callService(s.base+exitBootServices,
[]uint64{
uint64(s.imageHandle),
memoryMap.MapKey,
},
)
return memoryMap, parseStatus(status)
}