Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jun 1997 21:10:45 -0400 (EDT)
From:      Chuck Robey <chuckr@glue.umd.edu>
To:        Steve Howe <un_x@anchorage.net>
Cc:        freebsd-hackers <hackers@FreeBSD.ORG>
Subject:   Re: direct access
Message-ID:  <Pine.BSF.3.96.970622210255.265I-100000@Journey2.mat.net>
In-Reply-To: <Pine.BSF.3.95q.970622153100.15540A-100000@aak.anchorage.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 22 Jun 1997, Steve Howe wrote:

> 
> i wanted to port a hex/block editor from DOS.
> 
> it can read/write 1 RAM blocks
>                   2 Port Addresses
>                   3 Hard/Floppy Drives
>                   4 Files
> 
> however, i am finding even simple things like ...
> /////////////////////////////////////////////////
> int  main           (void) {
> 
> unsigned char * p = (unsigned char *)0x000b8000;
> 
>      while ( 1 ) { printf("%c", *p++); getch(); }  return 0;
> }
> /////////////////////////////////////////////////
> where i try to read the CGA/VGA screen, bomb with
> "segmentation violation" errors.
> 
> is the kernel examining op codes on the run, or what?
> is it at all possible to write Device editors?
> at any level of coding?

Dos is a single user OS, with no protection.  Unix OSes, like FreeBSD, are
multiuser, and do not allow ordinary users to directly access any devices
directly.  Instead, the OS supervises the device, so you use things like
ioctl calls to manipulate things.

FreeBSD also has virtual memory, which means that you can run one program,
or even many programs, that are larger in size than your physical memory.
When you try to write into a particular address in memory, you are
actually having that address remapped for you into some virtual memory.
The addresses you learned from dos programming are useless here.

It really sounds like you ought to go purchase either a beginners Unix
book, or maybe an operating systems textbook, depending on where your
interests lie.  For some reason (I don't know why) I think I'd recommend
the Operating Systems textbook for you first.  It'll give you an idea how
things like virtual memory and device drivers work.  You'll get an idea
why most FreeBSD programmers think of dos as a toy OS, not a real one.

----------------------------+-----------------------------------------------
Chuck Robey                 | Interests include any kind of voice or data 
chuckr@eng.umd.edu          | communications topic, C programming, and Unix.
213 Lakeside Drive Apt T-1  |
Greenbelt, MD 20770         | I run Journey2 and picnic, both FreeBSD
(301) 220-2114              | version 3.0 current -- and great FUN!
----------------------------+-----------------------------------------------




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970622210255.265I-100000>