Memory not been written to correctly in VirtualBox
Posted: Sun Sep 06, 2015 7:42 am
I would like to start by says that the following works without any issues in DOSBox and Bochs. However in VirtualBox (5.0), the following code ends up putting data in the wrote extended memory locations.
My OS uses Unreal mode. I have changed the way how my OS enters Unreal mode twice and the code still doesn't work in VirtualBox. Below is the function which copies bytes from conventional memory into extended memory, one byte at a time.
Could someone please let me know if I am doing something wrong or what I should try? I cannot believe that something so fundamental can be broken in VirtualBox. Help!
My OS uses Unreal mode. I have changed the way how my OS enters Unreal mode twice and the code still doesn't work in VirtualBox. Below is the function which copies bytes from conventional memory into extended memory, one byte at a time.
Could someone please let me know if I am doing something wrong or what I should try? I cannot believe that something so fundamental can be broken in VirtualBox. Help!
Code: Select all
Memory.CopyBytesFromFar.Params.SourceSeg equ 12 ; 2 bytes
Memory.CopyBytesFromFar.Params.SourcePtr equ 10 ; 2 bytes
Memory.CopyBytesFromFar.Params.DestinationAddress equ 6 ; 4 bytes
Memory.CopyBytesFromFar.Params.ByteSize equ 4 ; 2 bytes
Memory.CopyBytesFromFar.ParamsSize equ 10
Memory.CopyBytesFromFar.LocalsSize equ 0
Memory.CopyBytesFromFar:
; Prologue
enter Memory.CopyBytesFromFar.LocalsSize, 0
pushad
push es
call Memory.ClearGeneralRegisters
mov word es, word [ebp + Memory.CopyBytesFromFar.Params.SourceSeg]
mov word si, word [ebp + Memory.CopyBytesFromFar.Params.SourcePtr]
mov dword edi, dword [ebp + Memory.CopyBytesFromFar.Params.DestinationAddress]
mov word cx, word [ebp + Memory.CopyBytesFromFar.Params.ByteSize]
add word cx, word si
; Loop through each byte and assign 0
Memory.CopyBytesFromFar.1:
mov byte al, byte [es:si]
mov byte [edi], byte al
inc dword edi
inc word si
cmp word si, word cx
jb Memory.CopyBytesFromFar.1
Memory.CopyBytesFromFar.End:
; Epilogue
pop es
popad
leave
ret Memory.CopyBytesFromFar.ParamsSize