ts-7000
[Top] [All Lists]

Re: [ts-7000] Reading memory using inline assemble causes segmentation f

To:
Subject: Re: [ts-7000] Reading memory using inline assemble causes segmentation fault
From: Triffid Hunter <>
Date: Mon, 19 May 2008 20:25:53 +1000 (EST)
On Sun, 18 May 2008, carol9078 wrote:

> I'm alsot certainly missing the point, but why dows a simple memory
> read of the JP6 setting address not work and cause a segmntation fault

Protected mode. Protected mode was one of the major features of the 80386. 
It provided muliple levels (or "rings") in which code could run, each 
providing different amounts of access to memory and other peripherals. The 
linux kernel runs in ring 0 and can do whatever it likes. Userspace 
programs run in ring 3 and have a private address space into which the 
kernel maps real memory. This means that for the program to access 
arbitrary memory or I/O space, the kernel must first map those locations 
into the program's private address space.

The implementation on ARM cores such as the cirrus EP9302 is a bit 
different to this, but the concepts are the same.

To get the kernel to give you access to arbitrary memory, you must mmap() 
the /dev/mem device node. This will give you a pointer to where global 
memory is mapped into the program's private address space. Use it like a 
unsigned char array.

ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7250-linux/samples/adc_7250.c is a 
great example of how to access arbitrary memory.

Segmentation fault means that your program tried to access an address in 
its private address space that isn't mapped to anything, which is why it's 
such a common error when programming in C.


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU