delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2014/07/10/22:30:07

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <dont_use_email AT xnothavet DOT cqm>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Using outportb() with djgpp
Date: Thu, 10 Jul 2014 22:14:32 -0400
Organization: Aioe.org NNTP Server
Lines: 44
Message-ID: <op.xis9uito6zenlw@localhost>
References: <almarsoft DOT 2508132549819646607 AT news DOT free DOT fr>
<op DOT xis9jzsr6zenlw AT localhost>
NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org
Mime-Version: 1.0
X-Complaints-To: abuse AT aioe DOT org
User-Agent: Opera Mail/12.16 (Linux)
X-Notice: Filtered by postfilter v. 0.8.2
Bytes: 2476
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Thu, 10 Jul 2014 22:08:13 -0400, Rod Pemberton  
<dont_use_email AT xnothavet DOT cqm> wrote:
> On Thu, 10 Jul 2014 16:20:13 -0400, Mateusz Viste  
> <mateusz DOT viste AT localhost> wrote:

>> I am trying to write to a hardware port from within djgpp, using  
>> outportb(). It does work from time to time, but often outportb() will  
>> make the whole PC reboot. Specifically I am writing to port 0x330 (to a  
>> MPU401 adapter). If using the same code with turbo C, it works  
>> perfectly. Hence I am wondering: are there any special "rules" I should  
>> be aware of when trying to outportb() from within protected mode?
>
> I'm not familiar with your port.
>
> I use outportb() extensively in my OS project for keyboard, mouse,
> RTC, PIT, PICs, VGA registers, etc.  Typically, I have both hardware
> interrupts and software interrupts disabled when using outportb().
> In at least one instance, only software interrupts are disabled.
>
> Software interrupts are disabled with the x86 CLI instruction, but
> with C compilers you should use the provided function.  Sometimes
> they do more than just clear the interrupt.  For DJGPP, you should
> use disable().  Other C compilers have similar functions.
>

Correction:
... do more than just clear the interrupt flag.

> Hardware interrupts (NMI - Non-Maskable Interrupts) are disabled or
> enabled by changing a bit in CMOS memory, i.e., using out_portb()
> and in_portb().
>
> "Non Maskable Interrupt"
> http://wiki.osdev.org/Non_Maskable_Interrupt
>
> alt.os.development FAQ on NMI
> http://aodfaq.wikispaces.com/boot#How%20do%20I%20disable%20NMI%20on%20a%20PC?
>
>

HTH,


Rod Pemberton

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019