17 Commits

Author SHA1 Message Date
Sebastian Sumpf
fee18b6ea0 FOC/L4RE: Add license 2013-08-09 12:22:25 +02:00
Sebastian Sumpf
71757e650a FOC: Enable caches 2013-02-14 16:55:10 +01:00
Sebastian Sumpf
3f42399fbb FOC: Basic Arndale multi-core support
Second CPU is up and receives timer interrupts. Caches are still disabled.
2013-02-14 16:55:10 +01:00
Sebastian Sumpf
64302baeb6 FOC: Arndale single core support
Stage2, GIC, timer, UART, FPU running on single core.
2013-02-14 16:55:10 +01:00
Sebastian Sumpf
3044dc5c46 FOC: Arndale bootstrapping
Added 'exynos5' bsp, enabled MMU and UART, disabled caches.
2013-02-14 16:54:56 +01:00
Sebastian Sumpf
3ba6b97b55 FOC: Make PandaBoard compile
Fix multiple definition of 'init_errata_workarounds'
2013-02-14 16:53:38 +01:00
Sebastian Sumpf
ea4330b9d6 L4RE: Arndale boostraping finished 2013-02-14 16:53:38 +01:00
Sebastian Sumpf
42242535ba L4RE: Add Arndale platform 2013-02-14 16:53:38 +01:00
Sebastian Sumpf
6603c804d9 Sigma0: raise sigma0's priority to maximum.
When sigma0 runs on a lower priority than the rest of the threads in the system
it might come to the point that while answering a page fault or I/O memory area
request the timeslice of the caller (core-pager) gets fully consumed. As long as
other threads are still executable and don't block sigma0 won't do progress
anymore, because it runs at the lowest priority.  This commit simply sets
sigma0's priority to the highest in the system.

Was: 'sigma0_prio.patch'
2013-02-14 16:53:37 +01:00
Sebastian Sumpf
a7566c95df Fiasco.OC: fix io-port fault answer in sigma0
In sigma0 normally no answer tag to a request/fault is created. It
simply uses the message tag received with the request. This doesn't work out
when I/O ports are requested. This patch constructs an appropriate answer tag.
Moreover, we have to enable I/O port protection in the kernel configuration.

Was: 'sigma0_ioport.patch'
2013-02-14 16:53:37 +01:00
Sebastian Sumpf
6d3331e788 JBD: Increase name buffer to 32K
Increase the size of the JDB kernel object names buffer. The original size was
too small for some Genode scenarios and caused missing thread names in the
kernel debugger thread list.

Was: 'jdb_kobject_names.patch'
2013-02-14 16:53:37 +01:00
Sebastian Sumpf
8a02631f81 i.MX53 support
Was: 'imx53_support.patch'
2013-02-14 16:53:37 +01:00
Sebastian Sumpf
4933450b2e X86: Single stepping
This patch enables the user land to use the CPU's single stepping mode on
x86_32 platforms. It is needed to enable the use of GDB monitor for
user-level debugging.

Was: 'foc_single_step_x86.patch'
2013-01-14 15:07:35 +01:00
Sebastian Sumpf
43ce877011 Ex_regs: Change 'user_flags'
Return true if thread is ready.

Was: 'foc_exregs_ret_state.patch'
2013-01-14 12:23:22 +01:00
Sebastian Sumpf
b0654efce6 Caps: fix l4_task_cap_equal semantic.
The syscall l4_task_cap_equal almost returns false although the referenced
kernel-objects are equal. This patch changes the semantic of the syscall so that
whenever two capabilities refering the same kernel-object are compared it will
return true. Please refer to the discussion of the following mail thread:
http://www.mail-archive.com/l4-hackers@os.inf.tu-dresden.de/msg05162.html

Was 'foc_caps_equal.patch'
2013-01-14 12:23:22 +01:00
Sebastian Sumpf
5395a1e1e7 ARM: Errata 743622
Restrict the appliance of ERRATA 743622 to CPU revisions: r2p0-r2p2.

Was 'foc_arm_errata.patch'
2013-01-14 12:23:22 +01:00
Sebastian Sumpf
c375d9b1a4 GDB monitor: Check for ARM breakpoint IP
Performed in 'slow_trapentry'. Was 'fix_exception_ip.patch'.
2013-01-14 12:19:38 +01:00
48 changed files with 1042 additions and 72 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
*~
*.orig
*.swp
*.rej

349
COPYING-GPL-2 Normal file
View File

@@ -0,0 +1,349 @@
NOTE! This License shall not affect user programs that use the micro-kernel
API to invoke kernel-operations or services provided in other address
spaces - this is merely considered normal use of the kernel or
accompanying user-level services, and does not fall under the heading of
"derivative work".
-----------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -85,7 +85,7 @@ config ABI_VF
config PF_ARM_MP_CAPABLE
bool
default y if ARM_MPCORE || ARM_CORTEX_A9
default y if ARM_MPCORE || ARM_CORTEX_A9 || ARM_CORTEX_A15
config CAN_ARM_CPU_SA1100
bool
@@ -114,6 +114,9 @@ config CAN_ARM_CPU_CORTEX_A8
config CAN_ARM_CPU_CORTEX_A9
bool
config CAN_ARM_CPU_CORTEX_A15
bool
config CAN_ARM_CACHE_L2CXX0
bool
@@ -161,6 +164,10 @@ config ARM_CORTEX_A9
bool "ARM Cortex-A9 CPU"
depends on CAN_ARM_CPU_CORTEX_A9
config ARM_CORTEX_A15
bool "ARM Cortex-A15 CPU"
depends on CAN_ARM_CPU_CORTEX_A15
config IA32_486
bool "Intel 80486"
depends on IA32
@@ -676,6 +683,14 @@ config POWERSAVE_GETCHAR
prevent some P4 processors from being overheated. This option
requires a working timer IRQ to wakeup getchar periodically.
config USER_SINGLE_STEP
bool "Enable user level single stepping support"
depends on IA32
default n
help
This option enables single stepping of user level applications outside of
JDB.
choice
prompt "Warn levels"
default WARN_WARNING
@@ -755,7 +770,7 @@ config ARM_V6
def_bool y if ARM_1136 || ARM_1176 || ARM_MPCORE
config ARM_V7
def_bool y if ARM_CORTEX_A8 || ARM_CORTEX_A9
def_bool y if ARM_CORTEX_A8 || ARM_CORTEX_A9 || ARM_CORTEX_A15
config ARM_V6PLUS
def_bool y if ARM_V6 || ARM_V7

View File

@@ -29,6 +29,7 @@ PREPROCESS_PARTS-$(CONFIG_ARM_1176) += arm1176
PREPROCESS_PARTS-$(CONFIG_ARM_MPCORE) += mpcore
PREPROCESS_PARTS-$(CONFIG_ARM_CORTEX_A8) += armca8
PREPROCESS_PARTS-$(CONFIG_ARM_CORTEX_A9) += armca9
PREPROCESS_PARTS-$(CONFIG_ARM_CORTEX_A15) += armca15
PREPROCESS_PARTS-$(CONFIG_ARM_TZ) += tz
PREPROCESS_PARTS-$(CONFIG_ARM_1176_CACHE_ALIAS_FIX) += arm1176_cache_alias_fix
PREPROCESS_PARTS-$(CONFIG_ARM_CPU_ERRATA) += arm_cpu_errata

View File

@@ -171,7 +171,7 @@ FIASCO_NOINLINE void Mmu<Flush_area, Ram>::inv_dcache(void const *start, void co
}
//-----------------------------------------------------------------------------
IMPLEMENTATION [arm && (mpcore || arm1136 || arm1176 || armca8 || armca9)]:
IMPLEMENTATION [arm && (mpcore || arm1136 || arm1176 || armca8 || armca9 || armca15)]:
IMPLEMENT inline
template< unsigned long Flush_area, bool Ram >
@@ -303,7 +303,7 @@ void Mmu<Flush_area, Ram>::flush_dcache()
//-----------------------------------------------------------------------------
INTERFACE [arm && (armca8 || armca9)]:
INTERFACE [arm && (armca8 || armca9 || armca15)]:
EXTENSION class Mmu
{
@@ -344,7 +344,7 @@ EXTENSION class Mmu
};
//-----------------------------------------------------------------------------
INTERFACE [arm && armca9]:
INTERFACE [arm && (armca9 || armca15)]:
EXTENSION class Mmu
{
@@ -362,7 +362,7 @@ EXTENSION class Mmu
};
//-----------------------------------------
IMPLEMENTATION [arm && (armca8 || armca9)]:
IMPLEMENTATION [arm && (armca8 || armca9 || armca15)]:
PRIVATE
template< unsigned long Flush_area, bool Ram >

View File

@@ -222,7 +222,7 @@ void Proc::halt()
}
//----------------------------------------------------------------
IMPLEMENTATION[arm && (armca8 || armca9)]:
IMPLEMENTATION[arm && (armca8 || armca9 || armca15)]:
IMPLEMENT static inline
void Proc::pause()

View File

@@ -43,7 +43,7 @@ IMPLEMENTATION:
enum
{
Name_buffer_size = 8192,
Name_buffer_size = 4*8192,
Name_entries = Name_buffer_size / sizeof(Jdb_kobject_name),
};

View File

