Implement EDKII maintain old directory

本文探讨了EDKII中Shell执行路径的问题。当Shell被修改并作为其他程序的基础时,会出现路径相关的错误。文章详细介绍了如何通过LoadedImageProtocol和DevicePathProtocol来解决这些问题。

EDKII中的shell在执行起来的时候,并不会去检测当前的image(即shell.efi)是从哪个路径invoke起来的,我想是因为Intel在porting EDKII的时候就没想到会有人在shell的基础上去修改成另外一个程序,默认的就是BIOS POST结束,接着invoke这个shell.efi,从而不需要考虑当前的shell.efi是从哪里执行起来的。

但在我们实际使用时,是把shell改成另外一个程序,然后在shell下执行,即BIOS POST-> shell ->我们的程序。此时,如果不考虑image load的路径,就会出现与file access相关的问题,例如屏幕输出不能重定向到一个文件(即 command >> test.log),或者无法读取文件,因为根本就不知道从哪里去读。

在UEFI的标准下,每个image执行起来之后,shell都会为它新建一个ImageHandle传进来,在这个handle上会挂有LoadedImageProtocol,这个protocol里能找到File path,同时,该protocol里有一个DeviceHandle,在DeviceHandle上会挂有DevicePathProtocol,从这个DevicePathProtocol里可以找到image device path。

具体细节请参考shell.c, GetDevicePathsForImageAndFile


### Implementor Implementation Usage and Issues In programming, an **implementor** typically refers to a class or structure responsible for providing concrete implementations of interfaces or abstract classes. This concept is widely used across various languages such as Java, C#, Python, and Go. Below is a detailed explanation regarding implementors' usage and potential issues. #### Understanding Interfaces and Implementations An interface defines a contract that specifies what methods must be implemented by any struct or class adhering to it. In Go, this relationship is implicit rather than explicit—any type satisfying all the methods defined in an interface automatically implements it without requiring additional declarations[^1]. For example: ```go type Sorter interface { Len() int Less(i, j int) bool Swap(i, j int) } func main() { var sorter Sorter = &CustomSort{} } ``` Here, `CustomSort` implicitly satisfies the `Sorter` interface if it provides definitions for `Len`, `Less`, and `Swap`. #### Common Challenges with Implementors Several challenges can arise when working with implementors: - **Type Safety**: Ensuring types conform strictly to their expected behavior during runtime may lead to subtle bugs unless carefully managed. - **Concurrency Handling**: If multiple goroutines interact through shared resources via calls made on these implementors, synchronization mechanisms like mutexes might become necessary. For instance, consider invoking sorting operations asynchronously using goroutines: ```go package main import ( "fmt" "sort" ) func asyncSort(slice []int) chan string { ch := make(chan string) go func() { sort.Ints(slice) defer close(ch) ch <- fmt.Sprintf("Sorted slice: %v", slice) }() return ch } func main() { slice := []int{3, 2, 5, 1, 4} resultChan := asyncSort(slice) if result := <-resultChan; len(result) > 0 { fmt.Println(result) } } ``` This demonstrates how you could leverage goroutines alongside implementors while managing concurrency effectively. #### Messaging Systems Integration When integrating messaging systems into applications utilizing implementors, one should account for reliable delivery guarantees provided by message brokers mentioned earlier[^2]: Message brokers facilitate communication between different parts of distributed systems efficiently. They allow decoupling producers from consumers enabling flexible scaling options along with fault tolerance features which enhance overall system robustness significantly. By combining both concepts — proper handling within your codebase concerning implementors plus leveraging external services offered by message queues—you achieve more resilient architectures capable of addressing complex real-world scenarios gracefully.
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值