Re: segmentation fault when porting to linux
- From: David Schwartz <davids@xxxxxxxxxxxxx>
- Date: Tue, 26 Feb 2008 07:37:01 -0800 (PST)
On Feb 26, 4:58 am, email7373...@xxxxxxxxxxxxxxx wrote:
I want to move to linux from DOS / Win98, and the piece of hardware
communicates this way (see snippet below).
This snippet works just fine in DOS / Win98, but in linux it fails
with a segmentation fault. Any idea how to make it work?
#include <stdio.h>
typedef unsigned long DWORD;
typedef unsigned char BYTE;
typedef unsigned short WORD;
volatile WORD *memory_word_pointer;
DWORD pmem_address = 0xD4000;
void *return_address (DWORD address)
{
return (BYTE *) address;
}
int main()
{
memory_word_pointer = (WORD *)return_address (pmem_address);
*memory_word_pointer = 0x1000;
return 1;
}
Probably the best solution is to create a proper driver, but you might
be okay just using '/dev/mem'. Type 'man 4 mem'.
DS
.
- References:
- segmentation fault when porting to linux
- From: email7373388
- segmentation fault when porting to linux
- Prev by Date: Re: Web services via httpd
- Next by Date: c++, java, cobol
- Previous by thread: segmentation fault when porting to linux
- Next by thread: Re: segmentation fault when porting to linux
- Index(es):
Relevant Pages
|