Closed10

UEFI - Simple File System Protocol メモ

JanosJanos

で、EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume;はこうか:

// #L59
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME)(
  IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL    *This,
  OUT EFI_FILE_PROTOCOL                 **Root
  );
JanosJanos

そしてOUT EFI_FILE_PROTOCOL **Root

// #L528
struct _EFI_FILE_PROTOCOL {
  ///
  /// The version of the EFI_FILE_PROTOCOL interface. The version specified
  /// by this specification is EFI_FILE_PROTOCOL_LATEST_REVISION.
  /// Future versions are required to be backward compatible to version 1.0.
  ///
  UINT64                   Revision;
  EFI_FILE_OPEN            Open;
  EFI_FILE_CLOSE           Close;
  EFI_FILE_DELETE          Delete;
  EFI_FILE_READ            Read;
  EFI_FILE_WRITE           Write;
  EFI_FILE_GET_POSITION    GetPosition;
  EFI_FILE_SET_POSITION    SetPosition;
  EFI_FILE_GET_INFO        GetInfo;
  EFI_FILE_SET_INFO        SetInfo;
  EFI_FILE_FLUSH           Flush;
  EFI_FILE_OPEN_EX         OpenEx;
  EFI_FILE_READ_EX         ReadEx;
  EFI_FILE_WRITE_EX        WriteEx;
  EFI_FILE_FLUSH_EX        FlushEx;
};
// #L25
typedef struct _EFI_FILE_PROTOCOL EFI_FILE_PROTOCOL;
JanosJanos

fs->OpenVolume(fs, root);は仕様書によると、型は

typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME) (
  IN EFI_SIMPLE_FILE_SYSTEM PROTOCOL                   *This,
  OUT EFI_FILE_PROTOCOL                                **Root
  );

Q. EFI_FILE_PROTOCOLuefi-rsでどう定義されているのか?

Hidden comment
JanosJanos

struct _EFI_FILE_PROTOCOLの各member関数の型はこういう雰囲気のものが続く感じ:

typedef
EFI_STATUS
(EFIAPI *EFI_FILE_OPEN) (
  IN EFI_FILE_PROTOCOL                  *This,
  OUT EFI_FILE_PROTOCOL                 **NewHandle,
  IN CHAR16                             *FileName,
  IN UINT64                             OpenMode,
  IN UINT64                             Attributes
  );
JanosJanos

EFI_FILE_PROTOCOLまでinterfaceをRustで定義してやれば、なんとかなるんじゃないの? (楽観からの死)

このスクラップは2023/08/29にクローズされました