services

package
v0.0.0-...-e83addd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2021 License: GPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const LoadedImageProtocol = "5B1B31A1-9562-11D2-8E3F-00A0C969723B"

This protocol should be loaded FIRST. It should be at the base, currently 0xff000000

Variables

View Source
var (

	// Debug is for debugging messages.
	Debug = func(string, ...interface{}) {}
)
View Source
var GUIDServices = []string{}

var services = map[string]Service

Functions

func Allocate

func Allocate(amt int) uintptr

Allocate bump allocates from the data area.

func Dispatch

func Dispatch(f *Fault) error

Dispatch is called with an address. The address is split into a base and 16-bit offset. The base is not right-shifted or changed in any other way.

func NewSystemtable

func NewSystemtable(tab []byte) (uint64, uint64, error)

NewSystemtable returns a Systemtable Service, as well as the Image Handle. This must be the FIRST New called for a service. The system table is a kind of "root" of UEFI services, with pointers to boot, runtime, and other core services.

func RegisterCreator

func RegisterCreator(n string, s serviceCreator)

RegisterCreator registers a service creator. Assumption: only called from init()

func RegisterGUIDCreator

func RegisterGUIDCreator(n string, s serviceCreator)

RegisterGUIDService registers a service named by a GUID. Assumption: only called from init()

func SetAllocBase

func SetAllocBase(b uint32)

func SetAllocator

func SetAllocator(b, lim uintptr)

SetAllocator sets the base and limit of the bump-allocated data area.

func UEFIAllocate

func UEFIAllocate(amt uintptr, page bool) uint32

UEFIAllocate allocates memory for the DXE. If page is set, the alignment is 4k, else it is 8 bytes.

Types

type BlockIO

type BlockIO struct {
	// contains filtered or unexported fields
}

BlockIO implements Service

func (*BlockIO) Aliases

func (t *BlockIO) Aliases() []string

func (*BlockIO) Base

func (t *BlockIO) Base() ServBase

Base implements service.Base

func (*BlockIO) Call

func (t *BlockIO) Call(f *Fault) error

Call implements service.Call

func (*BlockIO) OpenProtocol

func (t *BlockIO) OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)

OpenProtocol implements service.OpenProtocol

func (*BlockIO) Ptr

func (t *BlockIO) Ptr() ServPtr

Ptr implements service.Ptr

type Boot

type Boot struct {
	// contains filtered or unexported fields
}

Boot implements Service

func (*Boot) Aliases

func (r *Boot) Aliases() []string

func (*Boot) Base

func (r *Boot) Base() ServBase

Base implements service.Base

func (*Boot) Call

func (r *Boot) Call(f *Fault) error

Call implements service.Call

func (*Boot) OpenProtocol

func (r *Boot) OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)

OpenProtocol implements service.OpenProtocol

func (*Boot) Ptr

func (b *Boot) Ptr() ServPtr

Base implements service.Ptr

func (*Boot) SetFun

func (r *Boot) SetFun(t trace.Trace) error

type Collate

type Collate struct {
	// contains filtered or unexported fields
}

Collate implements Service

func (*Collate) Aliases

func (c *Collate) Aliases() []string

Aliases implements Aliases

func (*Collate) Base

func (t *Collate) Base() ServBase

Base implements service.Base

func (*Collate) Call

func (t *Collate) Call(f *Fault) error

Call implements service.Call

func (*Collate) OpenProtocol

func (c *Collate) OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)

OpenProtocol implements service.OpenProtocol

func (*Collate) Ptr

func (c *Collate) Ptr() ServPtr

Base implements service.Ptr

type DevicePath

type DevicePath struct {
	// contains filtered or unexported fields
}

DevicePath implements Service But DevicePath *seems* to just be a blob of bytes. So it's a protocol, but it is just data? Who does this?

func (*DevicePath) Aliases

func (d *DevicePath) Aliases() []string

func (*DevicePath) Base

func (d *DevicePath) Base() ServBase

Base implements service.Base

func (*DevicePath) Call

func (d *DevicePath) Call(f *Fault) error

Call implements service.Call

func (*DevicePath) OpenProtocol

func (d *DevicePath) OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)

OpenProtocol implements service.OpenProtocol

func (*DevicePath) Ptr

func (d *DevicePath) Ptr() ServPtr

Ptr implements service.Ptr

type Fault

type Fault struct {
	Proc trace.Trace
	Info *unix.SignalfdSiginfo
	Inst *x86asm.Inst
	Regs *syscall.PtraceRegs
	// We use Asm to figure out instruction type.
	Asm  string
	Args []uintptr
	Op   Func
}

Fault defines all we need to know on a fault and how to do it.

type Func

type Func uint16

Func is a function selector.

type Handle

type Handle struct {
	// contains filtered or unexported fields
}

func (*Handle) Get

func (h *Handle) Get(g *guid.GUID) (*dispatch, error)

Get gets a dispatch given a GUID.

func (*Handle) Put

func (h *Handle) Put(g *guid.GUID, aliases ...*guid.GUID) error

Put puts a dispatch given a GUID. From what we know, it's ok to replace one.

func (*Handle) PutService

func (h *Handle) PutService(g *guid.GUID, s Service, u ServPtr) error

PutService puts a Service given given a GUID, Service, and base.

type ImageHandle

type ImageHandle struct {
	// contains filtered or unexported fields
}

This is for the special ImageHandle at services.ImageHandle ImageHandle implements Service

func (*ImageHandle) Aliases

func (s *ImageHandle) Aliases() []string

Aliases implements Aliases

func (*ImageHandle) Base

func (s *ImageHandle) Base() ServBase

Base implements service.Base

func (*ImageHandle) Call

func (r *ImageHandle) Call(f *Fault) error

Call implements service.Call

func (*ImageHandle) OpenProtocol

func (s *ImageHandle) OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)

OpenProtocol implements service.OpenProtocol

func (*ImageHandle) Ptr

func (s *ImageHandle) Ptr() ServPtr

Base implements service.Ptr

type LoadedImage

type LoadedImage struct {
	// contains filtered or unexported fields
}

LoadedImage implements Service

func (*LoadedImage) Aliases

func (l *LoadedImage) Aliases() []string

Aliases implements Aliases

func (*LoadedImage) Base

func (l *LoadedImage) Base() ServBase

Base implements service.Base

func (*LoadedImage) Call

func (l *LoadedImage) Call(f *Fault) error

Call implements service.Call

func (*LoadedImage) OpenProtocol

func (l *LoadedImage) OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)

OpenProtocol implements service.OpenProtocol

func (*LoadedImage) Ptr

func (l *LoadedImage) Ptr() ServPtr

Base implements service.Ptr

type Register

type Register = x86asm.Reg

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime implements Service

func (*Runtime) Aliases

func (r *Runtime) Aliases() []string

Aliases implements Aliases

func (*Runtime) Base

func (r *Runtime) Base() ServBase

Base implements service.Base

func (*Runtime) Call

func (r *Runtime) Call(f *Fault) error

Call implements service.Call

func (*Runtime) OpenProtocol

func (r *Runtime) OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)

OpenProtocol implements service.OpenProtocol

func (*Runtime) Ptr

func (r *Runtime) Ptr() ServPtr

Base implements service.Ptr

type ServBase

type ServBase string

type ServPtr

type ServPtr uint32

func Base

func Base(tab []byte, n string) (ServPtr, error)

Base sets up a base address for a service. The base is chosen externally. When a DXE segvs, Dispatch will look up the Base and then dispatch to the correct Call function. Note that because this uses a string, one might set up names based on both a service name and a guid. Why, I have no idea.

func BasePtr

func BasePtr(n string) (ServPtr, bool)

BasePtr returns the base pointer for a service.

func (*ServPtr) Base

func (p *ServPtr) Base() ServBase

String is a stringer for ServBase

func (*ServPtr) String

func (p *ServPtr) String() string

String is a stringer for ServBase

type Service

type Service interface {
	Call(f *Fault) error
	Base() ServBase
	Ptr() ServPtr
	OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)
	Aliases() []string
}

Service is the interface to services. In deference to the fact that we may be tracing more than one process, we pass the Tracee in as a parameter.

func AddrToService

func AddrToService(addr uintptr) (Service, error)

