All of lore.kernel.org
 help / color / mirror / Atom feed
* bus error
@ 2005-12-01  8:37 zengshuai
  0 siblings, 0 replies; only message in thread
From: zengshuai @ 2005-12-01  8:37 UTC (permalink / raw)
  To: ppc

//test.c
#include <stdio.h>
#include <stdlib.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>

int main(void)
{
	static volatile char *reg_mem;
  static int axs_mem_fd = -1;
  axs_mem_fd = open("/dev/mem", O_RDWR|O_SYNC);
    if (axs_mem_fd < 0) {
        perror("AXS: can't open /dev/mem");
        return NULL;
    }
    /* memory map */
  reg_mem =(volatile char*)mmap(
      (caddr_t)reg_mem,
      0x4,
      PROT_READ|PROT_WRITE,
      MAP_SHARED,
      axs_mem_fd,
      0x04600000
  );
	if(reg_mem[0]==0x10) printf("OK");
	else printf("sorry");
}
host:
ppc_6xx-gcc -o test test.c
target:
./test
Bus error

need help,thanks

------------------------------
我现在使用Sogou.com的2G邮箱了,你也来试试吧! 
http://mail.sogou.com/recommend/sogoumail_invite_reg1.jsp?from=sogouinvitation&s_EMAIL=zengshuai%40sogou.com&username=linuxppc-embedded&FullName=linuxppc-embedded&Email=linuxppc-embedded%40ozlabs.org&verify=755eff4e640bdcfc57d93cbd8b0a9cb7

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-01  8:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-01  8:37 bus error zengshuai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.