Date: Mon, 23 Jun 1997 11:39:07 +0930 (CST) From: Michael Smith <msmith@atrad.adelaide.edu.au> To: un_x@anchorage.net (Steve Howe) Cc: hackers@FreeBSD.ORG Subject: Re: direct access Message-ID: <199706230209.LAA14132@genesis.atrad.adelaide.edu.au> In-Reply-To: <Pine.BSF.3.95q.970622153100.15540A-100000@aak.anchorage.net> from Steve Howe at "Jun 22, 97 03:43:36 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
Steve Howe stands accused of saying: > > i wanted to port a hex/block editor from DOS. This is not a very useful thing to do. There are several quite good hex editors already in the ports collection. I use 'beav' more often than not. > it can read/write 1 RAM blocks > 2 Port Addresses > 3 Hard/Floppy Drives > 4 Files A user process on any Unix system cannot easily edit 1, 2 or 3. > > 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? No. You need to come to grips with the difference between physical and virtual addressing. Your process runs in a "virtual" address space, where the virtual address 0x000b8000 may be mapped to some physical address (but probably isn't). You cannot directly access the physical address 0x000b8000. This virtual:physical mapping provides numerous benefits - processes can be moved around in memory with impunity simply by changing their mappings and copying the physical pages. The mapping process also allows for virtual addresses not to be mapped to a physical address, and when an access occurs, the kernel catches the trap and can take such steps as copying the page in from disk, or performing a mapping as required. > is it at all possible to write Device editors? What is a "device editor"? You don't want to edit display memory; that will make the console driver unhappy. With the appropriate level of privilege you can use a binary editor on the disk devices in /dev and thus edit raw disk data. "editing" device ports doesn't seem to be terribly useful to me. -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199706230209.LAA14132>