Mail Archives: djgpp/2014/07/10/22:30:07
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 -