OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:58 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: sysOutLong and sysInLong [solved]
PostPosted: Tue Sep 04, 2018 9:10 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
Good day!
I wanted to implement a PCI but in the method pciConfigReadWord are the methods of sysOutLong and sysInLong and I non found how I should program it. Please, what is code methods sysOutLong and sysInLong?

_________________
https://github.com/VendelinSlezak/BleskOS


Last edited by Klakap on Tue Sep 04, 2018 10:21 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: sysOutLong and sysInLong
PostPosted: Tue Sep 04, 2018 9:38 am 
Offline
Member
Member
User avatar

Joined: Mon Jul 13, 2009 5:52 am
Posts: 99
Location: Denmark
Hi Klakap,

When you need to write or read a long (in this case long means a 32-bit unsigned integer) to an I/O port you need to use the "inl" and "outl" instructions. These instructions work in exactly the same way as their 8- and 16-bit counterparts.

For an example of how to write these commands as inline assembly in GCC, see e.g.: https://wiki.osdev.org/Inline_Assembly/Examples#OUTx


Top
 Profile  
 
 Post subject: Re: sysOutLong and sysInLong
PostPosted: Tue Sep 04, 2018 9:41 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
So outl is it the same as outb? The function outb and inb I have.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: sysOutLong and sysInLong
PostPosted: Tue Sep 04, 2018 10:01 am 
Offline
Member
Member
User avatar

Joined: Mon Jul 13, 2009 5:52 am
Posts: 99
Location: Denmark
No, they are not the same. "outb" is used for writing an 8-bit integer, while "outl" is used for writing a 32-bit integer, but they work in the same way.


Top
 Profile  
 
 Post subject: Re: sysOutLong and sysInLong
PostPosted: Tue Sep 04, 2018 10:03 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
And please what is code of method outl?

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: sysOutLong and sysInLong
PostPosted: Tue Sep 04, 2018 10:05 am 
Offline
Member
Member
User avatar

Joined: Mon Jul 13, 2009 5:52 am
Posts: 99
Location: Denmark
In GCC inline assembly you can use:

Code:
void outportl(uint16_t port, uint32_t value)
{
   asm volatile("outl %0, %%dx" :: "a" (value), "d" (port));
}


Top
 Profile  
 
 Post subject: Re: sysOutLong and sysInLong
PostPosted: Tue Sep 04, 2018 10:15 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
Very thank you! And please, what is code of Inl? Is similiar methods outw and inw?

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: sysOutLong and sysInLong
PostPosted: Tue Sep 04, 2018 10:17 am 
Offline
Member
Member
User avatar

Joined: Mon Jul 13, 2009 5:52 am
Posts: 99
Location: Denmark
Yes, the code for "inl" is equivalent to the code for inb/inw, except that it takes a 32-bit integer as an argument instead.


Top
 Profile  
 
 Post subject: Re: sysOutLong and sysInLong
PostPosted: Tue Sep 04, 2018 10:21 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
Very thank you! For these methods, I was stuck with my os development.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 67 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