* Issuing BIOS interrupts in Linux
@ 2006-08-04 11:00 Rajat Jain
2006-08-05 1:20 ` Rahul Iyer
0 siblings, 1 reply; 8+ messages in thread
From: Rajat Jain @ 2006-08-04 11:00 UTC (permalink / raw)
To: Linux Newbie, kernelnewbies
Hi List,
I want to issue BIOS interrupts in Linux (both user space & kernel
space are fine). More specifically I want to issue BIOS interrupt 13h
for accessing disk using the BIOS routines. How can I do so (issue the
BIOS interrupt)?
In the file /proc/interrupts on my system, the interrupt 13 h (19
decimal) is used by some USB driver:
16: 0 Phys-irq uhci_hcd:usb1, uhci_hcd:usb4
17: 2 Phys-irq peth0
18: 637572 Phys-irq eth1
19: 0 Phys-irq uhci_hcd:usb2
20: 1275249 Phys-irq uhci_hcd:usb3
So will I be able to use the BIOS routine in this case?
TIA,
Rajat
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Issuing BIOS interrupts in Linux
2006-08-04 11:00 Issuing BIOS interrupts in Linux Rajat Jain
@ 2006-08-05 1:20 ` Rahul Iyer
[not found] ` <292693080608050553x756e4276k33c5afa80f686f44@mail.gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Rahul Iyer @ 2006-08-05 1:20 UTC (permalink / raw)
To: Rajat Jain; +Cc: Linux Newbie, kernelnewbies
In a single sentence,
"you cannot".
The reason is that bios interrupts can only be used in real mode and not
in protected mode. Linux runs in protected mode, and so this would not
be possible.
What is it you are trying to do? Maybe there's a better way to do it...
(by using the block device subsystem, for instance)
-rahul
On Fri, 2006-08-04 at 16:30 +0530, Rajat Jain wrote:
> Hi List,
>
> I want to issue BIOS interrupts in Linux (both user space & kernel
> space are fine). More specifically I want to issue BIOS interrupt 13h
> for accessing disk using the BIOS routines. How can I do so (issue the
> BIOS interrupt)?
>
> In the file /proc/interrupts on my system, the interrupt 13 h (19
> decimal) is used by some USB driver:
>
> 16: 0 Phys-irq uhci_hcd:usb1, uhci_hcd:usb4
> 17: 2 Phys-irq peth0
> 18: 637572 Phys-irq eth1
> 19: 0 Phys-irq uhci_hcd:usb2
> 20: 1275249 Phys-irq uhci_hcd:usb3
>
> So will I be able to use the BIOS routine in this case?
>
> TIA,
>
> Rajat
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive: http://mail.nl.linux.org/kernelnewbies/
> FAQ: http://kernelnewbies.org/faq/
>
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Issuing BIOS interrupts in Linux
[not found] ` <292693080608050553x756e4276k33c5afa80f686f44@mail.gmail.com>
@ 2006-08-05 13:11 ` Rajat Jain
2006-08-05 14:54 ` Rik van Riel
0 siblings, 1 reply; 8+ messages in thread
From: Rajat Jain @ 2006-08-05 13:11 UTC (permalink / raw)
To: idlisambar, kernelnewbies, Linux Newbie
> Hi List,
>
> I want to issue BIOS interrupts in Linux (both user space & kernel
> space are fine). More specifically I want to issue BIOS interrupt 13h
> for accessing disk using the BIOS routines. How can I do so (issue the
> BIOS interrupt)?
> Rajat
> On 8/5/06, Rahul Iyer <idlisambar@gmail.com> wrote:
> > In a single sentence,
> > "you cannot".
> > The reason is that bios interrupts can only be used in real mode and not
> > in protected mode. Linux runs in protected mode, and so this would not
> > be possible.
Uh ... :-(
> > What is it you are trying to do? Maybe there's a better way to do it...
> > (by using the block device subsystem, for instance)
> > -rahul
> >
Actually I was thinking that if it is possible to perform all the Disk
IO operations using the BIOS routines, then why can't we write a
SINGLE disk driver that will work with all the kinds of disks. The
idea was ofcourse based on the assumption that the driver will be able
to do all disk operation using the BIOS interupts, instead of actually
communicating with the Disk controller hardware.
So all this seems like a bad idea ... or should I say TOTALLY IMPOSSIBLE?
Thanks,
Rajat
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Issuing BIOS interrupts in Linux
2006-08-05 13:11 ` Rajat Jain
@ 2006-08-05 14:54 ` Rik van Riel
2006-08-05 15:26 ` Rajat Jain
0 siblings, 1 reply; 8+ messages in thread
From: Rik van Riel @ 2006-08-05 14:54 UTC (permalink / raw)
To: Rajat Jain; +Cc: idlisambar, kernelnewbies, Linux Newbie
Rajat Jain wrote:
> Actually I was thinking that if it is possible to perform all the Disk
> IO operations using the BIOS routines, then why can't we write a
> SINGLE disk driver that will work with all the kinds of disks.
Because that would be incredibly slow. You could only have one I/O
request in flight at a time, and the system could not run other
processes while I/O was being done.
> So all this seems like a bad idea ... or should I say TOTALLY IMPOSSIBLE?
It might be possible, but it is still a very bad idea :)
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Issuing BIOS interrupts in Linux
2006-08-05 14:54 ` Rik van Riel
@ 2006-08-05 15:26 ` Rajat Jain
2006-08-05 16:33 ` Nilesh Agrawal
0 siblings, 1 reply; 8+ messages in thread
From: Rajat Jain @ 2006-08-05 15:26 UTC (permalink / raw)
To: Rik van Riel; +Cc: idlisambar, kernelnewbies, Linux Newbie
On 8/5/06, Rik van Riel <riel@surriel.com> wrote:
> Rajat Jain wrote:
>
> > Actually I was thinking that if it is possible to perform all the Disk
> > IO operations using the BIOS routines, then why can't we write a
> > SINGLE disk driver that will work with all the kinds of disks.
>
> Because that would be incredibly slow. You could only have one I/O
> request in flight at a time, and the system could not run other
> processes while I/O was being done.
Oh ... I got you. That sure sounds like a lot of baggage, but despite
all the disadvantages you just mentioned, it will STILL be of lot of
use to me.
>
> > So all this seems like a bad idea ... or should I say TOTALLY IMPOSSIBLE?
>
> It might be possible, but it is still a very bad idea :)
Okay ... NOW we are talking. Any idea / links / references on where
should I start looking for? How tough / practical is it to switch from
protected mode to real mode and back? Is it possible at all (in
linux)?
Thanks,
Rajat
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Issuing BIOS interrupts in Linux
2006-08-05 15:26 ` Rajat Jain
@ 2006-08-05 16:33 ` Nilesh Agrawal
2006-08-09 1:50 ` David H. Lynch Jr.
0 siblings, 1 reply; 8+ messages in thread
From: Nilesh Agrawal @ 2006-08-05 16:33 UTC (permalink / raw)
To: Rajat Jain; +Cc: Rik van Riel, idlisambar, kernelnewbies, Linux Newbie
> Okay ... NOW we are talking. Any idea / links / references on where
> should I start looking for? How tough / practical is it to switch from
> protected mode to real mode and back? Is it possible at all (in
> linux)?
Paging only works in protected mode. And once paging is turned off,
all the kernel code is unusable because it is linked at PAGE_OFFSET +
something. ( 3GB + )
Disabling paging itself is not easy, let alone going to real mode
(where only 64KB memory is available ) and coming back.
Nilesh
--
And ye shall know the truth (source) and the truth shall set you free.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Issuing BIOS interrupts in Linux
2006-08-05 16:33 ` Nilesh Agrawal
@ 2006-08-09 1:50 ` David H. Lynch Jr.
2006-08-09 5:14 ` Rajat Jain
0 siblings, 1 reply; 8+ messages in thread
From: David H. Lynch Jr. @ 2006-08-09 1:50 UTC (permalink / raw)
To: Nilesh Agrawal
Cc: Rajat Jain, Rik van Riel, idlisambar, kernelnewbies, Linux Newbie
Nilesh Agrawal wrote:
>> Okay ... NOW we are talking. Any idea / links / references on where
>> should I start looking for? How tough / practical is it to switch from
>> protected mode to real mode and back? Is it possible at all (in
>> linux)?
>
> Paging only works in protected mode. And once paging is turned off,
> all the kernel code is unusable because it is linked at PAGE_OFFSET +
> something. ( 3GB + )
>
> Disabling paging itself is not easy, let alone going to real mode
> (where only 64KB memory is available ) and coming back.
on an x86 real mode has access to 1MB of memory. Not 64K.
Frequently this is quoted a 640K because the upper part of the real
mode address space may contain graphics adapters, and roms.
uClinux is now part of the distribution kernel it is intended for
systems without an MMU. But basically uClinux means linux without
paging PAGE_OFFSET = 0;
On some processors some faults must be handled in real mode.
Switching from protected mode to real mode and back may not be all
that hard. But doing something while in real mode could be extremely hard.
You can not use any Linux resource that assumes protected mode -
that means pretty much everything.
Basically you would have to get a hunk of memory you can access in
Real Mode, switch to real mode do your task switch back and copy the
results from your memory.
While you were in real mode, interrupts would probably have to be
disabled.
The x86 also has something called virtual x86 mode which might be
more useful. I do not remember all the details, but I think you could
create a linux process, that executed in virtual x86 mode,
that would execute concurrently with virtual x386 processes. That
said Linux has no builtin facilities to work with virtual x86 processes.
>
>
> Nilesh
>
>
--
Dave Lynch DLA Systems
Software Development: Embedded Linux
717.627.3770 dhlii@dlasys.net http://www.dlasys.net
fax: 1.253.369.9244 Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.
"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Issuing BIOS interrupts in Linux
2006-08-09 1:50 ` David H. Lynch Jr.
@ 2006-08-09 5:14 ` Rajat Jain
0 siblings, 0 replies; 8+ messages in thread
From: Rajat Jain @ 2006-08-09 5:14 UTC (permalink / raw)
To: dhlii; +Cc: Nilesh Agrawal, Rik van Riel, idlisambar, kernelnewbies,
Linux Newbie
Hi,
Firstly, thanks for the directions.
> uClinux is now part of the distribution kernel it is intended for
> systems without an MMU. But basically uClinux means linux without
> paging PAGE_OFFSET = 0;
I could not find IA32 / x86 compatibility explicitly mentioned on the
uClinux site. Can uClinux work only on embedded (which ACTUALLY do not
have MMU), or can it also work on x86 (which has MMU, but I'm ok with
the idea of doing away with it)?
>
> On some processors some faults must be handled in real mode.
>
> Switching from protected mode to real mode and back may not be all
> that hard. But doing something while in real mode could be extremely hard.
> You can not use any Linux resource that assumes protected mode -
> that means pretty much everything.
:-( ... That is sad.
> Basically you would have to get a hunk of memory you can access in
> Real Mode, switch to real mode do your task switch back and copy the
> results from your memory.
> While you were in real mode, interrupts would probably have to be
> disabled.
Ok. Basically my purpose is to write a minimal disk driver (that will
be independent of the disk hardware) using BIOS interrups. So if I
want to copy a sector from disk to memory, here is how I should
proceed:
1) Get hold of a memory chunk that is "usable" in real mode ( <1 mb
physical memory).
2) switch to real mode.
3) Issue BIOS interrupt (13h) that will copy the desired sector to this memory.
4) Switch back to protected mode.
5) Now copy data from this memory to the actual "usable" memory (any
memory accessible to the kernel)
Does the above seem ok?
Thanks,
Rajat
>
> The x86 also has something called virtual x86 mode which might be
> more useful. I do not remember all the details, but I think you could
> create a linux process, that executed in virtual x86 mode,
> that would execute concurrently with virtual x386 processes. That
> said Linux has no builtin facilities to work with virtual x86 processes.
> >
Thanks ... I will check it out.
Rajat
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-08-09 5:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-04 11:00 Issuing BIOS interrupts in Linux Rajat Jain
2006-08-05 1:20 ` Rahul Iyer
[not found] ` <292693080608050553x756e4276k33c5afa80f686f44@mail.gmail.com>
2006-08-05 13:11 ` Rajat Jain
2006-08-05 14:54 ` Rik van Riel
2006-08-05 15:26 ` Rajat Jain
2006-08-05 16:33 ` Nilesh Agrawal
2006-08-09 1:50 ` David H. Lynch Jr.
2006-08-09 5:14 ` Rajat Jain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox