-1

I'm writing an UEFI application that should be able to write a lot of data to disk. I'm aware of the FAT-32 file size limitations and number of files per directory etc. That should not be the problem. The memory region I'm trying to write is marked as usable by the memory map und I can read/write to it without problems but after a certain amount of data my vm just reboots without any error messages. The following line makes problems:

uefi_call_wrapper(handle->Write, 3, handle, size, content);

handle is initialized a few lines earlier, size is always max 128MiB and content a valid memory region with read/write access. I've already rewritten the whole thin on Windows with EDK2 and got the same problems.

Can anyone help me with this? Thank you in advance and have a nice evening

AlexRoot
  • 1
  • 2
  • What error are you getting? – David Manheim Oct 17 '17 at 17:06
  • I don't get any error, the vm just reboots and on real hw it just hangs and nothing else happens... – AlexRoot Oct 17 '17 at 17:19
  • What is the type of `handle`? Does Write work when you call it with a smaller size? What is the size at which it starts to fail? Are you sure that the reboot is occuring within the call to Write and not after it returns? – prl Oct 18 '17 at 01:45

2 Answers2

1

Assuming that handle is a pointer to EFI_FILE_PROTOCOL, the BufferSize parameter to Write is passed by reference. When the function returns, BufferSize contains the number of bytes written. You didn't give enough context in your question, but it looks like you are passing it by value.

prl
  • 11,716
  • 2
  • 13
  • 31
0

Hi guys and thank you for you answeres. The size argument is a pointer. I've just found the solution for the problem. I didn't know I have to reset the watchdog timer. After calling uefi_call_wrapper(ST->BootServices->SetWatchdogTimer, 4, 0, 0, 0, NULL); everything works as expected

Cheers!

AlexRoot
  • 1
  • 2