From: Arnd Bergmann <arnd@arndb.de>
To: Guan Xuetao <guanxuetao@mprc.pku.edu.cn>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv1 04/12] unicore32 core architecture: low level entry and setup code
Date: Fri, 7 Jan 2011 01:04:57 +0100 [thread overview]
Message-ID: <201101070104.57770.arnd@arndb.de> (raw)
In-Reply-To: <00cc01cba464$16e6a410$44b3ec30$@mprc.pku.edu.cn>
On Saturday 25 December 2010, Guan Xuetao wrote:
> +#ifdef __KERNEL__
> +
> +/*
> + * Memory map description
> + */
> +# define NR_BANKS 8
> +
> +struct membank {
> + unsigned long start;
> + unsigned long size;
> + unsigned int highmem;
> +};
> +
> +struct meminfo {
> + int nr_banks;
> + struct membank bank[NR_BANKS];
> +};
> +
> +extern struct meminfo meminfo;
> +
> +#define for_each_bank(iter, mi) \
> + for (iter = 0; iter < (mi)->nr_banks; iter++)
> +
> +#define bank_pfn_start(bank) __phys_to_pfn((bank)->start)
> +#define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size)
> +#define bank_pfn_size(bank) ((bank)->size >> PAGE_SHIFT)
> +#define bank_phys_start(bank) ((bank)->start)
> +#define bank_phys_end(bank) ((bank)->start + (bank)->size)
> +#define bank_phys_size(bank) ((bank)->size)
The membank stuff looks like a variation of the generic memblock interfaces.
> +/*
> + * Handle all unrecognised system calls.
> + * 0x9f0000 - 0x9fffff are some more esoteric system calls
> + */
> +#define NR(x) ((__UNICORE_NR_##x) - __UNICORE_NR_BASE)
> +asmlinkage int uc32_syscall(int no, struct pt_regs *regs)
> +{
> + if ((no >> 16) != (__UNICORE_NR_BASE >> 16))
> + return -ENOSYS;
> +
> + switch (no & 0xffff) {
> + /*
> + * Flush a region from virtual address 'r0' to virtual address 'r1'
> + * _exclusive_. There is no alignment requirement on either address;
> + * user space does not need to know the hardware cache layout.
> + *
> + * r2 contains flags. It should ALWAYS be passed as ZERO until it
> + * is defined to be something else. For now we ignore it, but may
> + * the fires of hell burn in your belly if you break this rule. ;)
> + *
> + * (at a later date, we may want to allow this call to not flush
> + * various aspects of the cache. Passing '0' will guarantee that
> + * everything necessary gets flushed to maintain consistency in
> + * the specified region).
> + */
> + case NR(cacheflush):
> + do_cache_op(regs->UCreg_00, regs->UCreg_01, regs->UCreg_02);
> + return 0;
> +
> + case NR(cmpxchg):
> + return do_cmpxchg_op(regs);
> +
> + default:
> + return -ENOSYS;
> + }
> +}
With the generic system cal interface, this function should be replaced
with straight system calls for each of the subfunctions.
Just use things definitions like
#define __NR_cacheflush __NR_arch_specific_syscall
__SYSCALL(__NR_cacheflush, sys_uc32_cacheflush)
#define __NR_cmpxchg __NR_arch_specific_syscall+1
__SYSCALL(__NR_cmpxchg, sys_uc32_cacheflush
in your asm/unistd.h file.
Arnd
next prev parent reply other threads:[~2011-01-07 0:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-25 18:46 [PATCHv1 04/12] unicore32 core architecture: low level entry and setup code Guan Xuetao
2011-01-07 0:04 ` Arnd Bergmann [this message]
2011-01-07 0:04 ` Arnd Bergmann
2011-01-10 11:26 ` Guan Xuetao
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=201101070104.57770.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=guanxuetao@mprc.pku.edu.cn \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).