Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Programming and Minix
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Teemu Savolainen  
View profile  
 More options May 27 1998, 3:00 am
Newsgroups: comp.os.minix
From: "Teemu Savolainen" <ts...@cc.tut.nospam.fi>
Date: 1998/05/27
Subject: Programming and Minix

Is it possible to write program with CC that directly writes/reads memory
under Minix 2.0.0? I tried to find information about it on the web but I
didn't succeed.

I got old half-working 8086 for free and it had Minix installed in it. I'd
use dos/tasm for doing such programming but the floppy drive is broken and I
can't put dos to the hard disk without buying/finding working 5,25" floppy
drive. I will use that computer for experimenting - adding my home made
cards to ISA bus and so on.

Thank you for any help


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shawn Ramsey  
View profile  
 More options May 27 1998, 3:00 am
Newsgroups: comp.os.minix
From: r...@luke.cpl.net (Shawn Ramsey)
Date: 1998/05/27
Subject: Re: Programming and Minix

Teemu Savolainen (ts...@cc.tut.nospam.fi) wrote:

: Is it possible to write program with CC that directly writes/reads memory
: under Minix 2.0.0? I tried to find information about it on the web but I
: didn't succeed.

: I got old half-working 8086 for free and it had Minix installed in it. I'd
: use dos/tasm for doing such programming but the floppy drive is broken and I
: can't put dos to the hard disk without buying/finding working 5,25" floppy
: drive. I will use that computer for experimenting - adding my home made
: cards to ISA bus and so on.

: Thank you for any help

You can do it like this:

#include <sys/types.h>
#include <fcntl.h>
main()
{
        int f;
        if((f=open("/dev/mem",O_RDWR))<0){
                perror("/dev/mem");
                return 1;
        }
        /* Insert your code here. */
        return 0;

}

After opening /dev/mem you can write it like any normal file (via read(2) and
write(2)), my only question is, why? Unix-like OS's have kernels to prevent
user-space processses from doing things like this, and indeed a user process
that writes directly into system memory bypasses one of the kernel's most
important features (IMHO), separation of users from hardware. I would suggest
that if you need/want to write low-level code, you modify the kernel instead
of doing it from user-space. Although, you may want to start out with a user
process just to test your code and then hack the kernel source (that's what I
generally do if possible), this will save time, especially if you are
modifying large sections of the kernel code, since compilations are a tad on
the slow side when using the traditional processors (8086/88) thus you want to
make the large variety as infrequent as possible.

Just a thought,
        Dave


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Will Rose  
View profile  
 More options May 28 1998, 3:00 am
Newsgroups: comp.os.minix
From: c...@cts.com (Will Rose)
Date: 1998/05/28
Subject: Re: Programming and Minix

Teemu Savolainen (ts...@cc.tut.nospam.fi) wrote:

: Is it possible to write program with CC that directly writes/reads memory
: under Minix 2.0.0? I tried to find information about it on the web but I
: didn't succeed.

: I got old half-working 8086 for free and it had Minix installed in it. I'd
: use dos/tasm for doing such programming but the floppy drive is broken and I
: can't put dos to the hard disk without buying/finding working 5,25" floppy
: drive. I will use that computer for experimenting - adding my home made
: cards to ISA bus and so on.

On an 8086 it shouldn't be too difficult, since those CPUs had no
memory management functions.  A 386 would be trickier; it would
probably be simplest to write a device driver to handle the i/o.

Will
c...@crash.cts.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Al Woodhull  
View profile  
 More options May 28 1998, 3:00 am
Newsgroups: comp.os.minix
From: as...@hamp.hampshire.edu (Al Woodhull)
Date: 1998/05/28
Subject: Re: Programming and Minix

On Wed, 27 May 1998 23:42:03 +0300 Teemu Savolainen
(ts...@cc.tut.nospam.fi) wrote in comp.os.minix:

: Is it possible to write program with CC that directly writes/reads memory
: under Minix 2.0.0? I tried to find information about it on the web but I
: didn't succeed.

The Minix memory device driver, the first device driver described in
the OSDI text, provides support for this. It is described as the RAM
disk driver, but in fact in addition to /dev/ram it supports /dev/mem
and /dev/kmem.

The genius of the Unix device driver concept is that the driver makes
any device accessible as a file. So you can use standard tools that
examine files, like the Unix command od, to look at memory:
  od -hx <dev/mem | more
will dump memory in hex starting from location zero. You can also
specify an offset.

You could use the standard Unix dd command to write to memory, too. Be
careful with this! The /dev/mem and /dev/kmem devices by default are
given restricted privileges, you really don't want ordinary users
getting access. And you want to be very cautious about writing to
memory.

I have had a lot of use for tools to display contents of files and
memory in my teaching, and I never liked the formats available with
the od command, so long ago I wrote a similar program which I called
xd, which provides a hexadecimal+ascii dump by default, in a format
similar to that used by the MS-DOS debug utility. An old version of
this is available at ftp://minix1.hampshire.edu/pub/minix.1.5/misc/xd1.shar.

I have a newer version written for Minix 2.0 that I have never posted
publically, partly because I never decided what to call it. I
developed the original xd before I began to use the X-Window System,
before I realized that any command name that begins with 'x' will
immediately be assumed to be an X utility by those in the know. I
suppose I should just call it hexd and make it publically available.
I can mail the source to anyone interested.

The Minix memory drivers make all of memory (or at least up to 16M)
available in a linear address space, but the integer variables used in
od and dd probably don't support such big numbers.

Al
+----------------------------------+
| Albert S. Woodhull               |
| Hampshire College, Amherst, MA   |
| awoodh...@hampshire.edu          |
| http://minix1.hampshire.edu/asw/ |
+----------------------------------


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drayth  
View profile  
 More options Jun 2 1998, 3:00 am
Newsgroups: comp.os.minix
From: Drayth <mindsc...@usa.net>
Date: 1998/06/02
Subject: Re: Programming and Minix

Teemu Savolainen wrote:
> Is it possible to write program with CC that directly writes/reads memory
> under Minix 2.0.0? I tried to find information about it on the web but I
> didn't succeed.

> I got old half-working 8086 for free and it had Minix installed in it. I'd
> use dos/tasm for doing such programming but the floppy drive is broken and I
> can't put dos to the hard disk without buying/finding working 5,25" floppy
> drive. I will use that computer for experimenting - adding my home made
> cards to ISA bus and so on.

> Thank you for any help

  if you're actually looking for some old 5 1/4 disk drives I have a couple
lieing around and I could send them to you for a couple of bucks, I dunno
shipping costs + a bit I suppose.  However I was under the impression that they
were dirt-common.
Drayth

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »