Help! I can't write at 0xFE000000

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Help! I can't write at 0xFE000000

Post by Octocontrabass »

nifanfa wrote:i can access 0xFD000000 before entering long mode

Code: Select all

size 8
What happens if you use uint instead of ulong?
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: Help! I can't write at 0xFE000000

Post by nifanfa »

Octocontrabass wrote:
nifanfa wrote:i can access 0xFD000000 before entering long mode

Code: Select all

size 8
What happens if you use uint instead of ulong?

Code: Select all

Invalid access at addr 0xFD000000, size 4, region '(null)', reason: rejected

Code: Select all

            Paging.Map(0xFD000000, 0xFD000000);
            uint val = 0;
            asm("mov edi,0xFD000000");
            asm("mov dword [edi],1024");
            asm("mov eax,[edi]");
            asm("mov {val},eax");
            Console.WriteLine(((ulong)val).ToString());
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Help! I can't write at 0xFE000000

Post by Octocontrabass »

You're disabling MMIO!

You don't need to write anything to the command register. Firmware enables all PCI devices before it loads your bootloader.
nifanfa
Member
Member
Posts: 104
Joined: Tue Aug 17, 2021 10:40 am
Libera.chat IRC: visitor
Location: CN
Contact:

Re: Help! I can't write at 0xFE000000

Post by nifanfa »

Octocontrabass wrote:You're disabling MMIO!

You don't need to write anything to the command register. Firmware enables all PCI devices before it loads your bootloader.
THANK YOU SO MUCH!!!
I CAN'T EXPRESS HOW EXCITED I AM!!!

i thought

Code: Select all

WriteRegister16(device.Bus, device.Slot, device.Function, 0x04, 0x04);
is to enable the pci mmio.
klange
Member
Member
Posts: 679
Joined: Wed Mar 30, 2011 12:31 am
Libera.chat IRC: klange
Discord: klange

Re: Help! I can't write at 0xFE000000

Post by klange »

nifanfa wrote:i thought

Code: Select all

WriteRegister16(device.Bus, device.Slot, device.Function, 0x04, 0x04);
is to enable the pci mmio.
Writing 0x04 to the command register will enable bus mastering, and disable everything else. Don't let the name confuse you, the register does not work by taking 'commands' - it's a bitfield so you need to maintain all of the other bits as you set or unset new ones.

Good catch, Octocontrabass!
Post Reply