@@ -25,7 +25,7 @@ set_asid()
{}
//---------------------------------------------------------------------------
IMPLEMENTATION [arm && armv6plus && (mpcore || armca9)]:
IMPLEMENTATION [arm && armv6plus && (mpcore || armca9 || armca15)]:
enum
{
@@ -33,7 +33,7 @@ enum
};
//---------------------------------------------------------------------------
IMPLEMENTATION [arm && armv6plus && !(mpcore || armca9)]:
IMPLEMENTATION [arm && armv6plus && !(mpcore || armca9 || armca15)]:
enum
{
@@ -80,6 +80,19 @@ IMPLEMENTATION [arm && !arm1176_cache_alias_fix]:
static void do_arm_1176_cache_alias_workaround() {}
//---------------------------------------------------------------------------
IMPLEMENTATION [arm && exynos5_arndale]:
static inline void supervisor_mode()
{
asm volatile ("cps #19");
}
//---------------------------------------------------------------------------
IMPLEMENTATION [arm && !exynos5_arndale]:
static inline void supervisor_mode() { }
//---------------------------------------------------------------------------
IMPLEMENTATION [arm]:
@@ -145,6 +158,8 @@ extern "C" void bootstrap_main()
extern char kernel_page_directory[];
void *const page_dir = kernel_page_directory + Virt_ofs;
supervisor_mode();
Address va, pa;
// map sdram linear from 0xf0000000
for (va = Mem_layout::Map_base, pa = Mem_layout::Sdram_phys_base;

View File

@@ -0,0 +1,15 @@
# PF: EXYNOS5
# PFDESCR: Samsung Exynos5
# PFDEPENDS: ARM
choice
prompt "Exynos5 Platform"
default PF_EXYNOS5_ARNDALE
config PF_EXYNOS5_ARNDALE
bool "Samsung Arndale"
depends on PF_EXYNOS5
select CAN_ARM_CPU_CORTEX_A15
help
Choose for Arndale board platform.
endchoice

View File

@@ -0,0 +1,25 @@
# vim:set ft=make:
SUBSYSTEMS += LIBUART
OBJECTS_LIBUART += uart_s3c2410.o
PREPROCESS_PARTS += exynos5 libuart
PREPROCESS_PARTS += $(if $(CONFIG_PF_EXYNOS5_ARNDALE), exynos5_arndale pic_gic)
CONFIG_KERNEL_LOAD_ADDR := 0x40000000
#no memory mapped SCU on exynos5
MPCORE_PHYS_BASE := 0x0
INTERFACES_KERNEL+= $(if $(CONFIG_PF_EXYNOS5_ARNDALE),gic)
bootstrap_IMPL += bootstrap-arm-exynos5
clock_IMPL += clock-generic
config_IMPL += config-arm-exynos5
kernel_uart_IMPL += kernel_uart-arm-exynos5
mem_layout_IMPL += mem_layout-arm-exynos5
pic_IMPL += pic-gic pic-arm-gic-exynos5
platform_control_IMPL += platform_control-arm-exynos5
reset_IMPL += reset-arm-exynos5
timer_IMPL += timer-arm-exynos5
timer_tick_IMPL += timer_tick-multi-vector
uart_IMPL += uart-arm-exynos5
warn_IMPL += warn warn-exynos5

View File

@@ -0,0 +1,20 @@
INTERFACE [arm && exynos5]:
enum {
Cache_flush_area = 0,
};
IMPLEMENTATION [arm && exynos5]:
#include "mem_layout.h"
#include "io.h"
void
map_hw(void *pd)
{
map_dev<Mem_layout::Devices1_phys_base>(pd, 1);
map_dev<Mem_layout::Devices2_phys_base>(pd, 2);
map_dev<Mem_layout::Devices3_phys_base>(pd, 3);
map_dev<Mem_layout::Devices4_phys_base>(pd, 4);
map_dev<Mem_layout::Devices5_phys_base>(pd, 5);
}

View File

@@ -0,0 +1,3 @@
INTERFACE[arm && exynos5_arndale]: //-----------------------------------------
#define TARGET_NAME "ArndaleBoard"

View File

@@ -0,0 +1,12 @@
INTERFACE:
// On ARM the MMIO for the uart is accessible before the MMU is fully up
EXTENSION class Kernel_uart { enum { Bsp_init_mode = Init_before_mmu }; };
IMPLEMENTATION [arm && exynos5 && serial]:
IMPLEMENT
bool Kernel_uart::startup(unsigned, int)
{
return Uart::startup();
}

View File

@@ -0,0 +1,32 @@
INTERFACE [arm && exynos5]:
EXTENSION class Mem_layout
{
public:
enum Phys_layout_exynos5 : Address {
Devices1_phys_base = 0x10000000,
Devices2_phys_base = 0x12c00000,
Devices3_phys_base = 0x10400000,
Devices4_phys_base = 0x12d00000,
Devices5_phys_base = 0x02000000,
};
enum Virt_layout_exynos5 : Address {
Uart2_map_base = Devices2_map_base + 0x20000,
};
};
INTERFACE [arm && exynos5_arndale]:
EXTENSION class Mem_layout
{
public:
enum Virt_layout_exynos5_arndale : Address {
Uart_base = Uart2_map_base,
Sdram_phys_base = 0x40000000,
Gic_cpu_map_base = Devices3_map_base + 0x82000,
Gic_dist_map_base = Devices3_map_base + 0x81000,
Timer_map_base = Devices4_map_base + 0xd0000,
};
};

View File

@@ -0,0 +1,39 @@
INTERFACE [arm && pic_gic exynos5]:
#include "gic.h"
IMPLEMENTATION [arm && pic_gic exynos5]:
#include "irq_mgr_multi_chip.h"
#include "kmem.h"
IMPLEMENT FIASCO_INIT
void
Pic::init()
{
typedef Irq_mgr_multi_chip<8> M;
M *m = new Boot_object<M>(16);
gic.construct(Kmem::Gic_cpu_map_base, Kmem::Gic_dist_map_base);
m->add_chip(0, gic, gic->nr_irqs());
Irq_mgr::mgr = m;
}
IMPLEMENT inline
Pic::Status Pic::disable_all_save()
{ return 0; }
IMPLEMENT inline
void Pic::restore_all(Status)
{}
// ------------------------------------------------------------------------
IMPLEMENTATION [arm && mp && pic_gic && exynos5]:
PUBLIC static
void Pic::init_ap(unsigned)
{
gic->init_ap();
}

View File

@@ -0,0 +1,22 @@
INTERFACE [arm && mp && exynos5]:
#include "types.h"
IMPLEMENTATION [arm && mp && exynos5]:
#include "io.h"
#include "kmem.h"
#include "stdio.h"
PUBLIC static
void
Platform_control::boot_ap_cpus(Address phys_tramp_mp_addr)
{
// Write start address to iRam base (0x2020000). This is checked by the app
// cpus wihtin an wfe (wait-for event) loop.
Io::write<Mword>(phys_tramp_mp_addr, Kmem::Devices5_map_base + 0x20000);
// wake-up cpus
asm volatile("dsb; sev" : : : "memory");
}

View File

@@ -0,0 +1,15 @@
IMPLEMENTATION [arm && exynos5]:
#include "io.h"
#include "kmem.h"
void __attribute__ ((noreturn))
platform_reset(void)
{
enum { PRM_RSTCTRL = Kmem::Devices1_map_base + 0x40400 };
Io::write<Mword>(1, PRM_RSTCTRL);
for (;;)
;
}

View File

@@ -0,0 +1,88 @@
INTERFACE [arm & exynos5]:
#include "kmem.h"
#include "processor.h"
EXTENSION class Timer
{
public:
enum {
BASE = Kmem::Timer_map_base,
CFG0 = BASE,
CFG1 = BASE + 0x4,
TCON = BASE + 0x8,
TCNTB0 = BASE + 0xc,
TCMPB0 = BASE + 0x10,
TINT_STAT = BASE + 0x44,
ONE_MS = 33000, /* HZ */
};
static unsigned irq() { return 68 + Proc::cpu_id(); }
};
IMPLEMENTATION [arm && exynos5]:
#include "cpu.h"
#include "io.h"
#include "irq_mgr.h"
#include "mmu.h"
IMPLEMENT inline
void
Timer::update_one_shot(Unsigned64 wakeup)
{
(void)wakeup;
}
static inline
Mword
tcon_to_timer(Mword val, unsigned cpu_id)
{
return cpu_id == 0 ? val : (val << (4 + (4 * cpu_id)));
}
IMPLEMENT
void Timer::init(unsigned)
{
unsigned cpu_id = Proc::cpu_id();
if (Cpu::boot_cpu()->phys_id() == cpu_id)
{
// prescaler to one
Io::write<Mword>(0x101, CFG0);
// divider to 1
Io::write<Mword>(0x0, CFG1);
}
// program 1ms
Mword offset = 0xc * cpu_id;
Io::write<Mword>(ONE_MS, TCNTB0 + offset);
Io::write<Mword>(0x0, TCMPB0 + offset);
// enable IRQ
Io::set<Mword>(0x1 << cpu_id, TINT_STAT);
// load and start timer in invterval mode
Mword tcon = Io::read<Mword>(TCON);
Io::write<Mword>(tcon | tcon_to_timer(0xa, cpu_id), TCON);
Io::write<Mword>(tcon | tcon_to_timer(0x9, cpu_id), TCON);
// route IRQ to this CPU
Irq_mgr::mgr->set_cpu(irq(), cpu_id);
}
IMPLEMENT inline NEEDS["config.h", "kip.h"]
Unsigned64
Timer::system_clock()
{
if (Config::Scheduler_one_shot)
return 0;
else
return Kip::k()->clock;
}
PUBLIC static inline NEEDS["io.h"]
void Timer::acknowledge()
{
Mword stat = Io::read<Mword>(TINT_STAT);
Io::write<Mword>(stat & (0x1f | (0x20 << Proc::cpu_id())), TINT_STAT);
}

View File

@@ -0,0 +1,16 @@
IMPLEMENTATION [arm && exynos5]: // ------------------------------
IMPLEMENT int Uart::irq() const { return 32 + 53; }
IMPLEMENTATION: // --------------------------------------------------------
#include "mem_layout.h"
#include "uart_s3c2410.h"
IMPLEMENT Address Uart::base() const { return Mem_layout::Uart_base; }
IMPLEMENT L4::Uart *Uart::uart()
{
static L4::Uart_s5pv210 uart;
return &uart;
}

View File

@@ -0,0 +1,5 @@
INTERFACE [exynos5]:
#include "panic.h"
#define NOT_IMPL WARN "%s not implemented", __PRETTY_FUNCTION__
#define NOT_IMPL_PANIC panic("%s not implemented (from %p)\n", __PRETTY_FUNCTION__, __builtin_return_address((0)));

View File

@@ -43,6 +43,13 @@ config PF_IMX_6
help
Choose for i.MX6 platform.
config PF_IMX_53
bool "i.MX53"
depends on PF_IMX
select CAN_ARM_CPU_CORTEX_A8
help
Choose for i.MX53
endchoice
config PF_IMX_RAM_PHYS_BASE
@@ -50,4 +57,5 @@ config PF_IMX_RAM_PHYS_BASE
default 0xc0000000 if PF_IMX_21
default 0x80000000 if PF_IMX_35
default 0x90000000 if PF_IMX_51
default 0x10000000 if PF_IMX_6
default 0x70000000 if PF_IMX_53
default 0x10000000 if PF_IMX_6

View File

@@ -9,10 +9,12 @@ PREPROCESS_PARTS += $(if $(CONFIG_PF_IMX_51),imx51 imx_epit \
pic_gic pic_gic_mxc_tzic)
PREPROCESS_PARTS += $(if $(CONFIG_PF_IMX_53),imx53 imx_epit \
pic_gic pic_gic_mxc_tzic)
PREPROCESS_PARTS += $(if $(CONFIG_PF_IMX_6),imx6 pic_gic mptimer)
CONFIG_KERNEL_LOAD_ADDR := $(CONFIG_PF_IMX_RAM_PHYS_BASE)
INTERFACES_KERNEL += $(if $(CONFIG_PF_IMX_51),gic)
INTERFACES_KERNEL += $(if $(CONFIG_PF_IMX_53),gic)
INTERFACES_KERNEL += $(if $(CONFIG_PF_IMX_6),gic)
MPCORE_PHYS_BASE := 0x00a00000
@@ -24,6 +26,7 @@ pic_IMPL += $(if $(CONFIG_PF_IMX_35),pic-arm-imx)
pic_IMPL += $(if $(CONFIG_PF_IMX_51),pic-gic pic-arm-imx51)
pic_IMPL += $(if $(CONFIG_PF_IMX_53),pic-gic pic-arm-imx51)
pic_IMPL += $(if $(CONFIG_PF_IMX_6),pic-gic pic-arm-imx51)
bootstrap_IMPL += bootstrap-arm-imx
timer_IMPL += $(if $(CONFIG_PF_IMX_21),timer-arm-imx21)
timer_IMPL += $(if $(CONFIG_PF_IMX_35),timer-arm-imx_epit)

View File

@@ -118,3 +118,4 @@ public:
Devices3_phys_base = 0x02100000,
};
};

View File

@@ -139,10 +139,19 @@ EXTENSION class Cpu
{
public:
enum {
Cp15_c1_sw = 1 << 10,
Cp15_c1_ha = 1 << 17,
Cp15_c1_ee = 1 << 25,
Cp15_c1_nmfi = 1 << 27,
};
};
INTERFACE [arm && armv7 && (armca9 || armca15)]:
EXTENSION class Cpu
{
public:
enum {
Cp15_c1_sw = 1 << 10,
Cp15_c1_ee = 1 << 25,
Cp15_c1_te = 1 << 30,
Cp15_c1_rao_sbop = (0xf << 3) | (1 << 16) | (1 << 18) | (1 << 22) | (1 << 23),
@@ -300,7 +309,44 @@ Cpu::early_init_platform()
}
//---------------------------------------------------------------------------
IMPLEMENTATION [arm && !(mpcore || armca9)]:
IMPLEMENTATION [arm && armca15]:
PRIVATE static inline void
Cpu::early_init_platform()
{
Io::write<Mword>(Io::read<Mword>(Mem_layout::Gic_cpu_map_base + 0) | 1,
Mem_layout::Gic_cpu_map_base + 0);
Io::write<Mword>(Io::read<Mword>(Mem_layout::Gic_dist_map_base + 0) | 1,
Mem_layout::Gic_dist_map_base + 0);
Mem_unit::clean_dcache();
enable_smp();
}
//---------------------------------------------------------------------------
IMPLEMENTATION [arm && mp && (mpcore || armca9)]:
PUBLIC static inline NEEDS["mem_layout.h", "io.h"]
int
Cpu::num_cpus()
{
return (Io::read<Mword>(Mem_layout::Mp_scu_map_base + 4) & 3) + 1;
}
//---------------------------------------------------------------------------
IMPLEMENTATION [arm && mp && armca15]:
PUBLIC static inline int
Cpu::num_cpus()
{
unsigned num;
asm volatile ("mrc p15, 1, %0, c9, c0, 2" : "=r"(num));
return ((num >> 24) & 0x3)+ 1;
}
//---------------------------------------------------------------------------
IMPLEMENTATION [arm && !(mpcore || armca9 || armca15)]:
PRIVATE static inline void Cpu::early_init_platform()
{}
@@ -501,13 +547,13 @@ Cpu::id_init()
}
//---------------------------------------------------------------------------
IMPLEMENTATION [!arm_cpu_errata || !armv6plus]:
IMPLEMENTATION [!arm_cpu_errata || !armv6plus || omap4_pandaboard]:
PRIVATE static inline
void Cpu::init_errata_workarounds() {}
//---------------------------------------------------------------------------
IMPLEMENTATION [arm_cpu_errata && armv6plus]:
IMPLEMENTATION [arm_cpu_errata && armv6plus && !omap4_pandaboard]:
PRIVATE static inline
void
@@ -562,8 +608,8 @@ Cpu::init_errata_workarounds()
if (rev == 0x20 || rev == 0x21 || rev == 0x22)
set_c15_c0_1((1 << 12) | (1 << 22));
// errata: 743622
if ((rev & 0xf0) == 0x20)
// errata: 743622 (r2p0 - r2p2)
if ((rev & 0xf0) == 0x20 && (rev & 0xf) < 0x3)
set_c15_c0_1(1 << 6);
// errata: 751472

View File

@@ -78,6 +78,7 @@ Fpu::copro_enable()
"mcr p15, 0, %0, c1, c0, 2\n"
: : "r" (0), "I" (0x00f00000));
Mem::dsb();
Mem::isb();
}
// ------------------------------------------------------------------------

View File

@@ -45,9 +45,9 @@ Kernel_thread::boot_app_cpus()
extern volatile Mword _tramp_mp_startup_pdbr;
extern volatile Mword _tramp_mp_start_dcr;
unsigned num_ap_cpus = (Io::read<Mword>(Mem_layout::Mp_scu_map_base + 4) & 3);
unsigned num_ap_cpus = Cpu::num_cpus();
printf("Number of CPUs: %d\n", num_ap_cpus + 1);
printf("Number of CPUs: %d\n", num_ap_cpus);
_tramp_mp_startup_cp15_c1 = Config::Cache_enabled
? Cpu::Cp15_c1_cache_enabled : Cpu::Cp15_c1_cache_disabled;

View File

@@ -477,7 +477,7 @@ Mem_space::next_asid(unsigned cpu)
}
//----------------------------------------------------------------------------
IMPLEMENTATION [armv7 && armca9]:
IMPLEMENTATION [armv7 && (armca9 || armca15)]:
PRIVATE inline static
unsigned long

View File

@@ -42,7 +42,7 @@ public:
};
//---------------------------------------------------------------------------
INTERFACE[arm && !(mpcore || armca9)]:
INTERFACE[arm && !(mpcore || armca9 || armca15)]:
EXTENSION class Mem_page_attr
{
@@ -59,7 +59,7 @@ public:
};
//---------------------------------------------------------------------------
INTERFACE[arm && (mpcore || armca9)]:
INTERFACE[arm && (mpcore || armca9 || armca15)]:
EXTENSION class Mem_page_attr
{
@@ -78,7 +78,7 @@ public:
};
//---------------------------------------------------------------------------
INTERFACE[arm && armca9]:
INTERFACE[arm && (armca9 || armca15)]:
EXTENSION class Page_table
{
@@ -477,7 +477,7 @@ void Page_table::activate(unsigned long asid)
}
//-----------------------------------------------------------------------------
IMPLEMENTATION [armv7 && armca9]:
IMPLEMENTATION [armv7 && (armca9 || armca15)]:
PUBLIC
void Page_table::activate(unsigned long asid)

View File

@@ -11,7 +11,7 @@ public:
};
// ------------------------------------------------------------------------
INTERFACE [arm && perf_cnt && !(mpcore || armca8 || armca9)]:
INTERFACE [arm && perf_cnt && !(mpcore || armca8 || armca9 || armca15)]:
EXTENSION class Perf_cnt
{
@@ -81,7 +81,7 @@ private:
};
// ------------------------------------------------------------------------
INTERFACE [arm && perf_cnt && (armca8 || armca9)]:
INTERFACE [arm && perf_cnt && (armca8 || armca9 || armca15)]:
EXTENSION class Perf_cnt
{
@@ -184,7 +184,7 @@ private:
};
// ------------------------------------------------------------------------
INTERFACE [arm && perf_cnt && armca9]:
INTERFACE [arm && perf_cnt && (armca9 || armca15)]:
EXTENSION class Perf_cnt
{
@@ -199,7 +199,7 @@ private:
IMPLEMENTATION [arm && perf_cnt]:
// ------------------------------------------------------------------------
IMPLEMENTATION [arm && perf_cnt && !(mpcore || armca8 || armca9)]:
IMPLEMENTATION [arm && perf_cnt && !(mpcore || armca8 || armca9 || armca15)]:
char const *Perf_cnt::perf_type_str = "none";
@@ -284,7 +284,7 @@ Perf_cnt::mon_event_type(int nr)
{ return Io::read<unsigned char>(mon_event_type_addr(nr)); }
// ------------------------------------------------------------------------
IMPLEMENTATION [arm && perf_cnt && (armca8 || armca9)]:
IMPLEMENTATION [arm && perf_cnt && (armca8 || armca9 || armca15)]:
#include "cpu.h"

View File

@@ -65,4 +65,5 @@ Startup::stage2()
Timer::init(0);
Kern_lib_page::init();
Utcb_init::init();
puts("Startup::stage2 finished");
}

View File

@@ -315,6 +315,10 @@ extern "C" {
if (handle_copro_fault[copro](opcode, ts))
return;
}
/* check for ARM default GDB breakpoint */
if (!(ts->psr & Proc::Status_thumb) && opcode == 0xe7ffdefe)
ts->pc -= 4;
}
undef_insn:
@@ -414,7 +418,7 @@ Thread::user_ip() const
IMPLEMENT inline
Mword
Thread::user_flags() const
{ return 0; }
{ return state() & Thread_ready; }
IMPLEMENT inline NEEDS[Thread::exception_triggered]
void
@@ -613,6 +617,10 @@ Thread::condition_valid(Unsigned32 insn, Unsigned32 psr)
return (v[insn >> 28] >> (psr >> 28)) & 1;
}
IMPLEMENT inline
void Thread::user_single_step(bool)
{}
// ------------------------------------------------------------------------
IMPLEMENTATION [arm && armv6plus]:

View File

@@ -5,35 +5,56 @@
.p2align 12
#ifdef CONFIG_ARM_V7
/* See cache_func_gen.cpp */
.global v7_invalidate_l1
invalidate_l1_v7:
/* Directly taken from the ARMV7 manual section 'Performing cache
maintenance operations' */
.global v7_invalidate_dcache
v7_invalidate_dcache:
mrc p15, 1, r0, c0, c0, 1 @Read CLIDR into R0
ands r3, r0, #0x07000000
mov r3, r3, lsr #23 @ Cache level value (naturally aligned)
beq finished
mov r10, #0
loop1:
add r2, r10, r10, lsr #1 @ Work out 3 x cachelevel
mov r1, r0, lsr r2 @ bottom 3 bits are the Cache type for this level
and r1, r1, #7 @ get those 3 bits alone
cmp r1, #2
blt skip @ no cache or only instruction cache at this level
mcr p15, 2, r10, c0, c0, 0 @ write csselr from r10
isb @ ISB to sync the change to the CCSIDR
mrc p15, 1, r1, c0, c0, 0 @ read current CCSIDR to R1
and r2, r1, #7 @ extract the line length field
add r2, r2, #4 @ add 4 for the line length offset (log2 16 bytes)
ldr r4, =0x3ff
ands r4, r4, r1, lsr #3 @ R4 is the max number on the way size (right aligned)
clz r5, r4 @ R5 is the bit position of the way size increment
mov r9, r4 @ R9 working copy of the max way size (right aligned)
loop2:
ldr r7, =0x00007fff
ands r7, r7, r1, lsr #13 @ R7 is the max number of the index size (right aligned)
loop3:
orr r11, r10, r9, lsl r5 @ factor in the way number and cache number into R11
orr r11, r11, r7, lsl r2 @ factor in the index number
mcr p15, 0, r11, c7, c14, 2 @ dccsw, clean/invalidate by set/way
subs r7, r7, #1 @ decrement the index
bge loop3
subs r9, r9, #1 @ decrement the way number
bge loop2
skip:
add r10, r10, #2 @ increment the cache number
cmp r3, r10
bgt loop1
mov r3, #0
mcr p15, 2, r3, c0, c0, 0
mrc p15, 1, r2, c0, c0, 0
mov r3, r2, lsr #3
mov r0, r2, lsr #13
mov r3, r3, asl #22
mov r3, r3, lsr #22
and r2, r2, #7
mov r0, r0, asl #17
add ip, r2, #4
mov r0, r0, lsr #17
mov r2, r3
clz r3, r3
.L3:
mov r4, r2, asl r3
mov r1, r0
.L2:
orr r5, r4, r1, asl ip
mcr p15, 0, r5, c7, c6, 2
subs r1, r1, #1
bcs .L2
subs r2, r2, #1
bcs .L3
isb
dsb
mov pc, lr
isb
finished:
mov pc, lr
#endif
.global _tramp_mp_entry
@@ -44,14 +65,16 @@ _tramp_mp_entry:
msr cpsr_c, r0
// enable SMP
#ifndef CONFIG_ARM_CORTEX_A15
adr r0, .Lmpcore_phys_base
ldr r0, [r0]
ldr r1, [r0]
orr r1, #1
str r1, [r0]
#endif
#ifdef CONFIG_ARM_V7
bl invalidate_l1_v7
bl v7_invalidate_dcache
#endif
mcr p15, 0, r0, c7, c5, 0 // ICIALLU
@@ -65,7 +88,7 @@ _tramp_mp_entry:
#ifdef CONFIG_ARM_V7
// ACTRL is implementation defined
mrc p15, 0, r0, c0, c0, 0 // read MIDR
adr r3, .Lactrl_cpuid_a9 // load addr
adr r3, .Lactrl_cpuid // load addr
ldm r3, {r1,r2} // load mask + val
and r0, r1 // apply mask
teq r0, r2 // check value
@@ -73,9 +96,11 @@ _tramp_mp_entry:
#endif
mrc p15, 0, r0, c1, c0, 1
#ifdef CONFIG_ARM_V7
tst r0, #0x40
bne 2f
#ifdef CONFIG_ARM_CORTEX_A15
orr r0, r0, #0x40
#elif defined CONFIG_ARM_V7
tst r0, #0x40
bne 2f
orr r0, r0, #0x41
#else
orr r0, r0, #0x20
@@ -114,10 +139,20 @@ _tramp_mp_entry:
.Lmpcore_phys_base:
.long MPCORE_PHYS_BASE
// only one currently
.Lactrl_cpuid_a9:
#ifdef CONFIG_ARM_CORTEX_A9
.Lactrl_cpuid:
.long 0xff0ffff0
.long 0x410fc090
#elif defined CONFIG_ARM_CORTEX_A15
.Lactrl_cpuid:
.long 0xff0ffff0
.long 0x410fc0f0
#else
.Lactrl_cpuid:
.long 0xffffffff
.long 0x0
#endif
// we run paged now
_tramp_mp_virt:

View File

@@ -46,6 +46,30 @@
jmp slowtraps
.endm
#ifdef CONFIG_USER_SINGLE_STEP
.macro HANDLE_USER_TRAP1
/* Save EFLAGS, this may trap if user task had single stepping activated
* test for single stepping
*/
pushf
addl $4, %esp
testl $EFLAGS_TF, -4(%esp)
.endm
.macro RESTORE_USER_TRAP1
/* Restore single stepping if it has been set */
je 1f
orl $EFLAGS_TF, (%esp)
1:
.endm
#else
.macro HANDLE_USER_TRAP1
.endm
.macro RESTORE_USER_TRAP1
.endm
#endif
.p2align 4
.globl entry_vec01_debug
entry_vec01_debug:
@@ -59,6 +83,15 @@ entry_vec01_debug:
cmpl $entry_sys_fast_ipc_log, (%esp)
je 2f
#endif
/* test if trap was raised within kernel */
testl $3, 4(%esp)
jne 1f
/* turn of EFLAGS.TF */
btrl $7, 8(%esp)
iret
1: pushl $0
pushl $1
pusha
@@ -226,10 +259,16 @@ alien_sys_fast_ipc_log:
.p2align(4)
.global entry_sys_fast_ipc_c
entry_sys_fast_ipc_c:
HANDLE_USER_TRAP1
pop %esp
pushl $(GDT_DATA_USER|SEL_PL_U) /* user ss */
pushl %ebp // push user SP (get in ebp)
pushf // fake user eflags
RESTORE_USER_TRAP1
cld
// Fake user cs. This cs value is never used with exception
// that the thread is ex_regs'd before we leave with sysexit.

View File

@@ -86,6 +86,12 @@ public:
// static const bool hlt_works_ok = false;
static bool hlt_works_ok;
#ifdef CONFIG_USER_SINGLE_STEP
static const bool user_single_step = true;
#else
static const bool user_single_step = false;
#endif
// the default uart to use for serial console
static const unsigned default_console_uart = 1;
static const unsigned default_console_uart_baudrate = 115200;

View File

@@ -92,7 +92,7 @@ Thread::user_ip() const
IMPLEMENT inline
Mword
Thread::user_flags() const
{ return regs()->flags(); }
{ return state() & Thread_ready; }
/** Check if the pagefault occured at a special place: At some places in the
kernel we want to ensure that a specific address is mapped. The regular
@@ -188,6 +188,10 @@ Thread::handle_slow_trap(Trap_state *ts)
goto generic_debug;
}
if (Config::user_single_step && ts->_trapno == 1 && from_user)
if (send_exception(ts))
goto success;
if (from_user && _space.user_mode())
{
if (ts->_trapno == 14 && Kmem::is_io_bitmap_page_fault(ts->_cr2))
@@ -435,7 +439,8 @@ Thread::send_exception_arch(Trap_state *ts)
// thread (not alien) and it's a debug trap,
// debug traps for aliens are always reflected as exception IPCs
if (!(state() & Thread_alien)
&& (ts->_trapno == 1 || ts->_trapno == 3))
&& ((ts->_trapno == 1 && !Config::user_single_step)
|| ts->_trapno == 3))
return 0; // we do not handle this
if (ts->_trapno == 3)
@@ -488,6 +493,11 @@ Thread::user_ip(Mword ip)
}
}
IMPLEMENT inline
void
Thread::user_single_step(bool)
{}
//----------------------------------------------------------------------------
IMPLEMENTATION [(ia32,amd64,ux) && !io]:
@@ -840,3 +850,16 @@ PRIVATE static inline
int
Thread::call_nested_trap_handler(Trap_state *)
{ return -1; }
//---------------------------------------------------------------------------
IMPLEMENTATION [ia32]:
IMPLEMENT inline
void
Thread::user_single_step(bool enable)
{
if (!Config::user_single_step)
return;
regs()->flags(enable ? user_flags() | EFLAGS_TF : user_flags() & ~EFLAGS_TF);
}

View File

@@ -124,5 +124,9 @@ IMPLEMENT
void
Irq_mgr::set_cpu(Mword irqnum, unsigned cpu) const
{
WARNX(Warning, "IRQ%ld: ignoring CPU setting (%d).\n", irqnum, cpu);
Irq i = chip(irqnum);
if (!i.chip)
return;
i.chip->set_cpu(i.pin, cpu);
}

View File

@@ -308,6 +308,10 @@ Thread::user_ip(Mword ip)
}
}
IMPLEMENT inline
void Thread::user_single_step(bool)
{}
PUBLIC inline NEEDS ["trap_state.h"]
int
Thread::send_exception_arch(Trap_state * /*ts*/)

View File

@@ -484,10 +484,12 @@ Task::sys_caps_equal(Syscall_frame *, Utcb *utcb)
if (obj_a.special() || obj_b.special())
return commit_result(obj_a.special_cap() == obj_b.special_cap());
Obj_space::Capability c_a = lookup(obj_a.cap());
Obj_space::Capability c_b = lookup(obj_b.cap());
Kobject_iface* ki_a = lookup(obj_a.cap()).obj();
Kobject_iface* ki_b = lookup(obj_b.cap()).obj();
Address a_a = ki_a ? ki_a->kobject_start_addr() : 0;
Address a_b = ki_b ? ki_b->kobject_start_addr() : 0;
return commit_result(c_a == c_b);
return commit_result(a_a == a_b);
}
PRIVATE inline NOEXPORT

View File

@@ -73,6 +73,7 @@ public:
{
Exr_cancel = 0x10000,
Exr_trigger_exception = 0x20000,
Exr_single_step = 0x40000,
};
enum Vcpu_ctl_flags
@@ -140,6 +141,8 @@ public:
inline Mword user_flags() const;
inline void user_single_step(bool);
/** nesting level in debugger (always critical) if >1 */
static Per_cpu<unsigned long> nested_trap_recover;
static void handle_remote_requests_irq() asm ("handle_remote_cpu_requests");

View File

@@ -527,6 +527,8 @@ Thread_object::ex_regs(Address ip, Address sp,
if (o_ip) *o_ip = user_ip();
if (o_flags) *o_flags = user_flags();
(ops & Exr_single_step) ? user_single_step(true) : user_single_step(false);
// Changing the run state is only possible when the thread is not in
// an exception.
if (!(ops & Exr_cancel) && (state() & Thread_in_exception))

View File

@@ -0,0 +1,55 @@
INTERFACE:
#include "types.h"
#include "per_cpu_data.h"
EXTENSION class Timer_tick
{
public:
static Per_cpu<Timer_tick> _glbl_timer;
Timer_tick()
{
if (Proc::cpu_id())
set_hit(&handler_app);
else
set_hit(&handler_sys_time);
}
};
IMPLEMENTATION:
#include "timer.h"
DEFINE_PER_CPU Per_cpu<Timer_tick> Timer_tick::_glbl_timer;
IMPLEMENT void
Timer_tick::setup(unsigned cpu)
{
if (!allocate_irq(&_glbl_timer.cpu(cpu), Timer::irq()))
panic("Could not allocate scheduling IRQ %d\n", Timer::irq());
_glbl_timer.cpu(cpu).set_mode(Timer::irq_mode());
}
IMPLEMENT
void
Timer_tick::enable(unsigned)
{
_glbl_timer.current().chip()->unmask(_glbl_timer.current().pin());
}
IMPLEMENT
void
Timer_tick::disable(unsigned)
{
_glbl_timer.current().chip()->mask(_glbl_timer.current().pin());
}
PUBLIC inline NEEDS["timer.h"]
void
Timer_tick::ack()
{
Timer::acknowledge();
Irq_base::ack();
}

View File

@@ -0,0 +1,4 @@
PLATFORM_NAME = "Arndale Board"
PLATFORM_ARCH = arm
PLATFORM_RAM_BASE = 0x40000000
PLATFORM_RAM_SIZE_MB = 2048

View File

@@ -0,0 +1,4 @@
PLATFORM_NAME = "Freescale i.MX53"
PLATFORM_ARCH = arm
PLATFORM_RAM_BASE = 0x70000000
PLATFORM_RAM_SIZE_MB = 1024

View File

@@ -80,8 +80,10 @@ SUPPORT_CC_arm-tegra2 := platform/tegra2.cc
SUPPORT_CC_arm-imx21 := platform/imx.cc
SUPPORT_CC_arm-imx35 := platform/imx.cc
SUPPORT_CC_arm-imx51 := platform/imx.cc
SUPPORT_CC_arm-imx53 := platform/imx.cc
SUPPORT_CC_arm-imx6 := platform/imx.cc
SUPPORT_CC_arm-om := platform/om.cc
SUPPORT_CC_arm-arndale := platform/arndale.cc
SUPPORT_CC_arm-kirkwood := platform/kirkwood.cc
DEFAULT_RELOC_arm-imx21 := 0x00200000 # because of blob

View File

@@ -0,0 +1,32 @@
/**
* \file arnadale.cc
* \brief Support for the OpenMoko platform
*
* \date 2012
* \author Genode Labs
*
*/
#include "support.h"
#include <l4/drivers/uart_s3c2410.h>
#include <l4/drivers/uart_dummy.h>
namespace {
class Platform_arm_arndale : public Platform_single_region_ram
{
bool probe() { return true; }
void init()
{
static L4::Uart_s5pv210 _uart;
static L4::Io_register_block_mmio r(0x12C20000);
_uart.startup(&r);
set_stdio_uart(&_uart);
}
};
}
REGISTER_PLATFORM(Platform_arm_arndale);

View File

@@ -36,6 +36,9 @@ class Platform_arm_imx : public Platform_single_region_ram
#elif defined(PLATFORM_TYPE_imx51)
static L4::Io_register_block_mmio r(0x73fbc000);
static L4::Uart_imx51 _uart;
#elif defined(PLATFORM_TYPE_imx53)
static L4::Io_register_block_mmio r(0x53fbc000);
static L4::Uart_imx51 _uart;
#elif defined(PLATFORM_TYPE_imx6)
//static L4::Io_register_block_mmio r(0x02020000); // UART1
static L4::Io_register_block_mmio r(0x021e8000); // UART2

View File

@@ -27,6 +27,7 @@
#include "ioports.h"
#include "mem_man_test.h"
#include <l4/sys/debugger.h>
#include <l4/sys/scheduler.h>
/* started as the L4 sigma0 task from crt0.S */
@@ -61,6 +62,10 @@ init(l4_kernel_info_t *info)
l4_debugger_set_object_name(L4_BASE_FACTORY_CAP, "root factory");
l4_debugger_set_object_name(L4_BASE_THREAD_CAP, "sigma0");
l4_sched_param_t params = l4_sched_param(255);
l4_scheduler_run_thread(L4_BASE_SCHEDULER_CAP, L4_BASE_THREAD_CAP, &params);
Page_alloc_base::init();
init_memory(info);

View File

@@ -39,8 +39,9 @@ void handle_io_page_fault(l4_umword_t t, l4_utcb_t *utcb, Answer *a)
size = l4_fpage_size(fp) + PORT_SHIFT;
unsigned long i = io_ports.alloc(Region::bs(port, 1UL << size, t));
if (i == port)
if (i == port) {
a->snd_fpage(l4_iofpage(port >> PORT_SHIFT, size - PORT_SHIFT));
else
a->tag = l4_msgtag(0, 0, 1, 0);
} else
a->error(L4_ENOMEM);
}