public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: <zengshuai@sogou•com>
To: "ppc" <linuxppc-embedded@ozlabs•org>
Subject: bus error
Date: Thu, 1 Dec 2005 16:37:43 +0800 (CST)	[thread overview]
Message-ID: <13090422.1133426263198.JavaMail.postfix@mx3.mail.sohu.com> (raw)

//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

                 reply	other threads:[~2005-12-01  8:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13090422.1133426263198.JavaMail.postfix@mx3.mail.sohu.com \
    --to=zengshuai@sogou$(echo .)com \
    --cc=linuxppc-embedded@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox