Rev 9253 | Rev 9958 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9253 | Rev 9286 | ||
---|---|---|---|
Line 43... | Line 43... | ||
43 | E820_NVS = 4 |
43 | E820_NVS = 4 |
44 | E820_UNUSABLE = 5 |
44 | E820_UNUSABLE = 5 |
45 | E820_PMEM = 7 |
45 | E820_PMEM = 7 |
Line 46... | Line 46... | ||
46 | 46 | ||
47 | proc load_file _root, _name, _buffer, _size, _fatal |
- | |
48 | locals |
- | |
49 | .status dq ? |
- | |
50 | endl |
47 | proc load_file _root, _name, _buffer, _size, _fatal |
51 | mov [_root], rcx |
48 | mov [_root], rcx |
52 | mov [_name], rdx |
49 | mov [_name], rdx |
53 | mov [_buffer], r8 |
50 | mov [_buffer], r8 |
54 | mov [_size], r9 |
51 | mov [_size], r9 |
55 | mov r10, [_root] |
52 | mov r10, [_root] |
56 | mov r11, [_name] |
53 | mov r11, [_name] |
57 | fstcall [r10+EFI_FILE_PROTOCOL.Open], r10, file_handle, \ |
54 | fstcall [r10+EFI_FILE_PROTOCOL.Open], r10, file_handle, \ |
58 | r11, EFI_FILE_MODE_READ, 0 |
55 | r11, EFI_FILE_MODE_READ, 0 |
59 | test eax, eax |
56 | test eax, eax |
60 | jz @f |
57 | jz @f |
61 | xor eax, eax |
58 | mov [_size], 0 |
62 | cmp [_fatal], 1 |
59 | cmp [_fatal], 1 |
63 | jnz .done |
60 | jnz .done |
64 | mov rcx, [rbx+EFI_SYSTEM_TABLE.ConOut] |
61 | mov rcx, [rbx+EFI_SYSTEM_TABLE.ConOut] |
65 | fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], rcx, \ |
62 | fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], rcx, \ |
66 | msg_error_open_file |
63 | msg_error_open_file |
67 | mov rcx, [rbx+EFI_SYSTEM_TABLE.ConOut] |
64 | mov rcx, [rbx+EFI_SYSTEM_TABLE.ConOut] |
68 | mov rdx, [_name] |
65 | mov rdx, [_name] |
69 | fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], rcx, [_name] |
66 | fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], rcx, [_name] |
70 | jmp $ |
67 | jmp $ |
71 | @@: |
- | |
72 | 68 | @@: |
|
73 | lea rdx, [_size] |
69 | lea rdx, [_size] |
74 | mov r8, [_buffer] |
70 | mov r8, [_buffer] |
75 | mov r10, [file_handle] |
71 | mov r10, [file_handle] |
76 | fstcall [r10+EFI_FILE_PROTOCOL.Read], [file_handle], rdx, r8 |
72 | fstcall [r10+EFI_FILE_PROTOCOL.Read], [file_handle], rdx, r8 |
77 | mov r10, [file_handle] |
73 | mov r10, [file_handle] |
78 | fstcall [r10+EFI_FILE_PROTOCOL.Close], [file_handle] |
- | |
79 | mov rax, [_size] |
74 | fstcall [r10+EFI_FILE_PROTOCOL.Close], [file_handle] |
80 | .done: |
- | |
81 | mov [.status], rax |
75 | .done: |
- | 76 | call clearbuf |
|
82 | call clearbuf |
77 | mov rax, [_size] |
83 | mov rdi, msg |
78 | mov rdi, msg |
84 | call num2dec |
79 | call num2dec |
85 | mov rcx, [rbx+EFI_SYSTEM_TABLE.ConOut] |
80 | mov rcx, [rbx+EFI_SYSTEM_TABLE.ConOut] |
86 | fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], rcx, \ |
81 | fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], rcx, \ |
87 | msg_file_size |
82 | msg_file_size |
88 | mov rcx, [rbx+EFI_SYSTEM_TABLE.ConOut] |
83 | mov rcx, [rbx+EFI_SYSTEM_TABLE.ConOut] |
89 | fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], rcx, msg |
84 | fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], rcx, msg |
90 | mov rax, [.status] |
85 | mov rax, [_size] |
91 | ret |
86 | ret |
Line 92... | Line 87... | ||
92 | endp |
87 | endp |
93 | 88 |