Service returns a service given an addr.

func NewBlockIO

func NewBlockIO(tab []byte, u ServPtr) (Service, error)

NewBlockIO returns a BlockIO Service A BlockIO contains an pointer, not an embedded struct.

func NewBoot

func NewBoot(tab []byte, u ServPtr) (Service, error)

NewBoot returns a Boot Service

func NewCollate

func NewCollate(tab []byte, u ServPtr) (Service, error)

NewCollate returns a Collate Service

func NewDevicePath

func NewDevicePath(tab []byte, u ServPtr) (Service, error)

NewDevicePath returns a DevicePath Service. Still not todally sure what to do here, so it's empty. A DevicePath contains an pointer, not an embedded struct.

func NewLoadedImage

func NewLoadedImage(tab []byte, u ServPtr) (Service, error)

NewLoadedImage returns a LoadedImage Service

func NewRuntime

func NewRuntime(tab []byte, u ServPtr) (Service, error)

NewRuntime returns a Runtime Service

func NewTextIn

func NewTextIn(tab []byte, u ServPtr) (Service, error)

NewTextIn returns a TextIn Service

func NewTextMode

func NewTextMode(tab []byte, u ServPtr) (Service, error)

NewTextMode returns a TextMode Service

func NewTextOut

func NewTextOut(tab []byte, u ServPtr) (Service, error)

NewTextOut returns a TextOut Service

type SystemTable

type SystemTable struct {
	// contains filtered or unexported fields
}

Runtime implements Service

func (*SystemTable) Aliases

func (s *SystemTable) Aliases() []string

Aliases implements Aliases

func (*SystemTable) Base

func (s *SystemTable) Base() ServBase

Base implements service.Base

func (*SystemTable) Call

func (r *SystemTable) Call(f *Fault) error

Call implements service.Call

func (*SystemTable) OpenProtocol

func (s *SystemTable) OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)

OpenProtocol implements service.OpenProtocol

func (*SystemTable) Ptr

func (s *SystemTable) Ptr() ServPtr

Base implements service.Ptr

type TextIn

type TextIn struct {
	// contains filtered or unexported fields
}

TextIn implements Service

func (*TextIn) Aliases

func (t *TextIn) Aliases() []string

Aliases implements Aliases

func (*TextIn) Base

func (t *TextIn) Base() ServBase

Base implements service.Base

func (*TextIn) Call

func (t *TextIn) Call(f *Fault) error

Call implements service.Call

func (*TextIn) OpenProtocol

func (t *TextIn) OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)

OpenProtocol implements service.OpenProtocol

func (*TextIn) Ptr

func (t *TextIn) Ptr() ServPtr

Base implements service.Base

type TextMode

type TextMode struct {
	// contains filtered or unexported fields
}

TextMode implements Service

func (*TextMode) Aliases

func (t *TextMode) Aliases() []string

Aliases implements Aliases

func (*TextMode) Base

func (t *TextMode) Base() ServBase

Base implements service.Base

func (*TextMode) Call

func (t *TextMode) Call(f *Fault) error

Call implements service.Call we don't care about textout mode. It's stupid. just ignore and move on.

func (*TextMode) OpenProtocol

func (t *TextMode) OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)

OpenProtocol implements service.OpenProtocol

func (*TextMode) Ptr

func (t *TextMode) Ptr() ServPtr

Ptr implements service.Ptr

type TextOut

type TextOut struct {
	// contains filtered or unexported fields
}

TextOut implements Service

func (*TextOut) Aliases

func (t *TextOut) Aliases() []string

Aliases implements Aliases

func (*TextOut) Base

func (t *TextOut) Base() ServBase

Base implements service.Base

func (*TextOut) Call

func (t *TextOut) Call(f *Fault) error

Call implements service.Call

func (*TextOut) OpenProtocol

func (t *TextOut) OpenProtocol(f *Fault, h *Handle, g guid.GUID, ptr uintptr, ah, ch *Handle, attr uintptr) (*dispatch, error)

OpenProtocol implements service.OpenProtocol

func (*TextOut) Ptr

func (t *TextOut) Ptr() ServPtr

Ptr implements service.Ptr

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL