OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 7:05 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 36 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: Help! I can't write at 0xFE000000
PostPosted: Mon Jan 10, 2022 11:43 pm 
Offline
Member
Member

Joined: Tue Aug 17, 2021 10:40 am
Posts: 104
Location: CN
https://github.com/nifanfa/CS2ASM
https://github.com/nifanfa/CS2ASM/blob/ ... /Paging.cs
https://github.com/nifanfa/CS2ASM/blob/ ... yPoint.asm
here is the source code

_________________
My github: https://github.com/nifanfa


Top
 Profile  
 
 Post subject: Re: Help! I can't write at 0xFE000000
PostPosted: Tue Jan 11, 2022 10:19 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
nifanfa wrote:
i can access 0xFD000000 before entering long mode


Code:
size 8

What happens if you use uint instead of ulong?


Top
 Profile  
 
 Post subject: Re: Help! I can't write at 0xFE000000
PostPosted: Tue Jan 11, 2022 9:40 pm 
Offline
Member
Member

Joined: Tue Aug 17, 2021 10:40 am
Posts: 104
Location: CN
Octocontrabass wrote:
nifanfa wrote:
i can access 0xFD000000 before entering long mode


Code:
size 8

What happens if you use uint instead of ulong?


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


Code:
            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());

_________________
My github: https://github.com/nifanfa


Top
 Profile  
 
 Post subject: Re: Help! I can't write at 0xFE000000
PostPosted: Tue Jan 11, 2022 10:50 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.


Top
 Profile  
 
 Post subject: Re: Help! I can't write at 0xFE000000
PostPosted: Tue Jan 11, 2022 11:09 pm 
Offline
Member
Member

Joined: Tue Aug 17, 2021 10:40 am
Posts: 104
Location: CN
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:
WriteRegister16(device.Bus, device.Slot, device.Function, 0x04, 0x04);

is to enable the pci mmio.

_________________
My github: https://github.com/nifanfa


Top
 Profile  
 
 Post subject: Re: Help! I can't write at 0xFE000000
PostPosted: Wed Jan 12, 2022 1:01 am 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 676
nifanfa wrote:
i thought
Code:
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!

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 6 hours


Who is online

Users browsing this forum: SemrushBot [Bot] and 74 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group