Page 1 of 1
Posted: Sat Feb 23, 2008 12:31 am
Sorry to bring this up *again* but has anyone found a way to get this to work on real hardware.
And if it didnt work on one before how did you fix it?
Oops I ment Demo4 not tutorial 4 lol.
Posted: Sat Feb 23, 2008 1:37 pm
IIRC, you have to rename the kernel from krnl.dll to krnl.sys so the bootloader can load it.
I will check this when I have time
Posted: Sun Feb 24, 2008 4:44 am
Hey, thanks quick reply
I had done that though.. After all the time i've been trying to fix this bug I found a way the day after I posted it here
It would seem that on my machine the address 1MB and so on (for a bit idk how much), is mapped to the floppy drive controller perhaps? or something along those lines..
I think that because I tried making Stage2 dump whats on 1MB and onwards to the screen (after loading KRNL.SYS there), and it had the 1st stage bootloader, FAT table, etc..
Anyhow.. to fix it I just,
Changed the address that KRNL.SYS is loaded to:
Code: Select all
mov ebx, 0x7FFF ; BX:BP points to buffer to load to
mov bp, 0x0010 ; load to (0x8000)
mov si, ImageName ; our file to load
call LoadFile ; load our file
Code: Select all
mov ebx, [0x80000+60] ; e_lfanew is a 4 byte offset address of the PE header; it is 60th byte. Get it
add ebx, 0x80000 ; Add base address. EBX now points to file sig (PE00)
Then I changed the base address in c++/Stage3.asm to 0x80000 and
it all worked
Posted: Sun Feb 24, 2008 1:56 pm
Well done for making it work.
That is very strange. I wasn't aware that the floppy data could be mapped into memory. It might suggest that you don't have any RAM in slot 1 of you computer (due to arcane technicalities, the first piece of ram start in slot 3) in which case the BIOS is mapping other devices to the first gig of linear memory.
You could check using BIOS interrupt 12 (ax=0) which returns the number kilobytes of contiguous memory starting at the absolute address 00000h in ax. If you haven't got ram in slot 1, it should return 1024, being exactly 1 megabyte of contiguous memory.
Hope this works,
Posted: Mon Feb 25, 2008 3:08 am
I wasn't aware that the floppy data could be mapped into memory. It might suggest that you don't have any RAM in slot 1 of you computer
Why would it suggest that? By the way no there isnt any ram in the first slot.. Well there are 2 slots in that particular machine.. Theres ram in the one on the right when you look at it on a particular angle oh idk lol.
So am I right in saying then that if I had say 3 slots and only RAM in the 1st and 3rd one, there would be a hole in the memory addresses that actully work?
If you haven't got ram in slot 1, it should return 1024, being exactly 1 megabyte of contiguous memory.
Where does this 1MB come from? Is there any way to find out how much memory I have in total?.. Easy way I mean lol
Posted: Mon Feb 25, 2008 5:46 pm
As far as I am aware,
On nearly every modern motherboard, there are 4 slots for RAM, each able to have a maximum of 1GB which is a result of the 4GB total memory for a 32bit computer.
The memory is then automatically assigned. The first 1GB of linear memory refers to anything in slot 1, second GB for slot 2 and so on.
This means that if you have nothing in slot 1, there would be a 1GB 'hole' in physical memory. On the other hand, if you had a 512MB stick of ram in slot 2, the first 512MB starting at 2GB would be accessible but the second 512MB would be another hole.
There is 1MB of RAM that is part of the motherboard itself which is guaranteed to be there. This is why the BIOS memory mapped regions (tutorial 7 iirc) do not go above 1MB.
Sadly, I am not aware of any method to reliably find which memory locations you have physical RAM for and which have holes. However, there must be some way of doing this.