[haiku-gsoc] ARM progress

  • From: Johannes Wischert <johanneswi@xxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Sun, 7 Jun 2009 22:39:48 +0200

Hi
I was quite silent for some time now since I had some stuff to do for
univeristy but now I have the time again to work on th Haiku ARM port
;)
The patch contains the needed changes to get the kernel to boot and
print out some stuff...
It's quite crude code (not much error checking etc ;) ) To get it to
work you would also have to change src/system/kernel/main.cpp (since I
load the kernel directly by now instead of using a real bootloader so
the kernel_args are of course not valid ;) )

  Johannes
Index: build/jam/BuildSetup
===================================================================
--- build/jam/BuildSetup        (Revision 30984)
+++ build/jam/BuildSetup        (Arbeitskopie)
@@ -180,6 +180,7 @@
        case powerpc-*  : HAIKU_CPU = ppc ;
        case m68k-*     : HAIKU_CPU = m68k ;
        case mipsel-*   : HAIKU_CPU = mipsel ;
+       case arm-*      : HAIKU_CPU = arm ;
        case * : Exit "Unsupported gcc target machine:" $(HAIKU_GCC_MACHINE) ;
 }
 
@@ -192,6 +193,12 @@
                # offset in floppy image (>= sizeof(haiku_loader))
                HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet
        }
+       case arm :
+       {
+               HAIKU_DEFINES += __ARM__ ;
+               HAIKU_BOOT_PLATFORM = u-boot ;
+                               
+       }
        case x86 :
        {
                HAIKU_DEFINES += __INTEL__ ;
Index: src/tools/gensyscalls/arch/arm/arch_gensyscalls.h
===================================================================
--- src/tools/gensyscalls/arch/arm/arch_gensyscalls.h   (Revision 0)
+++ src/tools/gensyscalls/arch/arm/arch_gensyscalls.h   (Revision 0)
@@ -0,0 +1,51 @@
+// Included by gensyscalls.
+
+typedef int AlignmentType;
+static const char* kAlignmentType = "int";
+static const int kAlignment = sizeof(AlignmentType);
+
+// ReturnTypeCreator
+template<typename T>
+class ReturnTypeCreator {
+public:
+       static void Create(Syscall* syscall, const char* name)
+       {
+               int size = sizeof(T);
+               int usedSize = align_to_type<AlignmentType>(size);
+               const char* alignmentType
+                       = (size != usedSize && size < kAlignment ? 
kAlignmentType : 0);
+
+               syscall->SetReturnType(name, size, usedSize, alignmentType);
+       }
+};
+
+template<>
+class ReturnTypeCreator<void> {
+public:
+       static void Create(Syscall* syscall, const char* name)
+       {
+               syscall->SetReturnType(name, 0, 0, 0);
+       }
+};
+
+// ParameterCreator
+template<typename T>
+class ParameterCreator {
+public:
+       static void Create(Syscall* syscall, const char* typeName,
+               const char* parameterName)
+       {
+               // compute offset
+               int offset = 0;
+               if (Parameter* previous = syscall->LastParameter())
+                       offset = previous->Offset() + previous->UsedSize();
+
+               int size = sizeof(T);
+               int usedSize = align_to_type<AlignmentType>(size);
+               const char* alignmentType
+                       = (size != usedSize && size < kAlignment ? 
kAlignmentType : 0);
+
+               syscall->AddParameter(typeName, parameterName, size, usedSize, 
offset,
+                       alignmentType);
+       }
+};
Index: src/system/kernel/platform/u-boot/platform.cpp.save
===================================================================
--- src/system/kernel/platform/u-boot/platform.cpp.save (Revision 0)
+++ src/system/kernel/platform/u-boot/platform.cpp.save (Revision 0)
@@ -0,0 +1,606 @@
+/*
+       Atari kernel platform code.
+*/
+
+#include <arch_platform.h>
+
+#include <new>
+#include <util/kernel_cpp.h>
+
+#include <KernelExport.h>
+
+#include <boot/kernel_args.h>
+#include <arch/cpu.h>
+//#include <platform/openfirmware/openfirmware.h>
+//#include <platform/atari_m68k/MFP.h>
+//#include <platform/atari_m68k/platform_atari_m68k.h>
+#include <real_time_clock.h>
+#include <timer.h>
+
+#include "debugger_keymaps.h"
+
+#define in8(a)  (*(volatile uint8 *)(a))
+#define out8(v, a)  (*(volatile uint8 *)(a) = v)
+
+
+namespace BPrivate {
+
+//class MfpPIC;
+
+// #pragma mark - Atari (Falcon)
+
+
+class U-Boot : public M68KPlatform {
+public:
+
+       M68KAtari();
+       virtual ~M68KAtari();
+
+       void ProbeHardware(struct kernel_args *kernelArgs);
+
+       virtual status_t Init(struct kernel_args *kernelArgs);
+       virtual status_t InitSerialDebug(struct kernel_args *kernelArgs);
+       virtual status_t InitPostVM(struct kernel_args *kernelArgs);
+       virtual status_t InitPIC(struct kernel_args *kernelArgs);
+       virtual status_t InitRTC(struct kernel_args *kernelArgs,
+               struct real_time_data *data);
+       virtual status_t InitTimer(struct kernel_args *kernelArgs);
+
+       virtual char BlueScreenGetChar();
+
+       virtual char SerialDebugGetChar();
+       virtual void SerialDebugPutChar(char c);
+
+       virtual void EnableIOInterrupt(int irq);
+       virtual void DisableIOInterrupt(int irq);
+       virtual bool AcknowledgeIOInterrupt(int irq);
+
+       virtual uint8 ReadRTCReg(uint8 reg);
+       virtual void WriteRTCReg(uint8 reg, uint8 val);
+       virtual void SetHardwareRTC(uint32 seconds);
+       virtual uint32 GetHardwareRTC();
+
+       virtual void SetHardwareTimer(bigtime_t timeout);
+       virtual void ClearHardwareTimer(void);
+
+       virtual void ShutDown(bool reboot);
+
+private:
+       MFP     *MFPForIrq(int irq);
+       static int32    MFPTimerInterrupt(void *data);
+
+       MFP     *fMFP[2];
+
+       RTC     *fRTC;
+
+       // native features (ARAnyM emulator)
+       uint32 (*nfGetID)(const char *name);
+       int32 (*nfCall)(uint32 ID, ...);
+       char *nfPage;
+       uint32 nfDebugPrintfID;
+       
+};
+
+
+}      // namespace BPrivate
+
+using BPrivate::M68KAtari;
+
+
+// #pragma mark - M68KAtari::MFP
+
+
+static char sMFP0Buffer[sizeof(M68KAtari::MFP)];
+static char sMFP1Buffer[sizeof(M68KAtari::MFP)];
+
+// constructor
+M68KAtari::MFP::MFP(uint32 base, int vector)
+{
+       fBase = base;
+       fVector = vector;
+}
+
+
+M68KAtari::MFP::~MFP()
+{
+}
+
+#warning M68K: use enable or mark register ?
+
+void
+M68KAtari::MFP::EnableIOInterrupt(int irq)
+{
+       uint8 bit = 1 << (irq % 8);
+       // I*B[0] is vector+0, I*A[0] is vector+8
+       uint32 reg = Base() + ((irq > 8) ? (MFP_IERA) : (MFP_IERB));
+       uint8 val = in8(reg);
+       if (val & bit == 0) {
+               val |= bit;
+               out8(val, reg);
+       }
+}
+
+
+void
+M68KAtari::MFP::DisableIOInterrupt(int irq)
+{
+       uint8 bit = 1 << (irq % 8);
+       // I*B[0] is vector+0, I*A[0] is vector+8
+       uint32 reg = Base() + ((irq > 8) ? (MFP_IERA) : (MFP_IERB));
+       uint8 val = in8(reg);
+       if (val & bit) {
+               val &= ~bit;
+               out8(val, reg);
+       }
+}
+
+
+bool
+M68KAtari::MFP::AcknowledgeIOInterrupt(int irq)
+{
+       uint8 bit = 1 << (irq % 8);
+       // I*B[0] is vector+0, I*A[0] is vector+8
+       uint32 reg = Base() + ((irq > 8) ? (MFP_ISRA) : (MFP_ISRB));
+       uint8 val = in8(reg);
+       if (val & bit) {
+               val &= ~bit;
+               out8(val, reg);
+               return true;
+       }
+       return false;
+}
+
+
+// #pragma mark - M68KAtari::RTc
+
+
+static char sRTCBuffer[sizeof(M68KAtari::RTC)];
+
+// constructor
+M68KAtari::RTC::RTC(uint32 base, int vector)
+{
+       fBase = base;
+       fVector = vector;
+}
+
+
+M68KAtari::RTC::~RTC()
+{
+}
+
+
+uint8
+M68KAtari::RTC::ReadReg(uint32 reg)
+{
+       int waitTime = 10000;
+
+       if (reg < 0x0a) {       // time of day stuff...
+                               // check for in progress updates before 
accessing
+               out8(0x0a, fBase+1);
+               while((in8(fBase+3) & 0x80) && --waitTime);
+       }
+       
+       out8((uint8)reg,fBase+1);
+       return in8(fBase+3);
+}
+
+
+// #pragma mark - M68KAtari
+
+
+// constructor
+M68KAtari::M68KAtari()
+       : M68KPlatform(B_ATARI_PLATFORM, M68K_PLATFORM_ATARI)
+{
+}
+
+
+// destructor
+M68KAtari::~M68KAtari()
+{
+}
+
+
+void
+M68KAtari::ProbeHardware(struct kernel_args *kernelArgs)
+{
+       dprintf("Atari hardware:\n");
+       // if we are here we already know we have one
+       dprintf("       ST MFP\n");
+       if (m68k_is_hw_register_readable(MFP1_BASE)) {
+               dprintf("       TT MFP\n");
+               fMFP[1] = new(sMFP1Buffer) M68KAtari::MFP(MFP1_BASE, 
MFP1_VECTOR_BASE);
+       }
+       if (m68k_is_hw_register_readable(TT_RTC_BASE)) {
+               dprintf("       TT RTC MC146818A\n");
+               fRTC = new(sRTCBuffer) 
M68KAtari::RTC(TT_RTC_BASE,TT_RTC_VECTOR);
+       } else
+               panic("TT RTC required!");
+}
+
+
+status_t
+M68KAtari::Init(struct kernel_args *kernelArgs)
+{
+       fMFP[0] = NULL;
+       fMFP[1] = NULL;
+       fRTC = NULL;
+
+       // initialize ARAnyM NatFeatures
+       nfGetID =
+               kernelArgs->arch_args.plat_args.atari.nat_feat.nf_get_id;
+       nfCall = 
+               kernelArgs->arch_args.plat_args.atari.nat_feat.nf_call;
+       nfPage = (char *)
+               kernelArgs->arch_args.plat_args.atari.nat_feat.nf_page;
+
+       // probe for ST-MFP
+       if (m68k_is_hw_register_readable(MFP0_BASE)) {
+               fMFP[0] = new(sMFP0Buffer) M68KAtari::MFP(MFP0_BASE, 
MFP0_VECTOR_BASE);
+       } else
+               // won't really work anyway from here
+               panic("You MUST have an ST MFP! Wait, is that *really* an Atari 
???");
+       
+       return B_OK;
+}
+
+
+status_t
+M68KAtari::InitSerialDebug(struct kernel_args *kernelArgs)
+{
+       nfDebugPrintfID =
+               kernelArgs->arch_args.plat_args.atari.nat_feat.nf_dprintf_id;
+
+#warning M68K: add real serial debug output someday
+
+       //out8(0x11, IKBD_BASE+IKBD_DATA);
+
+       // now we can expect to see something
+       ProbeHardware(kernelArgs);
+
+       return B_OK;
+}
+
+
+status_t
+M68KAtari::InitPostVM(struct kernel_args *kernelArgs)
+{
+#if 0
+       add_debugger_command("of_exit", &debug_command_of_exit,
+               "Exit to the Open Firmware prompt. No way to get back into the 
OS!");
+       add_debugger_command("of_enter", &debug_command_of_enter,
+               "Enter a subordinate Open Firmware interpreter. Quitting it 
returns "
+               "to KDL.");
+#endif
+       return B_NO_INIT;
+       return B_OK;
+}
+
+
+status_t
+M68KAtari::InitPIC(struct kernel_args *kernelArgs)
+{
+       return B_OK;
+}
+
+
+status_t
+M68KAtari::InitRTC(struct kernel_args *kernelArgs,
+       struct real_time_data *data)
+{
+       // XXX we should do this in the bootloader maybe...
+       kernelArgs->arch_args.time_base_frequency = MFP_SYSTEM_TIME_RATE;
+       return B_OK;
+}
+
+
+status_t
+M68KAtari::InitTimer(struct kernel_args *kernelArgs)
+{
+       
+       fMFP[0]->WriteReg(MFP_TACR, 0); // stop it
+       install_io_interrupt_handler(fMFP[0]->Vector()+13, &MFPTimerInterrupt, 
this, 0);
+       return B_OK;
+}
+
+
+char
+M68KAtari::BlueScreenGetChar()
+{
+       /* polling the keyboard, similar to code in keyboard
+        * driver, but without using an interrupt
+        * taken almost straight from x86 code
+        * XXX: maybe use the keymap from the _AKP cookie instead ?
+        */
+       static bool shiftPressed = false;
+       static bool controlPressed = false;
+       static bool altPressed = false;
+       static uint8 special = 0;
+       static uint8 special2 = 0;
+       uint8 key = 0;
+
+       if (special & 0x80) {
+               special &= ~0x80;
+               return '[';
+       }
+       if (special != 0) {
+               key = special;
+               special = 0;
+               return key;
+       }
+       if (special2 != 0) {
+               key = special2;
+               special2 = 0;
+               return key;
+       }
+
+       while (true) {
+               uint8 status = in8(IKBD_BASE+IKBD_CTRL);
+
+               if ((status & IKBD_STATUS_READ_BUFFER_FULL) == 0) {
+                       // no data in keyboard buffer
+                       spin(200);
+                       //kprintf("no key\n");
+                       continue;
+               }
+
+               spin(200);
+               key = in8(IKBD_BASE+IKBD_DATA);
+               /*
+               kprintf("key: %02x, %sshift %scontrol %salt\n",
+                       key,
+                       shiftPressed?"":"!",
+                       controlPressed?"":"!",
+                       altPressed?"":"!");
+               */
+
+               if (key & 0x80) {
+                       // key up
+                       switch (key & ~0x80) {
+                               case LEFT_SHIFT:
+                               case RIGHT_SHIFT:
+                                       shiftPressed = false;
+                                       break;
+                               case LEFT_CONTROL:
+                                       controlPressed = false;
+                                       break;
+                               case LEFT_ALT:
+                                       altPressed = false;
+                                       break;
+                       }
+               } else {
+                       // key down
+                       switch (key) {
+                               case LEFT_SHIFT:
+                               case RIGHT_SHIFT:
+                                       shiftPressed = true;
+                                       break;
+
+                               case LEFT_CONTROL:
+                                       controlPressed = true;
+                                       break;
+
+                               case LEFT_ALT:
+                                       altPressed = true;
+                                       break;
+
+                               // start escape sequence for cursor movement
+                               case CURSOR_UP:
+                                       special = 0x80 | 'A';
+                                       return '\x1b';
+                               case CURSOR_DOWN:
+                                       special = 0x80 | 'B';
+                                       return '\x1b';
+                               case CURSOR_RIGHT:
+                                       special = 0x80 | 'C';
+                                       return '\x1b';
+                               case CURSOR_LEFT:
+                                       special = 0x80 | 'D';
+                                       return '\x1b';
+                               case CURSOR_HOME:
+                                       special = 0x80 | 'H';
+                                       return '\x1b';
+                               case CURSOR_END:
+                                       special = 0x80 | 'F';
+                                       return '\x1b';
+                               case PAGE_UP:
+                                       special = 0x80 | '5';
+                                       special2 = '~';
+                                       return '\x1b';
+                               case PAGE_DOWN:
+                                       special = 0x80 | '6';
+                                       special2 = '~';
+                                       return '\x1b';
+
+
+                               case DELETE:
+                                       if (controlPressed && altPressed)
+                                               arch_cpu_shutdown(true);
+
+                                       special = 0x80 | '3';
+                                       special2 = '~';
+                                       return '\x1b';
+
+                               default:
+                                       if (controlPressed) {
+                                               char c = kShiftedKeymap[key];
+                                               if (c >= 'A' && c <= 'Z')
+                                                       return 0x1f & c;
+                                       }
+
+                                       if (altPressed)
+                                               return kAltedKeymap[key];
+
+                                       return shiftPressed
+                                               ? kShiftedKeymap[key] : 
kUnshiftedKeymap[key];
+                       }
+               }
+       }
+}
+
+
+char
+M68KAtari::SerialDebugGetChar()
+{
+       //WRITEME
+       return BlueScreenGetChar();
+       //return 0;
+}
+
+
+void
+M68KAtari::SerialDebugPutChar(char c)
+{
+       if (nfCall && nfDebugPrintfID) {
+#if 0
+               static char buffer[2] = { '\0', '\0' };
+               buffer[0] = c;
+               
+               nfCall(nfDebugPrintfID /*| 0*/, buffer);
+#endif
+               nfPage[0] = c;
+               nfPage[1] = '\0';
+               nfCall(nfDebugPrintfID /*| 0*/, nfPage);
+       }
+
+#warning M68K: WRITEME
+       // real serial
+       //panic("WRITEME");
+}
+
+
+void
+M68KAtari::EnableIOInterrupt(int irq)
+{
+       MFP *mfp = MFPForIrq(irq);
+
+       if (mfp)
+               mfp->EnableIOInterrupt(irq - mfp->Vector());
+}
+
+
+void
+M68KAtari::DisableIOInterrupt(int irq)
+{
+       MFP *mfp = MFPForIrq(irq);
+
+       if (mfp)
+               mfp->DisableIOInterrupt(irq - mfp->Vector());
+}
+
+
+bool
+M68KAtari::AcknowledgeIOInterrupt(int irq)
+{
+       MFP *mfp = MFPForIrq(irq);
+
+       if (mfp)
+               return mfp->AcknowledgeIOInterrupt(irq - mfp->Vector());
+       return false;
+}
+
+
+uint8
+M68KAtari::ReadRTCReg(uint8 reg)
+{
+       // fake century
+       // (on MC146818A it's in the RAM, but probably it's used for that 
purpose...)
+       // but just in case, we're in 20xx now anyway :)
+       if (reg == 0x32)
+               return 0x20;
+       return fRTC->ReadReg(reg);
+}
+
+
+void
+M68KAtari::WriteRTCReg(uint8 reg, uint8 val)
+{
+       fRTC->WriteReg(reg, val);
+}
+
+void
+M68KAtari::SetHardwareRTC(uint32 seconds)
+{
+#warning M68K: WRITEME
+}
+
+
+uint32
+M68KAtari::GetHardwareRTC()
+{
+#warning M68K: WRITEME
+       return 0;
+}
+
+
+void
+M68KAtari::SetHardwareTimer(bigtime_t timeout)
+{
+       uint8 nextEventClocks;
+       if (timeout <= 0)
+               nextEventClocks = 2;
+       else if (timeout < MFP_MAX_TIMER_INTERVAL)
+               nextEventClocks = timeout * MFP_TIMER_RATE / 1000000;
+       else
+               nextEventClocks = 0xff;
+
+       fMFP[0]->WriteReg(SYS_TDR, nextEventClocks);
+       // delay mode, device by 4
+       fMFP[0]->WriteReg(SYS_TCR, (fMFP[0]->ReadReg(SYS_TCR) & SYS_TCRMASK) | 
SYS_TENABLE);
+       // enable irq
+       EnableIOInterrupt(MFP1_VECTOR_BASE + SYS_TVECTOR);
+}
+
+
+void
+M68KAtari::ClearHardwareTimer(void)
+{
+       // disable the irq (as on PC but I'm not sure it's needed)
+       DisableIOInterrupt(MFP1_VECTOR_BASE + SYS_TVECTOR);
+       // stop it, we don't want another countdown
+       fMFP[0]->WriteReg(SYS_TCR, (fMFP[0]->ReadReg(SYS_TCR) & SYS_TCRMASK) | 
SYS_TDISABLE);
+}
+
+
+void
+M68KAtari::ShutDown(bool reboot)
+{
+       panic("Bombs!");
+       panic("WRITEME");
+}
+
+
+M68KAtari::MFP *
+M68KAtari::MFPForIrq(int irq)
+{
+       int i;
+
+       for (i = 0; i < 2; i++) {
+               if (fMFP[i]) {
+                       if (irq >= fMFP[i]->Vector() && irq < fMFP[i]->Vector() 
+ 16)
+                               return fMFP[i];
+               }
+       }
+       return NULL;
+}
+
+int32
+M68KAtari::MFPTimerInterrupt(void *data)
+{
+       M68KAtari *_this = (M68KAtari *)data;
+       // disable the timer, else it will loop again with the same value
+       _this->ClearHardwareTimer();
+       // handle the timer
+       return timer_interrupt();
+}
+
+
+// static buffer for constructing the actual M68KPlatform
+static char *sM68KPlatformBuffer[sizeof(M68KAtari)];
+#warning PTR HERE ???
+
+
+M68KPlatform *instanciate_m68k_platform_atari()
+{
+       return new(sM68KPlatformBuffer) M68KAtari;
+}
Index: src/system/kernel/platform/u-boot/platform.cpp
===================================================================
--- src/system/kernel/platform/u-boot/platform.cpp      (Revision 0)
+++ src/system/kernel/platform/u-boot/platform.cpp      (Revision 0)
@@ -0,0 +1,10 @@
+/*
+       Atari kernel platform code.
+*/
+
+//#include <arch_platform.h>
+
+#define in8(a)  (*(volatile uint8 *)(a))
+#define out8(v, a)  (*(volatile uint8 *)(a) = v)
+
+
Index: src/system/kernel/platform/u-boot/Jamfile
===================================================================
--- src/system/kernel/platform/u-boot/Jamfile   (Revision 0)
+++ src/system/kernel/platform/u-boot/Jamfile   (Revision 0)
@@ -0,0 +1,8 @@
+SubDir HAIKU_TOP src system kernel platform u-boot ;
+
+SubDirCcFlags $(TARGET_KERNEL_PIC_CCFLAGS) ;
+SubDirC++Flags $(TARGET_KERNEL_PIC_CCFLAGS) ;
+
+KernelMergeObject kernel_platform_u-boot.o :
+       platform.cpp
+;
Index: src/system/kernel/lib/arch/arm/Jamfile
===================================================================
--- src/system/kernel/lib/arch/arm/Jamfile      (Revision 0)
+++ src/system/kernel/lib/arch/arm/Jamfile      (Revision 0)
@@ -0,0 +1,33 @@
+SubDir HAIKU_TOP src system kernel lib arch arm ;
+
+SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
+
+local librootSources = [ FDirName $(HAIKU_TOP) src system libroot ] ;
+local posixSources = [ FDirName $(librootSources) posix ] ;
+
+SEARCH_SOURCE += [ FDirName $(librootSources) os arch $(TARGET_ARCH) ] ;
+
+KernelMergeObject kernel_os_arch_$(TARGET_ARCH).o :
+       atomic.S
+       byteorder.S
+#      system_time_asm.S
+       system_time.c
+
+       : $(TARGET_KERNEL_PIC_CCFLAGS)
+;
+
+SEARCH_SOURCE += [ FDirName $(posixSources) arch $(TARGET_ARCH) ] ;
+SEARCH_SOURCE += [ FDirName $(posixSources) string arch generic ] ;
+SEARCH_SOURCE += [ FDirName $(posixSources) string arch $(TARGET_ARCH) ] ;
+
+KernelMergeObject kernel_lib_posix_arch_$(TARGET_ARCH).o :
+       siglongjmp.S
+       sigsetjmp.S
+       kernel_longjmp_return.c
+       kernel_setjmp_save_sigs.c
+
+       arch_string.S
+       memset.c
+
+       : $(TARGET_KERNEL_PIC_CCFLAGS)
+;
Index: src/system/kernel/arch/arm/arch_debug_console.cpp.save
===================================================================
--- src/system/kernel/arch/arm/arch_debug_console.cpp.save      (Revision 0)
+++ src/system/kernel/arch/arm/arch_debug_console.cpp.save      (Revision 0)
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2007, François Revol, revol@xxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2003-2006, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2001, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the NewOS License.
+ */
+
+
+//#include <arch_platform.h>
+#include <arch/debug_console.h>
+#include <boot/kernel_args.h>
+#include <kernel.h>
+#include <vm.h>
+
+#include <string.h>
+
+
+void
+arch_debug_remove_interrupt_handler(uint32 line)
+{
+}
+
+
+void
+arch_debug_install_interrupt_handlers(void)
+{
+}
+
+
+char
+arch_debug_blue_screen_getchar(void)
+{
+#warning ARM WRITEME
+       return 0;
+//M68KPlatform::Default()->BlueScreenGetChar();
+}
+
+
+char
+arch_debug_serial_getchar(void)
+{
+#warning ARM WRITEME
+
+       return 0;
+//M68KPlatform::Default()->SerialDebugGetChar();
+}
+
+
+void
+arch_debug_serial_putchar(const char c)
+{
+#warning ARM WRITEME
+
+//M68KPlatform::Default()->SerialDebugPutChar(c);
+}
+
+
+void
+arch_debug_serial_puts(const char *s)
+{
+       while (*s != '\0') {
+               arch_debug_serial_putchar(*s);
+               s++;
+       }
+}
+
+
+void
+arch_debug_serial_early_boot_message(const char *string)
+{
+       // this function will only be called in fatal situations
+}
+
+
+status_t
+arch_debug_console_init(kernel_args *args)
+{
+#warning ARM WRITEME
+
+       return 0;
+//M68KPlatform::Default()->InitSerialDebug(args);
+}
+
+
+status_t
+arch_debug_console_init_settings(kernel_args *args)
+{
+       return B_OK;
+}
+
Index: src/system/kernel/arch/arm/arch_elf.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_elf.cpp     (Revision 0)
+++ src/system/kernel/arch/arm/arch_elf.cpp     (Revision 0)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2007, François Revol, revol@xxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2005, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>.
+ * All rights reserved. Distributed under the terms of the MIT License.
+ *
+ *
+ * Copyright 2002, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the NewOS License.
+ */
+
+#ifdef _BOOT_MODE
+#include <boot/arch.h>
+#endif
+
+#include <KernelExport.h>
+
+#include <elf_priv.h>
+#include <arch/elf.h>
+
+
+//#define TRACE_ARCH_ELF
+#ifdef TRACE_ARCH_ELF
+#      define TRACE(x) dprintf x
+#      define CHATTY 1
+#else
+#      define TRACE(x) ;
+#      define CHATTY 0
+#endif
+
+
+#ifdef TRACE_ARCH_ELF
+static const char *kRelocations[] = {
+};
+#endif
+
+#ifdef _BOOT_MODE
+status_t
+boot_arch_elf_relocate_rel(struct preloaded_image *image,
+       struct Elf32_Rel *rel, int rel_len)
+#else
+int
+arch_elf_relocate_rel(struct elf_image_info *image,
+       struct elf_image_info *resolve_image, struct Elf32_Rel *rel, int 
rel_len)
+#endif
+{
+       // there are no rel entries in M68K elf
+       return B_NO_ERROR;
+}
+
+
+static inline void
+write_32(addr_t P, Elf32_Word value)
+{
+       *(Elf32_Word*)P = value;
+}
+
+
+static inline void
+write_16(addr_t P, Elf32_Word value)
+{
+       // bits 16:29
+       *(Elf32_Half*)P = (Elf32_Half)value;
+}
+
+
+static inline bool
+write_16_check(addr_t P, Elf32_Word value)
+{
+       // bits 15:0
+       if ((value & 0xffff0000) && (~value & 0xffff8000))
+               return false;
+       *(Elf32_Half*)P = (Elf32_Half)value;
+       return true;
+}
+
+
+static inline bool
+write_8(addr_t P, Elf32_Word value)
+{
+       // bits 7:0
+       *(uint8 *)P = (uint8)value;
+       return true;
+}
+
+
+static inline bool
+write_8_check(addr_t P, Elf32_Word value)
+{
+       // bits 7:0
+       if ((value & 0xffffff00) && (~value & 0xffffff80))
+               return false;
+       *(uint8 *)P = (uint8)value;
+       return true;
+}
+
+
+#ifdef _BOOT_MODE
+status_t
+boot_arch_elf_relocate_rela(struct preloaded_image *image,
+       struct Elf32_Rela *rel, int rel_len)
+#else
+int
+arch_elf_relocate_rela(struct elf_image_info *image,
+       struct elf_image_info *resolve_image, struct Elf32_Rela *rel, int 
rel_len)
+#endif
+{
+#warning ARM: FIXME!!!!!!!
+       return B_NO_ERROR;
+}
+
Index: src/system/kernel/arch/arm/arch_thread.c
===================================================================
--- src/system/kernel/arch/arm/arch_thread.c    (Revision 0)
+++ src/system/kernel/arch/arm/arch_thread.c    (Revision 0)
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2003-2007, Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
+ *             Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
+ *             François Revol <revol@xxxxxxx>
+ *
+ * Copyright 2001, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the NewOS License.
+ */
+
+#include <arch_thread.h>
+
+#include <arch_cpu.h>
+#include <arch/thread.h>
+#include <boot/stage2.h>
+#include <kernel.h>
+#include <thread.h>
+#include <vm_address_space.h>
+#include <vm_types.h>
+#include <arch_vm.h>
+//#include <arch/vm_translation_map.h>
+
+#include <string.h>
+
+#warning M68K: writeme!
+// Valid initial arch_thread state. We just memcpy() it when initializing
+// a new thread structure.
+static struct arch_thread sInitialState;
+
+struct thread *gCurrentThread;
+
+
+status_t
+arch_thread_init(struct kernel_args *args)
+{
+       // Initialize the static initial arch_thread state (sInitialState).
+       // Currently nothing to do, i.e. zero initialized is just fine.
+
+       return B_OK;
+}
+
+
+status_t
+arch_team_init_team_struct(struct team *team, bool kernel)
+{
+       // Nothing to do. The structure is empty.
+       return B_OK;
+}
+
+
+status_t
+arch_thread_init_thread_struct(struct thread *thread)
+{
+       // set up an initial state (stack & fpu)
+       memcpy(&thread->arch_info, &sInitialState, sizeof(struct arch_thread));
+
+       return B_OK;
+}
+
+
+status_t
+arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void),
+       void (*entry_func)(void), void (*exit_func)(void))
+{
+/*     addr_t *kstack = (addr_t *)t->kernel_stack_base;
+       addr_t *kstackTop = (addr_t *)t->kernel_stack_base;
+
+       // clear the kernel stack
+#ifdef DEBUG_KERNEL_STACKS
+#      ifdef STACK_GROWS_DOWNWARDS
+       memset((void *)((addr_t)kstack + KERNEL_STACK_GUARD_PAGES * 
B_PAGE_SIZE), 0,
+               KERNEL_STACK_SIZE);
+#      else
+       memset(kstack, 0, KERNEL_STACK_SIZE);
+#      endif
+#else
+       memset(kstack, 0, KERNEL_STACK_SIZE);
+#endif
+
+       // space for frame pointer and return address, and stack frames must be
+       // 16 byte aligned
+       kstackTop -= 2;
+       kstackTop = (addr_t*)((addr_t)kstackTop & ~0xf);
+
+       // LR, CR, r2, r13-r31, f13-f31, as pushed by m68k_context_switch()
+       kstackTop -= 22 + 2 * 19;
+
+       // let LR point to m68k_kernel_thread_root()
+       kstackTop[0] = (addr_t)&m68k_kernel_thread_root;
+
+       // the arguments of m68k_kernel_thread_root() are the functions to call,
+       // provided in registers r13-r15
+       kstackTop[3] = (addr_t)entry_func;
+       kstackTop[4] = (addr_t)start_func;
+       kstackTop[5] = (addr_t)exit_func;
+
+       // save this stack position
+       t->arch_info.sp = (void *)kstackTop;
+*/
+#warning ARM:WRITEME
+       return B_OK;
+}
+
+
+status_t
+arch_thread_init_tls(struct thread *thread)
+{
+       // TODO: Implement!
+       return B_OK;
+}
+
+
+void
+arch_thread_switch_kstack_and_call(struct thread *t, addr_t newKstack,
+       void (*func)(void *), void *arg)
+{
+#warning ARM:WRITEME
+//     m68k_switch_stack_and_call(newKstack, func, arg);
+}
+
+
+void
+arch_thread_context_switch(struct thread *from, struct thread *to)
+{
+/*     addr_t newPageDirectory;
+
+       newPageDirectory = (addr_t)m68k_next_page_directory(from, to);
+
+       if ((newPageDirectory % B_PAGE_SIZE) != 0)
+               panic("arch_thread_context_switch: bad pgdir 0x%lx\n", 
newPageDirectory);
+#warning M68K: export from arch_vm.c
+       m68k_set_pgdir(newPageDirectory);
+       m68k_context_switch(&from->arch_info.sp, to->arch_info.sp);*/
+#warning ARM:WRITEME
+
+}
+
+
+void
+arch_thread_dump_info(void *info)
+{
+       struct arch_thread *at = (struct arch_thread *)info;
+
+       dprintf("\tsp: %p\n", at->sp);
+}
+
+
+status_t
+arch_thread_enter_userspace(struct thread *thread, addr_t entry, void *arg1, 
void *arg2)
+{
+       panic("arch_thread_enter_uspace(): not yet implemented\n");
+       return B_ERROR;
+}
+
+
+bool
+arch_on_signal_stack(struct thread *thread)
+{
+       return false;
+}
+
+
+status_t
+arch_setup_signal_frame(struct thread *thread, struct sigaction *sa, int sig, 
int sigMask)
+{
+       return B_ERROR;
+}
+
+
+int64
+arch_restore_signal_frame(void)
+{
+       return 0;
+}
+
+
+void
+arch_check_syscall_restart(struct thread *thread)
+{
+}
+
+
+/**    Saves everything needed to restore the frame in the child fork in the
+ *     arch_fork_arg structure to be passed to arch_restore_fork_frame().
+ *     Also makes sure to return the right value.
+ */
+
+void
+arch_store_fork_frame(struct arch_fork_arg *arg)
+{
+}
+
+
+/** Restores the frame from a forked team as specified by the provided
+ *     arch_fork_arg structure.
+ *     Needs to be called from within the child team, ie. instead of
+ *     arch_thread_enter_uspace() as thread "starter".
+ *     This function does not return to the caller, but will enter userland
+ *     in the child team at the same position where the parent team left of.
+ */
+
+void
+arch_restore_fork_frame(struct arch_fork_arg *arg)
+{
+}
+
Index: src/system/kernel/arch/arm/arch_debug_console.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_debug_console.cpp   (Revision 0)
+++ src/system/kernel/arch/arm/arch_debug_console.cpp   (Revision 0)
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2007, François Revol, revol@xxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2003-2006, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2001, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the NewOS License.
+ */
+
+
+//#include <arch_platform.h>
+#include <arch/debug_console.h>
+#include <boot/kernel_args.h>
+#include <kernel.h>
+#include <vm.h>
+#include <arch/arm/uart.h>
+#include <string.h>
+
+
+void
+arch_debug_remove_interrupt_handler(uint32 line)
+{
+}
+
+
+void
+arch_debug_install_interrupt_handlers(void)
+{
+}
+
+
+char
+arch_debug_blue_screen_getchar(void)
+{
+#warning ARM WRITEME
+       return 0;
+//M68KPlatform::Default()->BlueScreenGetChar();
+}
+
+
+char
+arch_debug_serial_getchar(void)
+{
+#warning ARM WRITEME
+return uart_getc(0,FALSE);
+//     return 0;
+//M68KPlatform::Default()->SerialDebugGetChar();
+}
+
+
+void
+arch_debug_serial_putchar(const char c)
+{
+//uart_putc(0,c);
+//uart_putc(1,c);
+uart_putc(0,c);
+#warning ARM WRITEME
+
+//     return 0;
+//M68KPlatform::Default()->SerialDebugPutChar(c);
+}
+
+
+void
+arch_debug_serial_puts(const char *s)
+{
+       while (*s != '\0') {
+               arch_debug_serial_putchar(*s);
+               s++;
+       }
+}
+
+
+void
+arch_debug_serial_early_boot_message(const char *string)
+{
+       // this function will only be called in fatal situations
+}
+
+
+status_t
+arch_debug_console_init(kernel_args *args)
+{
+
+uart_init_early();
+uart_init();//todo
+uart_init_port(0,9600);
+uart_init_port(1,9600);
+uart_init_port(2,9600);
+#warning ARM WRITEME
+
+       return 0;
+//M68KPlatform::Default()->InitSerialDebug(args);
+}
+
+
+status_t
+arch_debug_console_init_settings(kernel_args *args)
+{
+       return B_OK;
+}
+
Index: src/system/kernel/arch/arm/arch_real_time_clock.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_real_time_clock.cpp (Revision 0)
+++ src/system/kernel/arch/arm/arch_real_time_clock.cpp (Revision 0)
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2007, François Revol, revol@xxxxxxxx
+ * Copyright 2006, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>. All rights 
reserved.
+ * Copyright 2005-2007, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx
+ * Copyright 2003, Jeff Ward, jeff@xxxxxxxxxxxxxxxxxxxxxx All rights reserved.
+ *
+ * Distributed under the terms of the MIT License.
+ */
+
+#include <arch/real_time_clock.h>
+
+//#include <arch_platform.h>
+#include <real_time_clock.h>
+#include <real_time_data.h>
+#include <smp.h>
+/*
+typedef struct {
+       uint8 second;
+       uint8 minute;
+       uint8 hour;
+       uint8 day;
+       uint8 month;
+       uint8 year;
+       uint8 century;
+} cmos_time;
+
+
+static uint32
+bcd_to_int(uint8 bcd)
+{
+       uint32 numl;
+       uint32 numh;
+
+       numl = bcd & 0x0f;
+       numh = (bcd & 0xf0) >> 4;
+
+       return numh * 10 + numl;
+}
+
+
+static uint8
+int_to_bcd(uint32 number)
+{
+       uint8 low;
+       uint8 high;
+
+       if (number > 99)
+               return 0;
+
+       high = number / 10;
+       low = number % 10;
+
+       return (high << 4) | low;
+}
+
+
+static int
+same_time(const cmos_time *time1, const cmos_time *time2)
+{
+       return time1->second == time2->second
+               && time1->minute == time2->minute
+               && time1->hour == time2->hour
+               && time1->day == time2->day
+               && time1->month == time2->month
+               && time1->year == time2->year
+               && time1->century == time2->century;
+}
+
+
+static uint8
+cmos_read(uint8 addr)
+{
+       return M68KPlatform::Default()->ReadRTCReg(addr);
+}
+
+
+static void
+cmos_write(uint8 addr, uint8 data)
+{
+       M68KPlatform::Default()->WriteRTCReg(addr, data);
+}
+
+
+static void
+set_24_hour_mode(void)
+{
+       uint8 status_b;
+
+       status_b = cmos_read(0x0b);
+       status_b |= 0x02;
+       cmos_write(0x0b, status_b);
+}
+
+
+static void
+read_cmos_clock(cmos_time *cmos)
+{
+       set_24_hour_mode();
+
+       cmos->century = cmos_read(0x32);
+       cmos->year = cmos_read(0x09);
+       cmos->month = cmos_read(0x08);
+       cmos->day = cmos_read(0x07);
+       cmos->hour = cmos_read(0x04);
+       cmos->minute = cmos_read(0x02);
+       cmos->second = cmos_read(0x00);
+}
+
+
+static void
+write_cmos_clock(cmos_time *cmos)
+{
+       set_24_hour_mode();
+
+       cmos_write(0x32, cmos->century);
+       cmos_write(0x09, cmos->year);
+       cmos_write(0x08, cmos->month);
+       cmos_write(0x07, cmos->day);
+       cmos_write(0x04, cmos->hour);
+       cmos_write(0x02, cmos->minute);
+       cmos_write(0x00, cmos->second);
+}
+
+
+static uint32
+cmos_to_secs(const cmos_time *cmos)
+{
+       struct tm t;
+       t.tm_year = bcd_to_int(cmos->century) * 100 + bcd_to_int(cmos->year)
+               - RTC_EPOCH_BASE_YEAR;
+       t.tm_mon = bcd_to_int(cmos->month) - 1;
+       t.tm_mday = bcd_to_int(cmos->day);
+       t.tm_hour = bcd_to_int(cmos->hour);
+       t.tm_min = bcd_to_int(cmos->minute);
+       t.tm_sec = bcd_to_int(cmos->second);
+
+       return rtc_tm_to_secs(&t);
+}
+
+
+static void
+secs_to_cmos(uint32 seconds, cmos_time *cmos)
+{
+       int wholeYear;
+
+       struct tm t;
+       rtc_secs_to_tm(seconds, &t);
+
+       wholeYear = t.tm_year + RTC_EPOCH_BASE_YEAR;
+
+       cmos->century = int_to_bcd(wholeYear / 100);
+       cmos->year = int_to_bcd(wholeYear % 100);
+       cmos->month = int_to_bcd(t.tm_mon + 1);
+       cmos->day = int_to_bcd(t.tm_mday);
+       cmos->hour = int_to_bcd(t.tm_hour);
+       cmos->minute = int_to_bcd(t.tm_min);
+       cmos->second = int_to_bcd(t.tm_sec);
+}
+
+
+//     #pragma mark -
+
+
+
+static spinlock sSetArchDataLock;
+*/
+status_t
+arch_rtc_init(kernel_args *args, struct real_time_data *data)
+{
+/*
+       // init the platform RTC service
+       status_t error = M68KPlatform::Default()->InitRTC(args, data);
+       if (error != B_OK)
+               return error;
+
+       // init the arch specific part of the real_time_data
+       data->arch_data.data[0].system_time_offset = 0;
+       // cvFactor = 2^32 * 1000000 / tbFreq
+       // => (tb * cvFactor) >> 32 = (tb * 2^32 * 1000000 / tbFreq) >> 32
+       //    = tb / tbFreq * 1000000 = time in us
+       data->arch_data.system_time_conversion_factor
+               = uint32((uint64(1) << 32) * 1000000
+                       / args->arch_args.time_base_frequency);
+       data->arch_data.version = 0;
+
+       // init spinlock
+       sSetArchDataLock = 0;
+
+       // init system_time() conversion factor
+       
__m68k_setup_system_time(&data->arch_data.system_time_conversion_factor);
+*/
+#warning ARM:WRITEME
+       return B_OK;
+}
+
+
+uint32
+arch_rtc_get_hw_time(void)
+{
+#warning ARM:WRITEME
+
+       return 0;
+//M68KPlatform::Default()->GetHardwareRTC();
+}
+
+
+void
+arch_rtc_set_hw_time(uint32 seconds)
+{
+#warning ARM:WRITEME
+
+//     M68KPlatform::Default()->SetHardwareRTC(seconds);
+}
+
+
+void
+arch_rtc_set_system_time_offset(struct real_time_data *data, bigtime_t offset)
+{
+/*
+       cpu_status state = disable_interrupts();
+       acquire_spinlock(&sSetArchDataLock);
+
+       int32 version = data->arch_data.version + 1;
+       data->arch_data.data[version % 2].system_time_offset = offset;
+       data->arch_data.version = version;
+
+       release_spinlock(&sSetArchDataLock);
+       restore_interrupts(state);
+*/
+#warning ARM:WRITEME
+
+}
+
+
+bigtime_t
+arch_rtc_get_system_time_offset(struct real_time_data *data)
+{
+#warning ARM:WRITEME
+/*
+       int32 version;
+       bigtime_t offset;
+       do {
+               version = data->arch_data.version;
+               offset = data->arch_data.data[version % 2].system_time_offset;
+       } while (version != data->arch_data.version);
+
+       return offset;
+*/
+return 0;
+}
Index: src/system/kernel/arch/arm/uart.c
===================================================================
--- src/system/kernel/arch/arm/uart.c   (Revision 0)
+++ src/system/kernel/arch/arm/uart.c   (Revision 0)
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <debug.h>
+#include <arch/arm/reg.h>
+#include <arch/arm/uart.h>
+#include <arch/arm/pxa270.h>
+//#include <target/debugconfig.h>
+
+//TODO: beaglespecific ?...
+#define DEBUG_UART 2
+
+
+
+struct uart_stat {
+       addr_t base;
+       uint shift;
+};
+
+static struct uart_stat uart[3] = {
+       { FFUART_BASE, 2 },
+       { BTUART_BASE, 2 },
+       { STUART_BASE, 2 },
+};
+
+static inline void write_uart_reg(int port, uint reg, unsigned char data)
+{
+       *(volatile unsigned char *)(uart[port].base + (reg << 
uart[port].shift)) = data;
+}
+
+static inline unsigned char read_uart_reg(int port, uint reg)
+{
+       return *(volatile unsigned char *)(uart[port].base + (reg << 
uart[port].shift));
+}
+
+#define LCR_8N1                0x03
+
+#define FCR_FIFO_EN     0x01           /* Fifo enable */
+#define FCR_RXSR        0x02           /* Receiver soft reset */
+#define FCR_TXSR        0x04           /* Transmitter soft reset */
+
+#define MCR_DTR         0x01
+#define MCR_RTS         0x02
+#define MCR_DMA_EN      0x04
+#define MCR_TX_DFR      0x08
+
+#define LCR_WLS_MSK    0x03            /* character length select mask */
+#define LCR_WLS_5      0x00            /* 5 bit character length */
+#define LCR_WLS_6      0x01            /* 6 bit character length */
+#define LCR_WLS_7      0x02            /* 7 bit character length */
+#define LCR_WLS_8      0x03            /* 8 bit character length */
+#define LCR_STB                0x04            /* Number of stop Bits, off = 
1, on = 1.5 or 2) */
+#define LCR_PEN                0x08            /* Parity eneble */
+#define LCR_EPS                0x10            /* Even Parity Select */
+#define LCR_STKP       0x20            /* Stick Parity */
+#define LCR_SBRK       0x40            /* Set Break */
+#define LCR_BKSE       0x80            /* Bank select enable */
+
+#define LSR_DR         0x01            /* Data ready */
+#define LSR_OE         0x02            /* Overrun */
+#define LSR_PE         0x04            /* Parity error */
+#define LSR_FE         0x08            /* Framing error */
+#define LSR_BI         0x10            /* Break */
+#define LSR_THRE       0x20            /* Xmit holding register empty */
+#define LSR_TEMT       0x40            /* Xmitter empty */
+#define LSR_ERR                0x80            /* Error */
+
+#define LCRVAL LCR_8N1                                 /* 8 data, 1 stop, no 
parity */
+#define MCRVAL (MCR_DTR | MCR_RTS)                     /* RTS/DTR */
+#define FCRVAL (FCR_FIFO_EN | FCR_RXSR | FCR_TXSR)     /* Clear & enable FIFOs 
*/
+
+#define V_NS16550_CLK            (48000000)  /* 48MHz (APLL96/2) */
+
+void uart_init_port(int port, uint baud)
+{
+       /* clear the tx & rx fifo and disable */
+       uint16 baud_divisor = (V_NS16550_CLK / 16 / baud);
+
+       write_uart_reg(port, UART_IER, 0);
+       write_uart_reg(port, UART_LCR, LCR_BKSE | LCRVAL); // config mode A
+       write_uart_reg(port, UART_DLL, baud_divisor & 0xff);
+       write_uart_reg(port, UART_DLH, (baud_divisor >> 8) & 0xff);
+       write_uart_reg(port, UART_LCR, LCRVAL); // operational mode
+       write_uart_reg(port, UART_MCR, MCRVAL);
+       write_uart_reg(port, UART_FCR, FCRVAL);
+       write_uart_reg(port, UART_MDR1, 0); // UART 16x mode
+
+//     write_uart_reg(port, UART_LCR, 0xBF); // config mode B
+//     write_uart_reg(port, UART_EFR, (1<<7)|(1<<6)); // hw flow control
+//     write_uart_reg(port, UART_LCR, LCRVAL); // operational mode
+}
+
+void uart_init_early(void)
+{
+#warning INTITIALIZE UART!!!!!
+       /* UART1 */
+//     RMWREG32(CKEN1, 13, 1, 1),
+//     RMWREG32(CM_ICLKEN1_CORE, 13, 1, 1),
+
+       /* UART2 */
+//     RMWREG32(CM_FCLKEN1_CORE, 14, 1, 1),
+//     RMWREG32(CM_ICLKEN1_CORE, 14, 1, 1),
+
+       /* UART3 */
+//     RMWREG32(CM_FCLKEN_PER, 11, 1, 1),
+//     RMWREG32(CM_ICLKEN_PER, 11, 1, 1),
+
+       uart_init_port(DEBUG_UART, 115200);
+}
+
+void uart_init(void)
+{
+}
+
+int uart_putc(int port, char c )
+{
+
+//     while (!(read_uart_reg(port, UART_LSR) & (1<<6))) // wait for the last 
char to get out
+//             ;
+       write_uart_reg(port, UART_THR, c);
+       return 0;
+}
+
+int uart_getc(int port, bool wait)  /* returns -1 if no data available */
+{
+//     if (wait) {
+//             while (!(read_uart_reg(port, UART_LSR) & (1<<0))) // wait for 
data to show up in the rx fifo
+//                     ;
+//     } else {
+//             if (!(read_uart_reg(port, UART_LSR) & (1<<0)))
+//                     return -1;
+//     }
+       return read_uart_reg(port, UART_RHR);
+}
+
+void uart_flush_tx(int port)
+{
+       while (!(read_uart_reg(port, UART_LSR) & (1<<6))) // wait for the last 
char to get out
+               ;
+}
+
+void uart_flush_rx(int port)
+{
+       // empty the rx fifo
+       while (read_uart_reg(port, UART_LSR) & (1<<0)) {
+               volatile char c = read_uart_reg(port, UART_RHR);
+               (void)c;
+       }
+}
+
+
Index: src/system/kernel/arch/arm/arch_timer.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_timer.cpp   (Revision 0)
+++ src/system/kernel/arch/arm/arch_timer.cpp   (Revision 0)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2007, Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             François Revol <revol@xxxxxxx>
+ *
+ * Copyright 2001, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the NewOS License.
+ */
+
+
+#include <boot/stage2.h>
+#include <kernel.h>
+#include <debug.h>
+
+#include <timer.h>
+#include <arch/timer.h>
+//#include <arch_platform.h>
+
+
+void 
+arch_timer_set_hardware_timer(bigtime_t timeout)
+{
+#warning ARM:WRITEME
+
+//     M68KPlatform::Default()->SetHardwareTimer(timeout);
+}
+
+
+void 
+arch_timer_clear_hardware_timer()
+{
+#warning ARM:WRITEME
+//     M68KPlatform::Default()->ClearHardwareTimer();
+}
+
+
+int 
+arch_init_timer(kernel_args *args)
+{
+#warning ARM:WRITEME
+
+       return 0;
+//M68KPlatform::Default()->InitTimer(args);
+}
+
Index: src/system/kernel/arch/arm/arch_vm.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_vm.cpp      (Revision 0)
+++ src/system/kernel/arch/arm/arch_vm.cpp      (Revision 0)
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2007, François Revol, revol@xxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2003-2005, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2001, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the NewOS License.
+ */
+
+#include <KernelExport.h>
+
+#include <kernel.h>
+#include <boot/kernel_args.h>
+
+#include <vm.h>
+#include <vm_types.h>
+#include <arch/vm.h>
+//#include <arch_mmu.h>
+
+
+//#define TRACE_ARCH_VM
+#ifdef TRACE_ARCH_VM
+#      define TRACE(x) dprintf x
+#else
+#      define TRACE(x) ;
+#endif
+
+#warning M68K: WRITEME
+
+status_t
+arch_vm_init(kernel_args *args)
+{
+       return B_OK;
+}
+
+
+status_t
+arch_vm_init2(kernel_args *args)
+{
+//     int bats[8];
+//     int i;
+
+       /**/
+#warning M68K: disable TT0 and TT1, set up pmmu
+
+       return B_OK;
+}
+
+
+status_t
+arch_vm_init_post_area(kernel_args *args)
+{
+       return B_OK;
+}
+
+
+status_t
+arch_vm_init_end(kernel_args *args)
+{
+
+#warning M68K: unset TT0 now
+       return B_OK;
+}
+
+
+status_t
+arch_vm_init_post_modules(kernel_args *args)
+{
+       return B_OK;
+}
+
+
+void
+arch_vm_aspace_swap(struct vm_address_space *from, struct vm_address_space *to)
+{
+#warning ARM:WRITEME
+//     m68k_set_pgdir(m68k_translation_map_get_pgdir(&to->translation_map));
+}
+
+
+bool
+arch_vm_supports_protection(uint32 protection)
+{
+       return true;
+}
+
+
+void
+arch_vm_unset_memory_type(vm_area *area)
+{
+}
+
+
+status_t
+arch_vm_set_memory_type(vm_area *area, addr_t physicalBase, uint32 type)
+{
+       if (type == 0)
+               return B_OK;
+
+       return B_ERROR;
+}
Index: src/system/kernel/arch/arm/arch_user_debugger.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_user_debugger.cpp   (Revision 0)
+++ src/system/kernel/arch/arm/arch_user_debugger.cpp   (Revision 0)
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2007, François Revol, revol@xxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2005, Axel Dörfler, axeld@xxxxxxxxxxxxxxx
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include <debugger.h>
+#include <int.h>
+#include <thread.h>
+#include <arch/user_debugger.h>
+
+
+#warning ARM: WRITEME
+void
+arch_clear_team_debug_info(struct arch_team_debug_info *info)
+{
+}
+
+
+void
+arch_destroy_team_debug_info(struct arch_team_debug_info *info)
+{
+       arch_clear_team_debug_info(info);
+}
+
+
+void
+arch_clear_thread_debug_info(struct arch_thread_debug_info *info)
+{
+}
+
+
+void
+arch_destroy_thread_debug_info(struct arch_thread_debug_info *info)
+{
+       arch_clear_thread_debug_info(info);
+}
+
+
+void
+arch_update_thread_single_step()
+{
+}
+
+
+void
+arch_set_debug_cpu_state(const struct debug_cpu_state *cpuState)
+{
+}
+
+
+void
+arch_get_debug_cpu_state(struct debug_cpu_state *cpuState)
+{
+}
+
+
+status_t
+arch_set_breakpoint(void *address)
+{
+       return B_ERROR;
+}
+
+
+status_t
+arch_clear_breakpoint(void *address)
+{
+       return B_ERROR;
+}
+
+
+status_t
+arch_set_watchpoint(void *address, uint32 type, int32 length)
+{
+       return B_ERROR;
+}
+
+
+status_t
+arch_clear_watchpoint(void *address)
+{
+       return B_ERROR;
+}
+
+bool
+arch_has_breakpoints(struct arch_team_debug_info *info)
+{
+       return false;
+}
Index: src/system/kernel/arch/arm/arch_platform.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_platform.cpp        (Revision 0)
+++ src/system/kernel/arch/arm/arch_platform.cpp        (Revision 0)
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2007, François Revol, revol@xxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2006, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>.
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+
+//#include <arch_platform.h>
+
+#include <new>
+
+#include <KernelExport.h>
+#include <arch/platform.h>
+#include <boot/kernel_args.h>
+//#include <platform/openfirmware/openfirmware.h>
+#include <real_time_clock.h>
+#include <util/kernel_cpp.h>
+
+/*
+static M68KPlatform *sM68KPlatform;
+
+
+// constructor
+M68KPlatform::M68KPlatform(platform_type platformType,
+       m68k_platform_type m68kPlatformType)
+       : fPlatformType(platformType),
+         fM68KPlatformType(m68kPlatformType)
+{
+}
+
+// destructor
+M68KPlatform::~M68KPlatform()
+{
+}
+
+// Default
+M68KPlatform *
+M68KPlatform::Default()
+{
+       return sM68KPlatform;
+}
+
+
+// # pragma mark -
+*/
+
+status_t
+arch_platform_init(struct kernel_args *kernelArgs)
+{
+#warning ARM:WRITEME
+
+       return B_OK;
+}
+
+
+status_t
+arch_platform_init_post_vm(struct kernel_args *kernelArgs)
+{
+       return B_OK;
+#warning ARM:WRITEME
+//sM68KPlatform->InitPostVM(kernelArgs);
+}
+
+
+status_t
+arch_platform_init_post_thread(struct kernel_args *kernelArgs)
+{
+       return B_OK;
+}
Index: src/system/kernel/arch/arm/arch_debug.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_debug.cpp   (Revision 0)
+++ src/system/kernel/arch/arm/arch_debug.cpp   (Revision 0)
@@ -0,0 +1,378 @@
+/*
+ * Copyright 2003-2008, Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
+ *             Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
+ *             François Revol <revol@xxxxxxx>
+ */
+
+
+#include <arch/debug.h>
+
+#include <arch_cpu.h>
+#include <debug.h>
+#include <elf.h>
+#include <kernel.h>
+#include <kimage.h>
+#include <thread.h>
+
+
+struct stack_frame {
+       struct stack_frame      *previous;
+       addr_t                          return_address;
+};
+
+#define NUM_PREVIOUS_LOCATIONS 32
+
+extern struct iframe_stack gBootFrameStack;
+/*
+
+static bool
+already_visited(uint32 *visited, int32 *_last, int32 *_num, uint32 
framePointer)
+{
+       int32 last = *_last;
+       int32 num = *_num;
+       int32 i;
+
+       for (i = 0; i < num; i++) {
+               if (visited[(NUM_PREVIOUS_LOCATIONS + last - i)
+                               % NUM_PREVIOUS_LOCATIONS] == framePointer) {
+                       return true;
+               }
+       }
+
+       *_last = last = (last + 1) % NUM_PREVIOUS_LOCATIONS;
+       visited[last] = framePointer;
+
+       if (num < NUM_PREVIOUS_LOCATIONS)
+               *_num = num + 1;
+
+       return false;
+}
+
+
+static inline stack_frame *
+get_current_stack_frame()
+{
+       stack_frame *frame;
+       asm volatile("move.l %%fp,%0" : "=r"(frame));
+       return frame;
+}
+
+
+static status_t
+get_next_frame(addr_t framePointer, addr_t *next, addr_t *ip)
+{
+       struct thread *thread = thread_get_current_thread();
+       addr_t oldFaultHandler = thread->fault_handler;
+
+       // set fault handler, so that we can safely access user stacks
+       if (thread) {
+               if (m68k_set_fault_handler(&thread->fault_handler, 
(addr_t)&&error))
+                       goto error;
+       }
+
+       *ip = ((struct stack_frame *)framePointer)->return_address;
+       *next = (addr_t)((struct stack_frame *)framePointer)->previous;
+
+       if (thread)
+               thread->fault_handler = oldFaultHandler;
+       return B_OK;
+
+error:
+       thread->fault_handler = oldFaultHandler;
+       return B_BAD_ADDRESS;
+}
+
+
+static void
+print_stack_frame(struct thread *thread, addr_t ip, addr_t framePointer,
+       addr_t nextFramePointer)
+{
+       addr_t diff = nextFramePointer - framePointer;
+
+       // kernel space/user space switch
+       if (diff & 0x80000000)
+               diff = 0;
+
+       // lookup symbol
+       const char *symbol, *image;
+       addr_t baseAddress;
+       bool exactMatch;
+       status_t status = elf_debug_lookup_symbol_address(ip, &baseAddress, 
&symbol,
+               &image, &exactMatch);
+       if (status != B_OK && !IS_KERNEL_ADDRESS(ip) && thread) {
+               // try to locate the image in the images loaded into user space
+               status = image_debug_lookup_user_symbol_address(thread->team, 
ip,
+                       &baseAddress, &symbol, &image, &exactMatch);
+       }
+       if (status == B_OK) {
+               if (symbol != NULL) {
+                       kprintf("%08lx (+%4ld) %08lx   <%s>:%s + 0x%04lx%s\n", 
framePointer,
+                               diff, ip, image, symbol, ip - baseAddress,
+                               (exactMatch ? "" : " (nearest)"));
+               } else {
+                       kprintf("%08lx (+%4ld) %08lx   <%s@%p>:unknown + 
0x%04lx\n",
+                               framePointer, diff, ip, image, (void 
*)baseAddress,
+                               ip - baseAddress);
+               }
+       } else
+               kprintf("%08lx (+%4ld) %08lx\n", framePointer, diff, ip);
+}
+
+
+static int
+stack_trace(int argc, char **argv)
+{
+       uint32 previousLocations[NUM_PREVIOUS_LOCATIONS];
+       struct iframe_stack *frameStack;
+       struct thread *thread;
+       addr_t framePointer;
+       int32 i, num = 0, last = 0;
+
+       if (argc < 2) {
+               thread = thread_get_current_thread();
+               framePointer = (addr_t)get_current_stack_frame();
+       } else {
+kprintf("Stack traces of other threads not supported yet!\n");
+return 0;
+       }
+
+       // We don't have a thread pointer early in the boot process
+       if (thread != NULL)
+               frameStack = &thread->arch_info.iframes;
+       else
+               frameStack = &gBootFrameStack;
+
+       for (i = 0; i < frameStack->index; i++) {
+               kprintf("iframe %p (end = %p)\n",
+                       frameStack->frames[i], frameStack->frames[i] + 1);
+       }
+
+       if (thread != NULL) {
+               kprintf("stack trace for thread 0x%lx \"%s\"\n", thread->id,
+                       thread->name);
+
+               kprintf("    kernel stack: %p to %p\n",
+                       (void *)thread->kernel_stack_base,
+                       (void *)(thread->kernel_stack_top));
+               if (thread->user_stack_base != 0) {
+                       kprintf("      user stack: %p to %p\n",
+                               (void *)thread->user_stack_base,
+                               (void *)(thread->user_stack_base + 
thread->user_stack_size));
+               }
+       }
+
+       kprintf("frame            caller     <image>:function + offset\n");
+
+       for (;;) {
+               // see if the frame pointer matches the iframe
+               struct iframe *frame = NULL;
+               for (i = 0; i < frameStack->index; i++) {
+                       if (framePointer == (addr_t)frameStack->frames[i]) {
+                               // it's an iframe
+                               frame = frameStack->frames[i];
+                               break;
+                       }
+               }
+
+               if (frame) {
+                       kprintf("iframe at %p\n", frame);
+                       kprintf("   d0 0x%08lx    d1 0x%08lx    d2 0x%08lx    
d3 0x%08lx\n",
+                               frame->d[0], frame->d[1], frame->d[2], 
frame->d[3]);
+                       kprintf("   d4 0x%08lx    d5 0x%08lx    d6 0x%08lx    
d7 0x%08lx\n",
+                               frame->d[4], frame->d[5], frame->d[6], 
frame->d[7]);
+                       kprintf("   a0 0x%08lx    a1 0x%08lx    a2 0x%08lx    
a3 0x%08lx\n",
+                               frame->a[0], frame->a[1], frame->a[2], 
frame->a[3]);
+                       kprintf("   a4 0x%08lx    a5 0x%08lx    a6 0x%08lx    
a7 0x%08lx (sp)\n",
+#warning M68K: a7 in iframe ??
+                               frame->a[4], frame->a[5], frame->a[6], -1L);
+                       kprintf("   pc 0x%08lx        sr 0x%04x\n",
+                               frame->cpu.pc, frame->cpu.sr);
+#warning M68K: missing regs
+
+                       print_stack_frame(thread, frame->cpu.pc, framePointer, 
frame->a[6]);
+                       framePointer = frame->a[6];
+               } else {
+                       addr_t ip, nextFramePointer;
+
+                       if (get_next_frame(framePointer, &nextFramePointer, 
&ip) != B_OK) {
+                               kprintf("%08lx -- read fault\n", framePointer);
+                               break;
+                       }
+
+                       if (ip == 0 || framePointer == 0)
+                               break;
+
+                       print_stack_frame(thread, ip, framePointer, 
nextFramePointer);
+                       framePointer = nextFramePointer;
+               }
+
+               if (already_visited(previousLocations, &last, &num, 
framePointer)) {
+                       kprintf("circular stack frame: %p!\n", (void 
*)framePointer);
+                       break;
+               }
+               if (framePointer == 0)
+                       break;
+       }
+
+
+       return 0;
+}
+
+*/
+
+// #pragma mark -
+
+
+void
+arch_debug_save_registers(int *regs)
+{
+}
+
+
+bool
+arch_debug_contains_call(struct thread *thread, const char *symbol,
+       addr_t start, addr_t end)
+{
+       return false;
+}
+
+
+void *
+arch_debug_get_caller(void)
+{
+#warning ARM:IMPLEMENT
+       // TODO: implement me
+       //return __builtin_frame_address(1);
+//     struct stack_frame *frame;
+       //frame = __builtin_frame_address(0);
+//     frame = get_current_stack_frame();
+//     return (void *)frame->previous->return_address;
+       return NULL;
+}
+
+
+/*!    Captures a stack trace (the return addresses) of the current thread.
+       \param returnAddresses The array the return address shall be written to.
+       \param maxCount The maximum number of return addresses to be captured.
+       \param skipIframes The number of interrupt frames that shall be 
skipped. If
+               greater than 0, \a skipFrames is ignored.
+       \param skipFrames The number of stack frames that shall be skipped.
+       \param userOnly If \c true, only userland return addresses are captured.
+       \return The number of return addresses written to the given array.
+*/
+int32
+arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount,
+       int32 skipIframes, int32 skipFrames, bool userOnly)
+{
+/*     struct iframe_stack *frameStack;
+       addr_t framePointer;
+       int32 count = 0;
+       int32 i, num = 0, last = 0;
+
+       // Keep skipping normal stack frames until we've skipped the iframes 
we're
+       // supposed to skip.
+       if (skipIframes > 0) {
+               skipFrames = INT_MAX;
+       } else {
+               // always skip our own frame
+               skipFrames++;
+       }
+
+       struct thread* thread = thread_get_current_thread();
+       framePointer = (addr_t)get_current_stack_frame();
+
+       // We don't have a thread pointer early in the boot process
+       if (thread != NULL)
+               frameStack = &thread->arch_info.iframes;
+       else
+               frameStack = &gBootFrameStack;
+
+       while (framePointer != 0 && count < maxCount) {
+               // see if the frame pointer matches the iframe
+               struct iframe *frame = NULL;
+               for (i = 0; i < frameStack->index; i++) {
+                       if (framePointer == (addr_t)frameStack->frames[i]) {
+                               // it's an iframe
+                               frame = frameStack->frames[i];
+                               break;
+                       }
+               }
+
+               addr_t ip;
+               addr_t nextFrame;
+
+               if (frame) {
+                       ip = frame->cpu.pc;
+                       nextFrame = frame->a[6];
+
+                       if (skipIframes > 0) {
+                               if (--skipIframes == 0)
+                                       skipFrames = 0;
+                       }
+               } else {
+                       if (get_next_frame(framePointer, &nextFrame, &ip) != 
B_OK)
+                               break;
+               }
+
+               if (skipFrames <= 0 && (!userOnly || 
IS_USER_ADDRESS(framePointer)))
+                       returnAddresses[count++] = ip;
+               else
+                       skipFrames--;
+
+               framePointer = nextFrame;
+       }
+
+       return count;*/
+#warning ARM:IMPLEMENT
+
+       return 0;
+}
+
+
+void*
+arch_debug_get_interrupt_pc()
+{
+       // TODO: Implement!
+       return NULL;
+}
+
+
+bool
+arch_is_debug_variable_defined(const char* variableName)
+{
+       // TODO: Implement!
+       return false;
+}
+
+
+status_t
+arch_set_debug_variable(const char* variableName, uint64 value)
+{
+       // TODO: Implement!
+       return B_ENTRY_NOT_FOUND;
+}
+
+
+status_t
+arch_get_debug_variable(const char* variableName, uint64* value)
+{
+       // TODO: Implement!
+       return B_ENTRY_NOT_FOUND;
+}
+
+
+status_t
+arch_debug_init(kernel_args *args)
+{
+//     add_debugger_command("where", &stack_trace, "Same as \"sc\"");
+//     add_debugger_command("bt", &stack_trace, "Same as \"sc\" (as in gdb)");
+//     add_debugger_command("sc", &stack_trace, "Stack crawl for current 
thread");
+#warning ARM:IMPLEMENT
+
+       return B_NO_ERROR;
+}
+
Index: src/system/kernel/arch/arm/arch_cpu.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_cpu.cpp     (Revision 0)
+++ src/system/kernel/arch/arm/arch_cpu.cpp     (Revision 0)
@@ -0,0 +1,293 @@
+/*
+ * Copyright 2007, François Revol, revol@xxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2003-2005, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2001, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the NewOS License.
+ */
+
+
+#include <KernelExport.h>
+
+//#include <arch_platform.h>
+#include <arch_thread.h>
+#include <arch/cpu.h>
+#include <boot/kernel_args.h>
+#include <commpage.h>
+#include <elf.h>
+
+
+int arch_cpu_type;
+int arch_fpu_type;
+int arch_mmu_type;
+int arch_platform;
+
+status_t 
+arch_cpu_preboot_init_percpu(kernel_args *args, int curr_cpu)
+{
+       // enable FPU
+       //ppc:set_msr(get_msr() | MSR_FP_AVAILABLE);
+
+       // The current thread must be NULL for all CPUs till we have threads.
+       // Some boot code relies on this.
+       arch_thread_set_current_thread(NULL);
+
+       return B_OK;
+}
+
+
+status_t 
+arch_cpu_init_percpu(kernel_args *args, int curr_cpu)
+{
+       //detect_cpu(curr_cpu);
+
+       // we only support one anyway...
+       return 0;
+}
+
+
+status_t
+arch_cpu_init(kernel_args *args)
+{
+       arch_cpu_type = args->arch_args.cpu_type;
+       arch_fpu_type = args->arch_args.fpu_type;
+       arch_mmu_type = args->arch_args.mmu_type;
+       arch_platform = args->arch_args.platform;
+       arch_platform = args->arch_args.machine;
+#warning TODO arch_cpu_init
+       return B_OK;
+}
+
+
+status_t
+arch_cpu_init_post_vm(kernel_args *args)
+{
+       return B_OK;
+}
+
+status_t
+arch_cpu_init_post_modules(kernel_args *args)
+{
+       // add the functions to the commpage image
+       image_id image = get_commpage_image();
+
+       return B_OK;
+}
+
+
+void 
+arch_cpu_sync_icache(void *address, size_t len)
+{
+#warning ARM arch_cpu_sync_icache 
+
+//     cpu_ops.flush_icache((addr_t)address, len);
+}
+
+
+void
+arch_cpu_memory_read_barrier(void)
+{
+       asm volatile ("nop;" : : : "memory");
+#warning M68k: check arch_cpu_memory_read_barrier (FNOP ?)
+}
+
+
+void
+arch_cpu_memory_write_barrier(void)
+{
+       asm volatile ("nop;" : : : "memory");
+#warning M68k: check arch_cpu_memory_write_barrier (FNOP ?)
+}
+
+
+void 
+arch_cpu_invalidate_TLB_range(addr_t start, addr_t end)
+{
+/*     int32 num_pages = end / B_PAGE_SIZE - start / B_PAGE_SIZE;
+       cpu_ops.flush_insn_pipeline();
+       while (num_pages-- >= 0) {
+               cpu_ops.flush_atc_addr(start);
+               cpu_ops.flush_insn_pipeline();
+               start += B_PAGE_SIZE;
+       }
+       cpu_ops.flush_insn_pipeline();
+*/
+#warning WRITEME arch_cpu_invalidate_TLB_range
+}
+
+
+void 
+arch_cpu_invalidate_TLB_list(addr_t pages[], int num_pages)
+{
+/*
+       int i;
+       
+       cpu_ops.flush_insn_pipeline();
+       for (i = 0; i < num_pages; i++) {
+               cpu_ops.flush_atc_addr(pages[i]);
+               cpu_ops.flush_insn_pipeline();
+       }
+       cpu_ops.flush_insn_pipeline();
+*/
+#warning WRITEME arch_cpu_invalidate_TLB_lis
+}
+
+
+void 
+arch_cpu_global_TLB_invalidate(void)
+{
+/*     cpu_ops.flush_insn_pipeline();
+       cpu_ops.flush_atc_all();
+       cpu_ops.flush_insn_pipeline();
+*/
+#warning WRITEME arch_cpu_global_TLB_invalidate
+}
+
+
+void 
+arch_cpu_user_TLB_invalidate(void)
+{/*
+       cpu_ops.flush_insn_pipeline();
+       cpu_ops.flush_atc_user();
+       cpu_ops.flush_insn_pipeline();
+*/
+#warning WRITEME 
+
+}
+
+
+status_t
+arch_cpu_user_memcpy(void *to, const void *from, size_t size,
+       addr_t *faultHandler)
+{
+#warning WRITEME 
+/*
+       char *tmp = (char *)to;
+       char *s = (char *)from;
+       addr_t oldFaultHandler = *faultHandler;
+
+       if (m68k_set_fault_handler(faultHandler, (addr_t)&&error))
+               goto error;
+
+       while (size--)
+               *tmp++ = *s++;
+
+       *faultHandler = oldFaultHandler;
+       return 0;
+
+error:
+       *faultHandler = oldFaultHandler;*/
+       return B_BAD_ADDRESS;
+}
+
+
+/**    \brief Copies at most (\a size - 1) characters from the string in \a 
from to
+ *     the string in \a to, NULL-terminating the result.
+ *
+ *     \param to Pointer to the destination C-string.
+ *     \param from Pointer to the source C-string.
+ *     \param size Size in bytes of the string buffer pointed to by \a to.
+ *     
+ *     \return strlen(\a from).
+ */
+
+ssize_t
+arch_cpu_user_strlcpy(char *to, const char *from, size_t size, addr_t 
*faultHandler)
+{
+#warning WRITEME 
+/*
+       int from_length = 0;
+       addr_t oldFaultHandler = *faultHandler;
+
+       if (m68k_set_fault_handler(faultHandler, (addr_t)&&error))
+               goto error;
+
+       if (size > 0) {
+               to[--size] = '\0';
+               // copy 
+               for ( ; size; size--, from_length++, to++, from++) {
+                       if ((*to = *from) == '\0')
+                               break;
+               }
+       }
+       // count any leftover from chars
+       while (*from++ != '\0')
+               from_length++;
+
+       *faultHandler = oldFaultHandler;
+       return from_length;
+
+error:
+       *faultHandler = oldFaultHandler;*/
+       return B_BAD_ADDRESS;
+}
+
+
+status_t
+arch_cpu_user_memset(void *s, char c, size_t count, addr_t *faultHandler)
+{
+#warning WRITEME 
+
+/*
+       char *xs = (char *)s;
+       addr_t oldFaultHandler = *faultHandler;
+
+       if (m68k_set_fault_handler(faultHandler, (addr_t)&&error))
+               goto error;
+
+       while (count--)
+               *xs++ = c;
+
+       *faultHandler = oldFaultHandler;
+       return 0;
+
+error:
+       *faultHandler = oldFaultHandler;*/
+
+       return B_BAD_ADDRESS;
+}
+
+
+status_t
+arch_cpu_shutdown(bool reboot)
+{
+#warning WRITEME 
+//     M68KPlatform::Default()->ShutDown(reboot);
+       return B_ERROR;
+}
+
+
+void
+arch_cpu_idle(void)
+{
+#warning WRITEME 
+
+//     if (cpu_ops.idle)
+//             cpu_ops.idle();
+//#warning M68K: use LPSTOP ?
+       //asm volatile ("lpstop");
+}
+
+
+// The purpose of this function is to trick the compiler. When setting the
+// page_handler to a label that is obviously (to the compiler) never used,
+// it may reorganize the control flow, so that the labeled part is optimized
+// away.
+// By invoking the function like this
+//
+//     if (m68k_set_fault_handler(faultHandler, (addr_t)&&error))
+//             goto error;
+//
+// the compiler has to keep the labeled code, since it can't guess the return
+// value of this (non-inlinable) function. At least in my tests it worked that
+// way, and I hope it will continue to work like this in the future.
+//
+/*bool
+m68k_set_fault_handler(addr_t *handlerLocation, addr_t handler)
+{
+       *handlerLocation = handler;
+       return false;
+}*/
Index: src/system/kernel/arch/arm/arch_commpage.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_commpage.cpp        (Revision 0)
+++ src/system/kernel/arch/arm/arch_commpage.cpp        (Revision 0)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2007, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include <commpage.h>
+
+#include <string.h>
+
+#include <KernelExport.h>
+
+#include <cpu.h>
+#include <elf.h>
+#include <smp.h>
+
+
+
+status_t
+arch_commpage_init(void)
+{
+       /* no optimized memcpy or anything yet */
+       /* we don't use it for syscall yet either */
+       // add syscall to the commpage image
+//     image_id image = get_commpage_image();
+#warning arch_compage_init ist muell
+       return B_OK;
+}
+
Index: src/system/kernel/arch/arm/Jamfile
===================================================================
--- src/system/kernel/arch/arm/Jamfile  (Revision 0)
+++ src/system/kernel/arch/arm/Jamfile  (Revision 0)
@@ -0,0 +1,40 @@
+SubDir HAIKU_TOP src system kernel arch arm ;
+
+SubDirHdrs $(SUBDIR) $(DOTDOT) generic ;
+UsePrivateKernelHeaders ;
+
+SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
+
+
+KernelMergeObject kernel_arch_arm.o :
+#      arch_atomic.c
+       arch_commpage.cpp
+       arch_cpu.cpp
+#      arch_cpu_asm.S
+       arch_debug_console.cpp
+       arch_debug.cpp
+       arch_elf.cpp
+#      arch_exceptions.S
+       arch_int.cpp
+       arch_platform.cpp
+       arch_real_time_clock.cpp
+       arch_smp.c
+       arch_system_info.cpp
+       arch_thread.c
+       arch_timer.cpp
+       arch_user_debugger.cpp
+       arch_vm.cpp
+       arch_vm_translation_map.cpp
+       arch_asm.S
+       uart.c
+       generic_vm_physical_page_mapper.cpp
+       generic_vm_physical_page_ops.cpp
+#
+       :
+       $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused
+       :
+
+;
+
+CreateAsmStructOffsetsHeader asm_offsets.h : asm_offsets.cpp ;
+
Index: src/system/kernel/arch/arm/arch_int.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_int.cpp     (Revision 0)
+++ src/system/kernel/arch/arm/arch_int.cpp     (Revision 0)
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2003-2006, Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
+ *             Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
+ *             François Revol <revol@xxxxxxx>
+ * Distributed under the terms of the MIT License.
+ *
+ *
+ * Copyright 2001, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the NewOS License.
+ */
+
+#include <int.h>
+
+//#include <arch_platform.h>
+#include <arch/smp.h>
+#include <boot/kernel_args.h>
+#include <device_manager.h>
+#include <kscheduler.h>
+#include <interrupt_controller.h>
+#include <smp.h>
+#include <thread.h>
+#include <timer.h>
+#include <util/DoublyLinkedList.h>
+#include <util/kernel_cpp.h>
+#include <vm.h>
+#include <vm_address_space.h>
+#include <vm_priv.h>
+#include <string.h>
+
+#warning M68K: writeme!
+
+
+//#define TRACE_ARCH_INT
+#ifdef TRACE_ARCH_INT
+#      define TRACE(x) dprintf x
+#else
+#      define TRACE(x) ;
+#endif
+
+/*typedef void (*m68k_exception_handler)(void);
+#define M68K_EXCEPTION_VECTOR_COUNT 256
+#warning M68K: align on 4 ?
+//m68k_exception_handler gExceptionVectors[M68K_EXCEPTION_VECTOR_COUNT];
+m68k_exception_handler *gExceptionVectors;
+
+// defined in arch_exceptions.S
+extern "C" void __m68k_exception_noop(void);
+extern "C" void __m68k_exception_common(void);
+*/
+extern int __irqvec_start;
+extern int __irqvec_end;
+
+//extern"C" void m68k_exception_tail(void);
+
+// current fault handler
+addr_t gFaultHandler;
+
+// An iframe stack used in the early boot process when we don't have
+// threads yet.
+struct iframe_stack gBootFrameStack;
+
+// interrupt controller interface (initialized
+// in arch_int_init_post_device_manager())
+//static struct interrupt_controller_module_info *sPIC;
+//static void *sPICCookie;
+
+
+void 
+arch_int_enable_io_interrupt(int irq)
+{
+#warning ARM WRITEME
+       //if (!sPIC)
+       //      return;
+
+       // TODO: I have no idea, what IRQ type is appropriate.
+       //sPIC->enable_io_interrupt(sPICCookie, irq, IRQ_TYPE_LEVEL);
+//     M68KPlatform::Default()->EnableIOInterrupt(irq);
+}
+
+
+void 
+arch_int_disable_io_interrupt(int irq)
+{
+#warning ARM WRITEME
+
+       //if (!sPIC)
+       //      return;
+
+       //sPIC->disable_io_interrupt(sPICCookie, irq);
+//     M68KPlatform::Default()->DisableIOInterrupt(irq);
+}
+
+
+/* arch_int_*_interrupts() and friends are in arch_asm.S */
+
+
+static void 
+print_iframe(struct iframe *frame)
+{
+/*
+       dprintf("r0-r3:   0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r0, 
frame->r1, frame->r2, frame->r3);
+       dprintf("r4-r7:   0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r4, 
frame->r5, frame->r6, frame->r7);
+       dprintf("r8-r11:  0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r8, 
frame->r9, frame->r10, frame->r11);
+       dprintf("r12-r15: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r12, 
frame->r13, frame->a6, frame->a7);
+       dprintf("      pc 0x%08lx         sr 0x%08lx\n", frame->pc, frame->sr);
+*/
+
+#warning ARM WRITEME
+}
+
+status_t 
+arch_int_init(kernel_args *args)
+{
+       status_t err;
+       addr_t vbr;
+       int i;
+
+//     gExceptionVectors = (m68k_exception_handler *)args->arch_args.vir_vbr;
+
+       /* fill in the vector table */
+//     for (i = 0; i < M68K_EXCEPTION_VECTOR_COUNT; i++)
+//             gExceptionVectors[i] = &__m68k_exception_common;
+
+//     vbr = args->arch_args.phys_vbr;
+       /* point VBR to the new table */
+//     asm volatile  ("movec %0,%%vbr" : : "r"(vbr):);
+#warning ARM WRITEME
+       
+       return B_OK;
+}
+
+
+status_t
+arch_int_init_post_vm(kernel_args *args)
+{
+       status_t err;
+//     err = M68KPlatform::Default()->InitPIC(args);
+#warning ARM WRITEME
+
+       return err;
+}
+
+
+
+status_t
+arch_int_init_post_device_manager(struct kernel_args *args)
+{
+       // no PIC found
+       panic("arch_int_init_post_device_manager(): Found no supported PIC!");
+
+       return B_ENTRY_NOT_FOUND;
+}
+
+
Index: src/system/kernel/arch/arm/uart.c.omap3
===================================================================
--- src/system/kernel/arch/arm/uart.c.omap3     (Revision 0)
+++ src/system/kernel/arch/arm/uart.c.omap3     (Revision 0)
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <debug.h>
+#include <arch/arm/reg.h>
+#include <arch/arm/uart.h>
+#include <arch/arm/omap3.h>
+//#include <target/debugconfig.h>
+
+//TODO: beaglespecific ?...
+#define DEBUG_UART 2
+
+
+
+struct uart_stat {
+       addr_t base;
+       uint shift;
+};
+
+static struct uart_stat uart[3] = {
+       { OMAP_UART1_BASE, 2 },
+       { OMAP_UART2_BASE, 2 },
+       { OMAP_UART3_BASE, 2 },
+};
+
+static inline void write_uart_reg(int port, uint reg, unsigned char data)
+{
+       *(volatile unsigned char *)(uart[port].base + (reg << 
uart[port].shift)) = data;
+}
+
+static inline unsigned char read_uart_reg(int port, uint reg)
+{
+       return *(volatile unsigned char *)(uart[port].base + (reg << 
uart[port].shift));
+}
+
+#define LCR_8N1                0x03
+
+#define FCR_FIFO_EN     0x01           /* Fifo enable */
+#define FCR_RXSR        0x02           /* Receiver soft reset */
+#define FCR_TXSR        0x04           /* Transmitter soft reset */
+
+#define MCR_DTR         0x01
+#define MCR_RTS         0x02
+#define MCR_DMA_EN      0x04
+#define MCR_TX_DFR      0x08
+
+#define LCR_WLS_MSK    0x03            /* character length select mask */
+#define LCR_WLS_5      0x00            /* 5 bit character length */
+#define LCR_WLS_6      0x01            /* 6 bit character length */
+#define LCR_WLS_7      0x02            /* 7 bit character length */
+#define LCR_WLS_8      0x03            /* 8 bit character length */
+#define LCR_STB                0x04            /* Number of stop Bits, off = 
1, on = 1.5 or 2) */
+#define LCR_PEN                0x08            /* Parity eneble */
+#define LCR_EPS                0x10            /* Even Parity Select */
+#define LCR_STKP       0x20            /* Stick Parity */
+#define LCR_SBRK       0x40            /* Set Break */
+#define LCR_BKSE       0x80            /* Bank select enable */
+
+#define LSR_DR         0x01            /* Data ready */
+#define LSR_OE         0x02            /* Overrun */
+#define LSR_PE         0x04            /* Parity error */
+#define LSR_FE         0x08            /* Framing error */
+#define LSR_BI         0x10            /* Break */
+#define LSR_THRE       0x20            /* Xmit holding register empty */
+#define LSR_TEMT       0x40            /* Xmitter empty */
+#define LSR_ERR                0x80            /* Error */
+
+#define LCRVAL LCR_8N1                                 /* 8 data, 1 stop, no 
parity */
+#define MCRVAL (MCR_DTR | MCR_RTS)                     /* RTS/DTR */
+#define FCRVAL (FCR_FIFO_EN | FCR_RXSR | FCR_TXSR)     /* Clear & enable FIFOs 
*/
+
+#define V_NS16550_CLK            (48000000)  /* 48MHz (APLL96/2) */
+
+void uart_init_port(int port, uint baud)
+{
+       /* clear the tx & rx fifo and disable */
+       uint16 baud_divisor = (V_NS16550_CLK / 16 / baud);
+
+       write_uart_reg(port, UART_IER, 0);
+       write_uart_reg(port, UART_LCR, LCR_BKSE | LCRVAL); // config mode A
+       write_uart_reg(port, UART_DLL, baud_divisor & 0xff);
+       write_uart_reg(port, UART_DLH, (baud_divisor >> 8) & 0xff);
+       write_uart_reg(port, UART_LCR, LCRVAL); // operational mode
+       write_uart_reg(port, UART_MCR, MCRVAL);
+       write_uart_reg(port, UART_FCR, FCRVAL);
+       write_uart_reg(port, UART_MDR1, 0); // UART 16x mode
+
+//     write_uart_reg(port, UART_LCR, 0xBF); // config mode B
+//     write_uart_reg(port, UART_EFR, (1<<7)|(1<<6)); // hw flow control
+//     write_uart_reg(port, UART_LCR, LCRVAL); // operational mode
+}
+
+void uart_init_early(void)
+{
+       /* UART1 */
+       RMWREG32(CM_FCLKEN1_CORE, 13, 1, 1),
+       RMWREG32(CM_ICLKEN1_CORE, 13, 1, 1),
+
+       /* UART2 */
+       RMWREG32(CM_FCLKEN1_CORE, 14, 1, 1),
+       RMWREG32(CM_ICLKEN1_CORE, 14, 1, 1),
+
+       /* UART3 */
+       RMWREG32(CM_FCLKEN_PER, 11, 1, 1),
+       RMWREG32(CM_ICLKEN_PER, 11, 1, 1),
+
+       uart_init_port(DEBUG_UART, 115200);
+}
+
+void uart_init(void)
+{
+}
+
+int uart_putc(int port, char c )
+{
+       while (!(read_uart_reg(port, UART_LSR) & (1<<6))) // wait for the last 
char to get out
+               ;
+       write_uart_reg(port, UART_THR, c);
+       return 0;
+}
+
+int uart_getc(int port, bool wait)  /* returns -1 if no data available */
+{
+       if (wait) {
+               while (!(read_uart_reg(port, UART_LSR) & (1<<0))) // wait for 
data to show up in the rx fifo
+                       ;
+       } else {
+               if (!(read_uart_reg(port, UART_LSR) & (1<<0)))
+                       return -1;
+       }
+       return read_uart_reg(port, UART_RHR);
+}
+
+void uart_flush_tx(int port)
+{
+       while (!(read_uart_reg(port, UART_LSR) & (1<<6))) // wait for the last 
char to get out
+               ;
+}
+
+void uart_flush_rx(int port)
+{
+       // empty the rx fifo
+       while (read_uart_reg(port, UART_LSR) & (1<<0)) {
+               volatile char c = read_uart_reg(port, UART_RHR);
+               (void)c;
+       }
+}
+
+
Index: src/system/kernel/arch/arm/arch_vm_translation_map.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_vm_translation_map.cpp      (Revision 0)
+++ src/system/kernel/arch/arm/arch_vm_translation_map.cpp      (Revision 0)
@@ -0,0 +1,119 @@
+/*
+ * Copyright 1007, François Revol, revol@xxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2003-2007, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Distributed under the terms of the MIT License.
+ *
+ * Copyright 2001, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the NewOS License.
+ */
+
+#include <KernelExport.h>
+#include <kernel.h>
+#include <vm.h>
+#include <vm_address_space.h>
+#include <vm_priv.h>
+#include <int.h>
+#include <boot/kernel_args.h>
+#include <arch/vm_translation_map.h>
+#include <arch/cpu.h>
+//#include <arch_mmu.h>
+#include <stdlib.h>
+
+#include "generic_vm_physical_page_mapper.h"
+
+
+
+void *
+m68k_translation_map_get_pgdir(vm_translation_map *map)
+{
+       return NULL;
+#warning ARM:WRITEME
+//get_vm_ops()->m68k_translation_map_get_pgdir(map);
+}
+
+//  #pragma mark -
+//  VM API
+
+
+status_t
+arch_vm_translation_map_init_map(vm_translation_map *map, bool kernel)
+{
+       return NULL;
+#warning ARM:WRITEME
+
+//get_vm_ops()->arch_vm_translation_map_init_map(map, kernel);
+}
+
+
+status_t
+arch_vm_translation_map_init_kernel_map_post_sem(vm_translation_map *map)
+{
+       return NULL;
+#warning ARM:WRITEME
+
+//get_vm_ops()->arch_vm_translation_map_init_kernel_map_post_sem(map);
+}
+
+
+status_t
+arch_vm_translation_map_init(kernel_args *args)
+{
+       return NULL;
+#warning ARM:WRITEME
+
+//get_vm_ops()->arch_vm_translation_map_init(args);
+}
+
+
+status_t
+arch_vm_translation_map_init_post_area(kernel_args *args)
+{
+       return NULL;
+#warning ARM:WRITEME
+
+//get_vm_ops()->arch_vm_translation_map_init_post_area(args);
+}
+
+
+status_t
+arch_vm_translation_map_init_post_sem(kernel_args *args)
+{
+       return NULL;
+#warning ARM:WRITEME
+
+//get_vm_ops()->arch_vm_translation_map_init_post_sem(args);
+}
+
+
+/**    Directly maps a page without having knowledge of any kernel structures.
+ *     Used only during VM setup.
+ *     It currently ignores the "attributes" parameter and sets all pages
+ *     read/write.
+ */
+
+status_t
+arch_vm_translation_map_early_map(kernel_args *ka, addr_t virtualAddress, 
addr_t physicalAddress, 
+       uint8 attributes, addr_t (*get_free_page)(kernel_args *))
+{
+       return NULL;
+#warning ARM:WRITEME
+
+//get_vm_ops()->arch_vm_translation_map_early_map(ka, virtualAddress, 
physicalAddress,
+//             attributes, get_free_page);
+}
+
+
+// XXX currently assumes this translation map is active
+
+status_t 
+arch_vm_translation_map_early_query(addr_t va, addr_t *out_physical)
+{
+       return NULL;
+#warning ARM:WRITEME
+
+//get_vm_ops()->arch_vm_translation_map_early_query(va, out_physical);
+}
+
+
Index: src/system/kernel/arch/arm/arch_smp.c
===================================================================
--- src/system/kernel/arch/arm/arch_smp.c       (Revision 0)
+++ src/system/kernel/arch/arm/arch_smp.c       (Revision 0)
@@ -0,0 +1,46 @@
+/* 
+ * Copyright 2007, Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             François Revol <revol@xxxxxxx>
+ *
+ * Copyright 2004, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx
+ * Distributed under the terms of the OpenBeOS License.
+ */
+
+
+#include <KernelExport.h>
+
+#include <boot/stage2.h>
+#include <arch/smp.h>
+#include <debug.h>
+
+
+status_t
+arch_smp_init(kernel_args *args)
+{
+       return B_OK;
+}
+
+
+status_t
+arch_smp_per_cpu_init(kernel_args *args, int32 cpu)
+{
+       return B_OK;
+}
+
+
+void
+arch_smp_send_ici(int32 target_cpu)
+{
+       panic("called arch_smp_send_ici!\n");
+}
+
+
+void
+arch_smp_send_broadcast_ici()
+{
+       panic("called arch_smp_send_broadcast_ici\n");
+}
+
Index: src/system/kernel/arch/arm/arch_system_info.cpp
===================================================================
--- src/system/kernel/arch/arm/arch_system_info.cpp     (Revision 0)
+++ src/system/kernel/arch/arm/arch_system_info.cpp     (Revision 0)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2007, Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             François Revol <revol@xxxxxxx>
+ *
+ * Copyright 2006, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>.
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+
+#include <OS.h>
+
+#include <arch_cpu.h>
+//#include <arch_platform.h>
+#include <arch/system_info.h>
+#include <boot/kernel_args.h>
+
+
+static uint64 sCPUClockFrequency;
+static uint64 sBusClockFrequency;
+static enum cpu_types sCPUType;
+static uint16 sCPURevision;
+
+status_t
+arch_get_system_info(system_info *info, size_t size)
+{
+       info->cpu_type = sCPUType;
+       info->cpu_revision = sCPURevision;
+
+       info->cpu_clock_speed = sCPUClockFrequency;
+       info->bus_clock_speed = sBusClockFrequency;
+
+//     info->platform_type = M68KPlatform::Default()->PlatformType();
+
+       return B_OK;
+}
+
+
+status_t
+arch_system_info_init(struct kernel_args *args)
+{
+
+       int i;
+
+       sCPUClockFrequency = args->arch_args.cpu_frequency;
+       sBusClockFrequency = args->arch_args.bus_frequency;
+
+       sCPURevision = args->arch_args.cpu_type; //XXX
+#warning ARM:WRITEME
+//     sCPUType = B_CPU_M68K;
+       
+       return B_OK;
+}
Index: src/system/kernel/arch/arm/arch_asm.S
===================================================================
--- src/system/kernel/arch/arm/arch_asm.S       (Revision 0)
+++ src/system/kernel/arch/arm/arch_asm.S       (Revision 0)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2006, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>.
+ * All rights reserved. Distributed under the terms of the MIT License.
+ *
+ * Copyright 2003, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the NewOS License.
+ */
+
+#include <arch/arm/arch_cpu.h>
+
+#include <asm_defs.h>
+
+.text
+
+
+
+/* void arch_int_enable_interrupts(void) */
+FUNCTION(arch_int_enable_interrupts):
+        mrs     r0, cpsr
+        bic     r0, r0, #(1<<7)         /* clear the I bit */
+        msr     cpsr_c, r0
+        bx      lr
+FUNCTION_END(arch_int_enable_interrupts)
+
+
+/* int arch_int_disable_interrupts(void) 
+ */
+FUNCTION(arch_int_disable_interrupts):
+        mrs     r0, cpsr
+        orr     r0, r0, #(1<<7)
+        msr     cpsr_c, r0
+        bx      lr
+FUNCTION_END(arch_int_disable_interrupts)
+
+
+/* void arch_int_restore_interrupts(int oldState) 
+ */
+FUNCTION(arch_int_restore_interrupts):
+       mrs     r1, cpsr
+       orr     r0,r0, #(1<<7)
+       bic     r1, r1,#(1<<7) 
+        orr     r1, r1, r0
+        msr     cpsr_c, r1
+       bx      lr
+FUNCTION_END(arch_int_restore_interrupts)
+
+
+/* bool arch_int_are_interrupts_enabled(void) */
+FUNCTION(arch_int_are_interrupts_enabled):
+        mrs     r0, cpsr
+        and     r0, r0, #(1<<7)                /*read the I bit*/
+       mvn     r0, r0                  /*negate it since 1 means disabled 
interrupts*/
+       bx      lr
+FUNCTION_END(arch_int_are_interrupts_enabled)
+
+
Index: src/system/boot/platform/u-boot/Jamfile
===================================================================
--- src/system/boot/platform/u-boot/Jamfile     (Revision 0)
+++ src/system/boot/platform/u-boot/Jamfile     (Revision 0)
@@ -0,0 +1,41 @@
+SubDir HAIKU_TOP src system boot platform u-boot ;
+
+SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform 
$(TARGET_BOOT_PLATFORM) ;
+
+UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ;
+UsePrivateHeaders [ FDirName kernel platform $(TARGET_BOOT_PLATFORM) ] ;
+UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
+#UsePrivateHeaders [ FDirName graphics common ] ;
+UsePrivateHeaders [ FDirName storage ] ;
+
+{
+       local defines = _BOOT_MODE ;
+
+       defines = [ FDefines $(defines) ] ;
+       SubDirCcFlags $(defines) -Wall -Wno-multichar ;
+       SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-rtti ;
+}
+
+#SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
+
+
+
+KernelMergeObject boot_platform_u-boot_other.o :
+       start.c
+       : -fno-pic
+;
+
+KernelMergeObject boot_platform_u-boot.o :
+       : :
+       boot_platform_u-boot_other.o
+;
+
+
+
+SEARCH on [ FGristFiles text_menu.cpp ]
+       = [ FDirName $(HAIKU_TOP) src system boot platform generic ] ;
+
+# Tell the build system to where stage1.bin can be found, so it can be used
+# elsewhere.
+SEARCH on stage1.bin = $(SUBDIR) ;
+
Index: src/system/boot/platform/u-boot/start.c
===================================================================
--- src/system/boot/platform/u-boot/start.c     (Revision 0)
+++ src/system/boot/platform/u-boot/start.c     (Revision 0)
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2003-2006, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights 
reserved.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+*#include <KernelExport.h>
+#include <boot/platform.h>
+#include <boot/heap.h>
+#include <boot/stage2.h>
+#include <arch/cpu.h>
+
+#include <string.h>
+/*
+#include "console.h"
+#include "cpu.h"
+#include "mmu.h"
+#include "keyboard.h"
+#include "toscalls.h"
+*/
+
+#define HEAP_SIZE 65536
+
+// GCC defined globals
+extern void (*__ctor_list)(void);
+extern void (*__ctor_end)(void);
+extern uint8 __bss_start;
+extern uint8 _end;
+
+extern int main(stage2_args *args);
+void _start(void);
+
+
+uint32 sBootOptions;
+
+
+static void
+clear_bss(void)
+{
+       memset(&__bss_start, 0, &_end - &__bss_start);
+}
+
+
+static void
+call_ctors(void)
+{
+       void (**f)(void);
+
+       for (f = &__ctor_list; f < &__ctor_end; f++) {          
+               (**f)();
+       }
+}
+
+
+uint32
+platform_boot_options(void)
+{
+       return sBootOptions;
+}
+
+
+void
+platform_start_kernel(void)
+{
+       static struct kernel_args *args = &gKernelArgs;
+               // something goes wrong when we pass &gKernelArgs directly
+               // to the assembler inline below - might be a bug in GCC
+               // or I don't see something important...
+       addr_t stackTop = gKernelArgs.cpu_kstack[0].start + 
gKernelArgs.cpu_kstack[0].size;
+
+       //smp_init_other_cpus();
+       //serial_cleanup();
+       mmu_init_for_kernel();
+       //smp_boot_other_cpus();
+/*
+#warning M68K: stop ints
+       
+       dprintf("kernel entry at %lx\n", 
gKernelArgs.kernel_image.elf_header.e_entry);
+
+       asm volatile (
+               "move.l %0,%%sp;        "                       // move stack 
out of way
+               : : "m" (stackTop));
+
+       asm volatile (
+               "or     #0x0700,%%sr; " : : );          // disable interrupts
+
+       asm volatile (
+               "move.l  #0x0,-(%%sp); "                // we're the BSP cpu (0)
+               "move.l         %0,-(%%sp);     "               // kernel args
+               "move.l         #0x0,-(%%sp);"          // dummy retval for 
call to main
+               "move.l         %1,-(%%sp);     "               // this is the 
start address
+               "rts;           "                                       // jump.
+               : : "g" (args), "g" 
(gKernelArgs.kernel_image.elf_header.e_entry));
+
+       // Huston, we have a problem!
+
+       asm volatile (
+               "and    #0xf8ff,%%sr; " : : );          // reenable interrupts
+*/
+       panic("kernel returned!\n");
+
+}
+
+
+void
+platform_exit(void)
+{
+       // Terminate
+       // XXX: Puntaes() instead ?
+       Pterm0();
+}
+
+
+void
+_start(void)
+{
+       stage2_args args;
+/*     Bconout(DEV_CON, 'H');
+
+
+       //asm("cld");                   // Ain't nothing but a GCC thang.
+       //asm("fninit");                // initialize floating point unit
+
+       clear_bss();
+       Bconout(DEV_CON, 'A');
+       call_ctors();
+               // call C++ constructors before doing anything else
+       Bconout(DEV_CON, 'I');
+
+       args.heap_size = HEAP_SIZE;
+       
+       // so we can dprintf
+       init_nat_features();
+
+       //serial_init();
+       Bconout(DEV_CON, 'K');
+       console_init();
+       Bconout(DEV_CON, 'U');
+       dprintf("membot  = %p\n", *TOSVAR_membot);
+       dprintf("memtop  = %p\n", *TOSVAR_memtop);
+       dprintf("v_bas_ad= %p\n", *TOSVAR_v_bas_ad);
+       dprintf("phystop = %p\n", *TOSVARphystop);
+       dprintf("ramtop  = %p\n", *TOSVARramtop);
+       cpu_init();
+       mmu_init();
+
+       // wait a bit to give the user the opportunity to press a key
+       spin(750000);
+
+       // reading the keyboard doesn't seem to work in graphics mode (maybe a 
bochs problem)
+       sBootOptions = check_for_boot_keys();
+       //if (sBootOptions & BOOT_OPTION_DEBUG_OUTPUT)
+               //serial_enable();
+*/
+       //apm_init();
+       //smp_init();
+       main(&args);
+}
+
Index: src/system/ldscripts/arm/kernel.ld
===================================================================
--- src/system/ldscripts/arm/kernel.ld  (Revision 0)
+++ src/system/ldscripts/arm/kernel.ld  (Revision 0)
@@ -0,0 +1,83 @@
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+
+ENTRY(_start)
+SECTIONS
+{
+       . =  0xa2500000;
+/*     . =  0x80000000;*/
+
+       .interp : { *(.interp) }
+       .hash : { *(.hash) }
+       .dynsym : { *(.dynsym) }
+       .dynstr : { *(.dynstr) }
+       .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) }
+       .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
+       .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
+       .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
+       .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
+       .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
+       .rel.got : { *(.rel.got) }
+       .rela.got : { *(.rela.got) }
+       .rel.ctors : { *(.rel.ctors) }
+       .rela.ctors : { *(.rela.ctors) }
+       .rel.dtors : { *(.rel.dtors) }
+       .rela.dtors : { *(.rela.dtors) }
+       .rel.init : { *(.rel.init) }
+       .rela.init : { *(.rela.init) }
+       .rel.fini : { *(.rel.fini) }
+       .rela.fini : { *(.rela.fini) }
+       .rel.bss : { *(.rel.bss) }
+       .rela.bss : { *(.rela.bss) }
+       .rel.plt : { *(.rel.plt) }
+       .rela.plt : { *(.rela.plt) }
+       .init : { *(.init) } =0x9090
+       .plt : { *(.plt) }
+
+       /* text/read-only data */
+       .text : { *(.text .text.* .glue_7* .gnu.linkonce.t.*) } =0x9090
+
+       .rodata : { 
+               *(.rodata .rodata.* .gnu.linkonce.r.*)
+               . = ALIGN(4);
+               __commands_start = .;
+               KEEP (*(.commands))
+               __commands_end = .;
+               . = ALIGN(4);
+               __apps_start = .;
+               KEEP (*(.apps))
+               __apps_end = .;
+               . = ALIGN(4); 
+               __rodata_end = . ;              
+       }
+
+       /* writable data  */
+       __data_start_rom = .;   /* in one segment binaries, the rom data 
address is on top of the ram data address */
+       __data_start = .;
+       .data : SUBALIGN(4) { *(.data .data.* .gnu.linkonce.d.*) }
+
+       __ctor_list = .;
+       .ctors : { *(.ctors) }
+       __ctor_end = .;
+       __dtor_list = .;
+       .dtors : { *(.dtors) }
+       __dtor_end = .;
+       .got : { *(.got.plt) *(.got) }
+       .dynamic : { *(.dynamic) }
+
+       __data_end = .;
+
+       /* unintialized data (in same segment as writable data) */
+       . = ALIGN(4);
+       __bss_start = .;
+       .bss : { *(.bss .bss.*) }
+
+       . = ALIGN(4); 
+       _end = .;
+
+/*     . =  0x80000000 + %MEMSIZE%; */
+       _end_of_ram = .;
+
+       /* Strip unnecessary stuff */
+       /DISCARD/ : { *(.comment .note .eh_frame) }
+}
Index: src/system/libroot/os/arch/arm/byteorder.S
===================================================================
--- src/system/libroot/os/arch/arm/byteorder.S  (Revision 0)
+++ src/system/libroot/os/arch/arm/byteorder.S  (Revision 0)
@@ -0,0 +1,52 @@
+/*
+** Copyright 2003, Axel D�fler, axeld@xxxxxxxxxxxxxxxxx All rights reserved.
+** Distributed under the terms of the OpenBeOS License.
+*/
+
+#include <asm_defs.h>
+
+.text
+
+/* uint16 __swap_int16(uint16 value)
+ */
+FUNCTION(__swap_int16):
+               rev16 r0,r0;
+FUNCTION_END(__swap_int16)
+
+/* uint32 __swap_int32(uint32 value)
+ */
+FUNCTION(__swap_int32):
+               rev r0,r0;
+FUNCTION_END(__swap_int32)
+
+/* uint64 __swap_int64(uint64 value)
+ */
+FUNCTION(__swap_int64):
+               rev r0,r0;
+               rev r1,r1;
+               mov r12,r0;
+               mov r0,r1;
+               mov r1,r12;
+FUNCTION_END(__swap_int64)
+
+/* TODO: The following functions can surely be optimized. A simple optimization
+ * would be to define macros with the contents of the __swap_int{32,64}
+ * functions and use those instead of calling the functions.
+ */
+
+/* float __swap_float(float value)
+ */
+FUNCTION(__swap_float):
+               b               __swap_int32
+               //rts
+FUNCTION_END(__swap_float)
+
+
+/* double __swap_double(double value)
+ */
+FUNCTION(__swap_double):
+               b               __swap_int32
+               //rts
+#warning M68K: XXX:check sizeof(double)
+FUNCTION_END(__swap_double)
+
Index: src/system/libroot/os/arch/arm/system_time.c
===================================================================
--- src/system/libroot/os/arch/arm/system_time.c        (Revision 0)
+++ src/system/libroot/os/arch/arm/system_time.c        (Revision 0)
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2006, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>.
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+
+#include <OS.h>
+
+#include <arch_cpu.h>
+#include <libroot_private.h>
+#include <real_time_data.h>
+
+
+bigtime_t
+system_time(void)
+{
+#warning ARM:WRITEME
+       return 0;
+}
Index: src/system/libroot/os/arch/arm/atomic.S
===================================================================
--- src/system/libroot/os/arch/arm/atomic.S     (Revision 0)
+++ src/system/libroot/os/arch/arm/atomic.S     (Revision 0)
@@ -0,0 +1,225 @@
+/*
+** Copyright 2003, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved.
+** Distributed under the terms of the OpenBeOS License.
+*/
+
+#include <asm_defs.h>
+
+
+.text
+
+/* int atomic_add(int *value, int increment)
+ */
+FUNCTION(atomic_add):
+#if ARM_ISA_ARMV6 || ARM_ISA_ARMV7
+miss1:         ldrex       r12, [r0]
+               add         r2,  r12, r1
+               strex       r3,  r2,  [r0]
+               teq         r3,  #0
+               bne         miss1
+               mov         r0,  r12
+               mov         pc,  lr
+#else
+        /* disable interrupts, do the add, and reenable */
+        mrs     r2, cpsr
+        mov     r12, r2
+        orr     r2, r2, #(3<<6)
+        msr     cpsr_c, r2
+
+        /* ints disabled, old cpsr state in r12 */
+
+        /* do the add, leave the previous value in r0 */
+        mov     r3, r0
+        ldr     r0, [r3]
+        add     r2, r0, r1
+        str     r2, [r3]
+
+        /* restore interrupts and exit */
+        msr     cpsr_c, r12
+        bx      lr
+#endif
+FUNCTION_END(atomic_add)
+
+
+
+
+/* int atomic_and(int *value, int andValue)
+ */
+FUNCTION(atomic_and):
+#if ARM_ISA_ARMV6 || ARM_ISA_ARMV7
+miss2:         ldrex       r12, [r0]
+               and         r2,  r12, r1
+               strex       r3,  r2,  [r0]
+               teq         r3,  #0
+               bne         miss2
+               mov         r0,  r12
+               mov         pc,  lr
+#else
+        /* disable interrupts, do the and, and reenable */
+        mrs     r2, cpsr
+        mov     r12, r2
+        orr     r2, r2, #(3<<6)
+        msr     cpsr_c, r2
+
+        /* ints disabled, old cpsr state in r12 */
+
+        /* do the and, leave the previous value in r0 */
+        mov     r3, r0
+        ldr     r0, [r3]
+        and     r2, r0, r1
+        str     r2, [r3]
+
+        /* restore interrupts and exit */
+        msr     cpsr_c, r12
+        bx      lr
+#endif
+
+FUNCTION_END(atomic_and)
+
+/* int atomic_or(int *value, int orValue)
+ */
+FUNCTION(atomic_or):
+#if ARM_ISA_ARMV6 || ARM_ISA_ARMV7
+
+miss3:         ldrex       r12, [r0]
+               eor         r2,  r12, r1
+               strex       r3,  r2,  [r0]
+               teq         r3,  #0
+               bne         miss3
+               mov         r0,  r12
+               mov         pc,  lr
+#else
+        /* disable interrupts, do the or, and reenable */
+        mrs     r2, cpsr
+        mov     r12, r2
+        orr     r2, r2, #(3<<6)
+        msr     cpsr_c, r2
+
+        /* ints disabled, old cpsr state in r12 */
+
+        /* do the or, leave the previous value in r0 */
+        mov     r3, r0
+        ldr     r0, [r3]
+        orr     r2, r0, r1
+        str     r2, [r3]
+
+        /* restore interrupts and exit */
+        msr     cpsr_c, r12
+        bx      lr
+#endif
+
+FUNCTION_END(atomic_or)
+
+/* int atomic_set(int *value, int setTo)
+ */
+FUNCTION(atomic_set):
+miss4:         ldrex   r12, [r0]
+                       strex   r3, r1, [r0]
+                       teq     r3, #0
+                       bne     miss4
+               mov         pc,  lr
+FUNCTION_END(atomic_set)
+
+/* int atomic_test_and_set(int *value, int setTo, int testValue) 
+ */
+FUNCTION(atomic_test_and_set):
+/*miss5:  ldrex       r12, [r0]                       @ load from the address 
and mark it exclusive
+        cmp         r12, r2                         @ compare the value with 
the comperand(r2)
+        strexeq     r3,  r1,  [r0]                  @ if they were equal, 
attempt to store the new value (r1)
+        bne         differ                          @ if they were not equal 
jump to (differ) which clears the exclusive tag on the address and returns<
+        cmp         r3,  #1                         @ check the status of the 
store (returned in r3)
+        beq         miss5                           @ go back to the start if 
it failed (0=success, 1=failure)
+        bne         same                            @ if it succeeded, jump to 
(same) and return. there is no need to clrex if strex succeeded
+differ: clrex                                      @ clrex
+same:   mov         r0,  r12*/
+#warning TODO TODO TODO
+        mov         pc,  lr
+FUNCTION_END(atomic_test_and_set)
+
+/* int atomic_get(int *value) 
+ */
+#warning ARM:atomic_get ich nix verstehen !!!!!!!!!!!!
+FUNCTION(atomic_get):
+        mov         pc,  lr
+FUNCTION_END(atomic_get)
+
+
+/* int64       atomic_add64(vint64 *value, int64 addValue) */
+//FUNCTION(atomic_add64):
+//             movem.l %d2-%d3/%a2,-(%a7)
+//             move.l  (4,%a7),%a2
+//             lea.l   (4,%a2),%a1
+//             // addValue
+//             move.l  (12,%a7),%d3    /*LSB*/
+//             move.l  (8,%a7),%d2             /*MSB*/
+//miss5:       // old value
+//             move.l  (%a1),%d1               /*LSB*/
+//             move.l  (%a2),%d0               /*MSB*/
+//             add.l   %d1,%d3
+//             addx.l  %d0,%d2
+//             cas2.l  %d0:%d1,%d2:%d3,(%a2):(%a1)
+//             bne             miss5
+//             // return value d0:d1
+//             movem.l (%a7)+,%d2-%d3/%a2
+//             rts
+//FUNCTION_END(atomic_add64)
+
+/* int64       atomic_and64(vint64 *value, int64 andValue) */
+//FUNCTION(atomic_and64):
+//FUNCTION_END(atomic_and64)
+
+/* int64       atomic_or64(vint64 *value, int64 orValue) */
+//FUNCTION(atomic_or64):
+//FUNCTION_END(atomic_or64)
+
+/* int64       atomic_set64(vint64 *value, int64 newValue) */
+//FUNCTION(atomic_set64):
+//             movem.l %d2-%d3/%a2,-(%a7)
+//             move.l  (4,%a7),%a2
+//             lea.l   (4,%a2),%a1
+//             // new value
+//             move.l  (12,%a7),%d3    /*LSB*/
+//             move.l  (8,%a7),%d2             /*MSB*/
+//             // old value
+//             move.l  (%a1),%d1               /*LSB*/
+//             move.l  (%a2),%d0               /*MSB*/
+//miss8:       cas2.l  %d0:%d1,%d2:%d3,(%a2):(%a1)
+//             bne             miss8
+//             // return value d0:d1
+//             movem.l (%a7)+,%d2-%d3/%a2
+//             rts
+//FUNCTION_END(atomic_set64)
+
+/* int64       atomic_test_and_set64(vint64 *value, int64 newValue, int64 
testAgainst) */
+//FUNCTION(atomic_test_and_set64):
+//             movem.l %d2-%d3/%a2,-(%a7)
+//             move.l  (4,%a7),%a2
+//             lea.l   (4,%a2),%a1
+//             // new value
+//             move.l  (12,%a7),%d3    /*LSB*/
+//             move.l  (8,%a7),%d2             /*MSB*/
+//             // test against value
+//             move.l  (20,%a7),%d1    /*LSB*/
+//             move.l  (16,%a7),%d0    /*MSB*/
+//             cas2.l  %d0:%d1,%d2:%d3,(%a2):(%a1)
+//             // return value d0:d1
+//             movem.l (%a7)+,%d2-%d3/%a2
+//             rts
+//FUNCTION_END(atomic_test_and_set64)
+
+/* int64       atomic_get64(vint64 *value) */
+//FUNCTION(atomic_get64):
+//             movem.l %d2-%d3/%a2,-(%a7)
+//             move.l  (4,%a7),%a2
+//             lea.l   (4,%a2),%a1
+//             move.l  (%a1),%d1       /*LSB*/
+//             move.l  (%a2),%d0               /*MSB*/
+//             move.l  %d1,%d3
+//             move.l  %d0,%d2
+//             // we must use cas... so we change to the same value if 
matching,
+//             // else we get the correct one anyway
+//             cas2.l  %d0:%d1,%d2:%d3,(%a2):(%a1)
+//             // return value
+//             movem.l (%a7)+,%d2-%d3/%a2
+//             rts
+//FUNCTION_END(atomic_get64)
Index: src/system/libroot/posix/stdlib/strtod.c
===================================================================
--- src/system/libroot/posix/stdlib/strtod.c    (Revision 30984)
+++ src/system/libroot/posix/stdlib/strtod.c    (Arbeitskopie)
@@ -115,7 +115,7 @@
 
 #if defined(__i386__) || defined(__ia64__) || defined(__alpha__) || \
     defined(__sparc64__) || defined(__powerpc__) || defined(__POWERPC__) || \
-    defined(__m68k__) || defined(__M68K__)
+    defined(__m68k__) || defined(__M68K__) || defined(__arm__) || 
defined(__ARM__)
 #      include <sys/types.h>
 #      if BYTE_ORDER == BIG_ENDIAN
 #              define IEEE_BIG_ENDIAN
Index: src/system/libroot/posix/arch/arm/sigsetjmp.S
===================================================================
--- src/system/libroot/posix/arch/arm/sigsetjmp.S       (Revision 0)
+++ src/system/libroot/posix/arch/arm/sigsetjmp.S       (Revision 0)
@@ -0,0 +1,36 @@
+/* 
+ * Copyright 2005, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>. All rights
+ * reserved. Distributed under the terms of the Haiku License.
+ */
+
+#include <asm_defs.h>
+
+//#include "setjmp_internal.h"
+
+/* int sigsetjmp(jmp_buf buffer, int saveMask) */
+FUNCTION(__sigsetjmp):
+FUNCTION(sigsetjmp):
+        stmia   r0, {r0-r14}
+        str     lr,[r0, #60]
+        mrs     r1,cpsr
+        str     r1,[r0,#64]
+        ldr     r1,[r0,#4]
+        mov     r0, #0
+
+       bl              __setjmp_save_sigs
+FUNCTION_END(__sigsetjmp)
+FUNCTION_END(sigsetjmp)
+
+
+/* int setjmp(jmp_buf buffer) */
+FUNCTION(setjmp):
+        stmia   r0, {r0-r14}
+        str     lr,[r0, #60]
+        mrs     r1,cpsr
+        str     r1,[r0,#64]
+        ldr     r1,[r0,#4]
+        mov     r0, #0
+       bl      __sigsetjmp
+FUNCTION_END(setjmp)
+
+#pragma weak _setjmp=setjmp
Index: src/system/libroot/posix/arch/arm/siglongjmp.S
===================================================================
--- src/system/libroot/posix/arch/arm/siglongjmp.S      (Revision 0)
+++ src/system/libroot/posix/arch/arm/siglongjmp.S      (Revision 0)
@@ -0,0 +1,22 @@
+/* 
+ * Copyright 2005, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>. All rights
+ * reserved. Distributed under the terms of the Haiku License.
+ */
+
+#include <asm_defs.h>
+
+//#include "setjmp_internal.h"
+
+/* int __siglongjmp(jmp_buf buffer, int value) */
+FUNCTION(siglongjmp):
+FUNCTION(longjmp):
+FUNCTION(_longjmp):
+       str    r1,[r0]
+        ldmia          r0,{r0-pc}^
+
+       bl      __longjmp_return
+FUNCTION_END(siglongjmp)
+FUNCTION_END(longjmp)
+FUNCTION_END(_longjmp)
+
+#pragma weak longjmp=siglongjmp
Index: src/system/libroot/posix/string/arch/arm/arch_string.S
===================================================================
--- src/system/libroot/posix/string/arch/arm/arch_string.S      (Revision 0)
+++ src/system/libroot/posix/string/arch/arm/arch_string.S      (Revision 0)
@@ -0,0 +1,156 @@
+/*
+** Copyright 2001, Travis Geiselbrecht. All rights reserved.
+** Distributed under the terms of the NewOS License.
+*/
+
+#include <asm_defs.h>
+
+//#warning M68K: optimize memcpy
+#if 1
+
+/* that should be enough for now */
+
+.align 4
+FUNCTION(memcpy):
+       // check for zero length copy or the same pointer
+       cmp             r2, #0
+       cmpne   r1, r0
+       bxeq    lr
+
+       // save a few registers for use and the return code (input dst)
+       stmfd   sp!, {r0, r4, r5, lr}
+
+       // check for forwards overlap (src > dst, distance < len)
+       subs    r3, r0, r1
+       cmpgt   r2, r3
+       bgt             .L_forwardoverlap
+
+       // check for a short copy len.
+       // 20 bytes is enough so that if a 16 byte alignment needs to happen 
there is at least a 
+       //   wordwise copy worth of work to be done.
+       cmp             r2, #(16+4)
+       blt             .L_bytewise
+
+       // see if they are similarly aligned on 4 byte boundaries
+       eor             r3, r0, r1
+       tst             r3, #3
+       bne             .L_bytewise             // dissimilarly aligned, 
nothing we can do (for now)
+
+       // check for 16 byte alignment on dst.
+       // this will also catch src being not 4 byte aligned, since it is 
similarly 4 byte 
+       //   aligned with dst at this point.
+       tst             r0, #15
+       bne             .L_not16bytealigned
+
+       // check to see if we have at least 32 bytes of data to copy.
+       // if not, just revert to wordwise copy
+       cmp             r2, #32
+       blt             .L_wordwise
+
+.L_bigcopy:
+       // copy 32 bytes at a time. src & dst need to be at least 4 byte 
aligned, 
+       // and we need at least 32 bytes remaining to copy
+
+       // save r6-r7 for use in the big copy
+       stmfd   sp!, {r6-r7}
+
+       sub             r2, r2, #32             // subtract an extra 32 to the 
len so we can avoid an extra compare
+
+.L_bigcopy_loop:
+       ldmia   r1!, {r4, r5, r6, r7}
+       stmia   r0!, {r4, r5, r6, r7}
+       ldmia   r1!, {r4, r5, r6, r7}
+       subs    r2, r2, #32
+       stmia   r0!, {r4, r5, r6, r7}
+       bge             .L_bigcopy_loop
+
+       // restore r6-r7
+       ldmfd   sp!, {r6-r7}
+
+       // see if we are done
+       adds    r2, r2, #32
+       beq             .L_done
+
+       // less then 4 bytes left?
+       cmp             r2, #4
+       blt             .L_bytewise
+
+.L_wordwise:
+       // copy 4 bytes at a time.
+       // src & dst are guaranteed to be word aligned, and at least 4 bytes 
are left to copy.
+       subs    r2, r2, #4
+
+.L_wordwise_loop:
+       ldr             r3, [r1], #4
+       subs    r2, r2, #4
+       str             r3, [r0], #4
+       bge             .L_wordwise_loop
+
+       // correct the remaining len and test for completion
+       adds    r2, r2, #4      
+       beq             .L_done
+
+.L_bytewise:
+       // simple bytewise copy
+       ldrb    r3, [r1], #1
+       subs    r2, r2, #1
+       strb    r3, [r0], #1
+       bgt             .L_bytewise
+
+.L_done:
+       // load dst for return and restore r4,r5
+//#if ARM_ARCH_LEVEL >= 5
+//     ldmfd   sp!, {r0, r4, r5, pc}
+//#else
+       ldmfd   sp!, {r0, r4, r5, lr}
+       bx              lr
+//#endif
+
+.L_not16bytealigned:
+       // dst is not 16 byte aligned, so we will copy up to 15 bytes to get it 
aligned.
+       // src is guaranteed to be similarly word aligned with dst.
+
+       // set the condition flags based on the alignment.
+       lsl             r12, r0, #28
+       rsb             r12, r12, #0
+       msr             CPSR_f, r12                             // move into 
NZCV fields in CPSR
+
+       // move as many bytes as necessary to get the dst aligned
+       ldrvsb  r3, [r1], #1                    // V set
+       ldrcsh  r4, [r1], #2                    // C set
+       ldreq   r5, [r1], #4                    // Z set
+
+       strvsb  r3, [r0], #1
+       strcsh  r4, [r0], #2
+       streq   r5, [r0], #4
+
+       ldmmiia r1!, {r3-r4}                    // N set
+       stmmiia r0!, {r3-r4}
+
+       // fix the remaining len
+       sub             r2, r2, r12, lsr #28
+
+       // test to see what we should do now
+       cmp             r2, #32
+       bge             .L_bigcopy
+       b               .L_wordwise
+       
+       // src and dest overlap 'forwards' or dst > src
+.L_forwardoverlap:
+
+       // do a bytewise reverse copy for now
+       add             r1, r1, r2
+       add             r0, r0, r2
+
+.L_bytewisereverse:
+       // simple bytewise reverse copy
+       ldrb    r3, [r1], #-1
+       subs    r2, r2, #1
+       strb    r3, [r0], #-1
+       bgt             .L_bytewisereverse
+
+       b               .L_done
+       // check for zero length copy or the same pointer
+
+FUNCTION_END(memcpy)
+#endif
Index: headers/os/kernel/debugger.h
===================================================================
--- headers/os/kernel/debugger.h        (Revision 30984)
+++ headers/os/kernel/debugger.h        (Arbeitskopie)
@@ -19,6 +19,8 @@
        #include <arch/m68k/arch_debugger.h>
 #elif __MIPSEL__
        #include <arch/mipsel/arch_debugger.h>
+#elif __ARM__
+       #include <arch/arm/arch_debugger.h>
 #else
        #error you need to write a <arch/<cpu>/arch_debugger.h>
 #endif
Index: headers/os/arch/arm/arch_debugger.h
===================================================================
--- headers/os/arch/arm/arch_debugger.h (Revision 0)
+++ headers/os/arch/arm/arch_debugger.h (Revision 0)
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005, Haiku Inc.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _ARCH_M68K_DEBUGGER_H
+#define _ARCH_M68K_DEBUGGER_H
+
+struct debug_cpu_state {
+        ulong r0;
+        ulong r1;
+        ulong r2;
+        ulong r3;
+        ulong r4;
+        ulong r5;
+        ulong r6;
+        ulong r7;
+        ulong r8;
+        ulong r9;
+        ulong r10;
+        ulong r11;
+        ulong r12;
+        ulong r13;      /* stack pointer */
+        ulong r14;      /* link register */
+        ulong r15;      /* program counter */
+        ulong cpsr;
+#warning ARM: missing members!
+       uint32  dummy;
+} __attribute__((aligned(8)));
+
+#endif // _ARCH_M68K_DEBUGGER_H
Index: headers/posix/setjmp.h
===================================================================
--- headers/posix/setjmp.h      (Revision 30984)
+++ headers/posix/setjmp.h      (Arbeitskopie)
@@ -16,6 +16,8 @@
        #include <arch/m68k/arch_setjmp.h>
 #elif __MIPSEL__
        #include <arch/mipsel/arch_setjmp.h>
+#elif __ARM__
+       #include <arch/arm/arch_setjmp.h>
 #else
        #error #include <arch/<cpu>/arch_setjmp.h>
 #endif
Index: headers/posix/signal.h
===================================================================
--- headers/posix/signal.h      (Revision 30984)
+++ headers/posix/signal.h      (Arbeitskopie)
@@ -259,6 +259,8 @@
         #include <arch/m68k/signal.h>
 #elif __MIPSEL__
         #include <arch/mipsel/signal.h>
+#elif __ARM__
+        #include <arch/arm/signal.h>
 #else
         #error #include <arch/<cpu>/signal.h>
 #endif
Index: headers/private/kernel/boot/platform/u-boot/platform_kernel_args.h
===================================================================
--- headers/private/kernel/boot/platform/u-boot/platform_kernel_args.h  
(Revision 0)
+++ headers/private/kernel/boot/platform/u-boot/platform_kernel_args.h  
(Revision 0)
@@ -0,0 +1,23 @@
+/*
+** Copyright 2003, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved.
+** Distributed under the terms of the OpenBeOS License.
+*/
+#ifndef KERNEL_BOOT_PLATFORM_UBOOT_KERNEL_ARGS_H
+#define KERNEL_BOOT_PLATFORM_UBOOT_KERNEL_ARGS_H
+
+#ifndef KERNEL_BOOT_KERNEL_ARGS_H
+#      error This file is included from <boot/kernel_args.h> only
+#endif
+
+// must match SMP_MAX_CPUS in arch_smp.h
+#define MAX_BOOT_CPUS 1
+#define MAX_PHYSICAL_MEMORY_RANGE 4
+#define MAX_PHYSICAL_ALLOCATED_RANGE 8
+#define MAX_VIRTUAL_ALLOCATED_RANGE 32
+
+
+typedef struct {
+       char dummy;
+} platform_kernel_args;
+
+#endif /* KERNEL_BOOT_PLATFORM_OPENFIRMWARE_KERNEL_ARGS_H */
Index: headers/private/kernel/arch/arm/arch_kernel_args.h
===================================================================
--- headers/private/kernel/arch/arm/arch_kernel_args.h  (Revision 0)
+++ headers/private/kernel/arch/arm/arch_kernel_args.h  (Revision 0)
@@ -0,0 +1,30 @@
+/*
+** Copyright 2003, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved.
+** Distributed under the terms of the OpenBeOS License.
+*/
+#ifndef KERNEL_ARCH_M68K_KERNEL_ARGS_H
+#define KERNEL_ARCH_M68K_KERNEL_ARGS_H
+
+#ifndef KERNEL_BOOT_KERNEL_ARGS_H
+#      error This file is included from <boot/kernel_args.h> only
+#endif
+
+#define _PACKED __attribute__((packed))
+
+//#define MAX_VIRTUAL_RANGES_TO_KEEP   32
+
+// kernel args
+typedef struct {
+       int                     cpu_type; 
+       int                     fpu_type; 
+       int                     mmu_type; 
+       int                     platform; 
+       int                     machine;  // platform specific machine type
+       bool                    has_lpstop; //XXX: use bit flags
+       // architecture specific
+       uint64          cpu_frequency;
+       uint64          bus_frequency;
+       uint64          time_base_frequency;
+} arch_kernel_args;
+
+#endif /* KERNEL_ARCH_M68K_KERNEL_ARGS_H */
Index: headers/private/kernel/arch/arm/arch_vm_translation_map.h
===================================================================
--- headers/private/kernel/arch/arm/arch_vm_translation_map.h   (Revision 0)
+++ headers/private/kernel/arch/arm/arch_vm_translation_map.h   (Revision 0)
@@ -0,0 +1,26 @@
+/*
+** Copyright 2003, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved.
+** Distributed under the terms of the OpenBeOS License.
+*/
+#ifndef _KERNEL_ARCH_M68K_VM_TRANSLATION_MAP_H
+#define _KERNEL_ARCH_M68K_VM_TRANSLATION_MAP_H
+
+#include <arch/vm_translation_map.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+void m68k_translation_map_change_asid(vm_translation_map *map);
+
+status_t m68k_map_address_range(addr_t virtualAddress, addr_t physicalAddress,
+       size_t size);
+void m68k_unmap_address_range(addr_t virtualAddress, size_t size);
+status_t m68k_remap_address_range(addr_t *virtualAddress, size_t size,
+       bool unmap);
+*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _KERNEL_ARCH_M68K_VM_TRANSLATION_MAP_H */
Index: headers/private/kernel/arch/arm/arch_system_info.h
===================================================================
--- headers/private/kernel/arch/arm/arch_system_info.h  (Revision 0)
+++ headers/private/kernel/arch/arm/arch_system_info.h  (Revision 0)
@@ -0,0 +1,12 @@
+/*
+ * Copyright 2005, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _KERNEL_ARCH_M68K_SYSTEM_INFO_H
+#define _KERNEL_ARCH_M68K_SYSTEM_INFO_H
+
+
+/* nothing to be seen here yet */
+
+
+#endif /* _KRENEL_ARCH_M68K_SYSTEM_INFO_H */
Index: headers/private/kernel/arch/arm/arch_vm_types.h
===================================================================
--- headers/private/kernel/arch/arm/arch_vm_types.h     (Revision 0)
+++ headers/private/kernel/arch/arm/arch_vm_types.h     (Revision 0)
@@ -0,0 +1,8 @@
+/*
+ * Copyright 2005, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _KERNEL_ARCH_ARM_VM_TYPES_H
+#define _KERNEL_ARCH_ARM_VM_TYPES_H
+
+#endif /* _KERNEL_ARCH_M68K_VM_TYPES_H */
Index: headers/private/kernel/arch/arm/arch_thread.h
===================================================================
--- headers/private/kernel/arch/arm/arch_thread.h       (Revision 0)
+++ headers/private/kernel/arch/arm/arch_thread.h       (Revision 0)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003-2006, Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
+ *             Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
+ *             Johannes Wischert <johanneswi@xxxxxxxxx>
+ */
+#ifndef _KERNEL_ARCH_ARM_THREAD_H
+#define _KERNEL_ARCH_ARM_THREAD_H
+
+#include <arch/cpu.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void arm_push_iframe(struct iframe_stack *stack, struct iframe *frame);
+void arm_pop_iframe(struct iframe_stack *stack);
+struct iframe *arm_get_user_iframe(void);
+
+/* as we won't support SMP on arm (yet?) we can use a global here */
+/*TODO SMP-ARMS are comming..*/
+extern struct thread *gCurrentThread;
+
+extern inline struct thread *
+arch_thread_get_current_thread(void)
+{
+       return gCurrentThread;
+}
+
+
+extern inline void
+arch_thread_set_current_thread(struct thread *t)
+{
+       gCurrentThread = t;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _KERNEL_ARCH_ARM_THREAD_H */
Index: headers/private/kernel/arch/arm/uart.h
===================================================================
--- headers/private/kernel/arch/arm/uart.h      (Revision 0)
+++ headers/private/kernel/arch/arm/uart.h      (Revision 0)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __DEV_UART_H
+#define __DEV_UART_H
+
+//#include <sys/types.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void uart_init(void);
+void uart_init_early(void);
+
+int uart_putc(int port, char c);
+int uart_getc(int port, bool wait);
+void uart_flush_tx(int port);
+void uart_flush_rx(int port);
+void uart_init_port(int port, uint baud);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
Index: headers/private/kernel/arch/arm/reg.h
===================================================================
--- headers/private/kernel/arch/arm/reg.h       (Revision 0)
+++ headers/private/kernel/arch/arm/reg.h       (Revision 0)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __REG_H
+#define __REG_H
+
+//#include <sys/types.h>
+
+/* low level macros for accessing memory mapped hardware registers */
+#define REG64(addr) ((volatile uint64 *)(addr))
+#define REG32(addr) ((volatile uint32 *)(addr))
+#define REG16(addr) ((volatile uint16 *)(addr))
+#define REG8(addr) ((volatile uint8 *)(addr))
+
+#define RMWREG64(addr, startbit, width, val) *REG64(addr) = (*REG64(addr) & 
~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit))
+#define RMWREG32(addr, startbit, width, val) *REG32(addr) = (*REG32(addr) & 
~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit))
+#define RMWREG16(addr, startbit, width, val) *REG16(addr) = (*REG16(addr) & 
~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit))
+#define RMWREG8(addr, startbit, width, val) *REG8(addr) = (*REG8(addr) & 
~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit))
+
+#define writel(v, a) (*REG32(a) = (v))
+#define readl(a) (*REG32(a))
+
+#endif
Index: headers/private/kernel/arch/arm/arch_kernel.h
===================================================================
--- headers/private/kernel/arch/arm/arch_kernel.h       (Revision 0)
+++ headers/private/kernel/arch/arm/arch_kernel.h       (Revision 0)
@@ -0,0 +1,32 @@
+/*
+** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
+** Distributed under the terms of the NewOS License.
+*/
+#ifndef _KERNEL_ARCH_ARM_KERNEL_H
+#define _KERNEL_ARCH_ARM_KERNEL_H
+
+#include <arch/cpu.h>
+#warning "ARM:todo memory map is wrong"
+// memory layout
+#define KERNEL_BASE 0xa2500000
+#define KERNEL_SIZE 0x80000000
+#define KERNEL_TOP  (KERNEL_BASE + (KERNEL_SIZE - 1))
+
+/*
+** User space layout is a little special:
+** The user space does not completely cover the space not covered by the 
kernel.
+** This is accomplished by starting user space at 1Mb and running to 64kb 
short of kernel space.
+** The lower 1Mb reserved spot makes it easy to find null pointer references 
and guarantees a
+** region wont be placed there. The 64kb region assures a user space thread 
cannot pass
+** a buffer into the kernel as part of a syscall that would cross into kernel 
space.
+*/
+#define USER_BASE     0x100000
+#define USER_BASE_ANY USER_BASE
+#define USER_SIZE     (0x80000000 - (0x10000 + 0x100000))
+#define USER_TOP      (USER_BASE + USER_SIZE)
+
+#define KERNEL_USER_DATA_BASE  0x6fff0000
+#define USER_STACK_REGION              0x70000000
+#define USER_STACK_REGION_SIZE (USER_TOP - USER_STACK_REGION)
+
+#endif /* _KERNEL_ARCH_ARM_KERNEL_H */
Index: headers/private/kernel/arch/arm/arch_user_debugger.h
===================================================================
--- headers/private/kernel/arch/arm/arch_user_debugger.h        (Revision 0)
+++ headers/private/kernel/arch/arm/arch_user_debugger.h        (Revision 0)
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2005, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _KERNEL_ARCH_M68K_USER_DEBUGGER_H
+#define _KERNEL_ARCH_M68K_USER_DEBUGGER_H
+
+
+struct arch_team_debug_info {
+       uint32 dummy;
+};
+
+struct arch_thread_debug_info {
+       uint32 dummy;
+};
+
+#endif // _KERNEL_ARCH_M68K_USER_DEBUGGER_H
Index: headers/private/kernel/arch/arm/arch_vm.h
===================================================================
--- headers/private/kernel/arch/arm/arch_vm.h   (Revision 0)
+++ headers/private/kernel/arch/arm/arch_vm.h   (Revision 0)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef ARCH_ARM_VM_H
+#define ARCH_ARM_VM_H
+
+//#include <vm_translation_map.h>
+
+/* This many pages will be read/written on I/O if possible */
+
+#define NUM_IO_PAGES   4
+       /* 16 kB */
+
+#define PAGE_SHIFT 12
+
+
+struct arm_vm_ops {
+//     void *(*arm_translation_map_get_pgdir)(vm_translation_map *map);
+/*     status_t (*arch_vm_translation_map_init_map)(vm_translation_map *map, 
bool kernel);
+       status_t 
(*arch_vm_translation_map_init_kernel_map_post_sem)(vm_translation_map *map);
+       status_t (*arch_vm_translation_map_init)(kernel_args *args);
+       status_t (*arch_vm_translation_map_init_post_area)(kernel_args *args);
+       status_t (*arch_vm_translation_map_init_post_sem)(kernel_args *args);
+       status_t (*arch_vm_translation_map_early_map)(kernel_args *ka, addr_t 
virtualAddress, addr_t physicalAddress, 
+               uint8 attributes, addr_t (*get_free_page)(kernel_args *));
+       status_t (*arch_vm_translation_map_early_query)(addr_t va, addr_t 
*out_physical);*/
+//     void (*m68k_set_pgdir)(void *);
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern struct arm_vm_ops *get_vm_ops();
+
+//extern void *arm_translation_map_get_pgdir(vm_translation_map *map);
+//extern void arm_set_pgdir(void *rt);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ARCH_M68K_VM_H */
Index: headers/private/kernel/arch/arm/omap3.h
===================================================================
--- headers/private/kernel/arch/arm/omap3.h     (Revision 0)
+++ headers/private/kernel/arch/arm/omap3.h     (Revision 0)
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __PLATFORM_OMAP3_H
+#define __PLATFORM_OMAP3_H
+
+#define SDRAM_BASE 0x80000000
+
+#define L4_BASE     0x48000000
+#define L4_WKUP_BASE    0x48300000
+#define L4_PER_BASE 0x49000000
+#define L4_EMU_BASE 0x54000000
+#define GFX_BASE    0x50000000
+#define L3_BASE     0x68000000
+#define SMS_BASE    0x6C000000
+#define SDRC_BASE   0x6D000000
+#define GPMC_BASE   0x6E000000
+#define SCM_BASE    0x48002000
+
+/* clocks */
+#define CM_CLKSEL_PER          (L4_BASE + 0x5040)
+
+/* PRCM */
+#define CM_FCLKEN_IVA2      (L4_BASE + 0x4000)
+#define CM_CLKEN_PLL_IVA2   (L4_BASE + 0x4004)
+#define CM_IDLEST_PLL_IVA2  (L4_BASE + 0x4024)
+#define CM_CLKSEL1_PLL_IVA2 (L4_BASE + 0x4040)
+#define CM_CLKSEL2_PLL_IVA2 (L4_BASE + 0x4044)
+#define CM_CLKEN_PLL_MPU    (L4_BASE + 0x4904)
+#define CM_IDLEST_PLL_MPU   (L4_BASE + 0x4924)
+#define CM_CLKSEL1_PLL_MPU  (L4_BASE + 0x4940)
+#define CM_CLKSEL2_PLL_MPU  (L4_BASE + 0x4944)
+#define CM_FCLKEN1_CORE     (L4_BASE + 0x4a00)
+#define CM_ICLKEN1_CORE     (L4_BASE + 0x4a10)
+#define CM_ICLKEN2_CORE     (L4_BASE + 0x4a14)
+#define CM_CLKSEL_CORE      (L4_BASE + 0x4a40)
+#define CM_FCLKEN_GFX       (L4_BASE + 0x4b00)
+#define CM_ICLKEN_GFX       (L4_BASE + 0x4b10)
+#define CM_CLKSEL_GFX       (L4_BASE + 0x4b40)
+#define CM_FCLKEN_WKUP      (L4_BASE + 0x4c00)
+#define CM_ICLKEN_WKUP      (L4_BASE + 0x4c10)
+#define CM_CLKSEL_WKUP      (L4_BASE + 0x4c40)
+#define CM_IDLEST_WKUP      (L4_BASE + 0x4c20)
+#define CM_CLKEN_PLL        (L4_BASE + 0x4d00)
+#define CM_IDLEST_CKGEN     (L4_BASE + 0x4d20)
+#define CM_CLKSEL1_PLL      (L4_BASE + 0x4d40)
+#define CM_CLKSEL2_PLL      (L4_BASE + 0x4d44)
+#define CM_CLKSEL3_PLL      (L4_BASE + 0x4d48)
+#define CM_FCLKEN_DSS       (L4_BASE + 0x4e00)
+#define CM_ICLKEN_DSS       (L4_BASE + 0x4e10)
+#define CM_CLKSEL_DSS       (L4_BASE + 0x4e40)
+#define CM_FCLKEN_CAM       (L4_BASE + 0x4f00)
+#define CM_ICLKEN_CAM       (L4_BASE + 0x4f10)
+#define CM_CLKSEL_CAM       (L4_BASE + 0x4F40)
+#define CM_FCLKEN_PER       (L4_BASE + 0x5000)
+#define CM_ICLKEN_PER       (L4_BASE + 0x5010)
+#define CM_CLKSEL_PER       (L4_BASE + 0x5040)
+#define CM_CLKSEL1_EMU      (L4_BASE + 0x5140)
+
+#define PRM_CLKSEL                     (L4_BASE + 0x306d40)
+#define PRM_RSTCTRL                    (L4_BASE + 0x307250)
+#define PRM_CLKSRC_CTRL                (L4_BASE + 0x307270)
+
+/* General Purpose Timers */
+#define OMAP34XX_GPT1           (L4_BASE + 0x318000)
+#define OMAP34XX_GPT2           (L4_BASE + 0x1032000)
+#define OMAP34XX_GPT3           (L4_BASE + 0x1034000)
+#define OMAP34XX_GPT4           (L4_BASE + 0x1036000)
+#define OMAP34XX_GPT5           (L4_BASE + 0x1038000)
+#define OMAP34XX_GPT6           (L4_BASE + 0x103A000)
+#define OMAP34XX_GPT7           (L4_BASE + 0x103C000)
+#define OMAP34XX_GPT8           (L4_BASE + 0x103E000)
+#define OMAP34XX_GPT9           (L4_BASE + 0x1040000)
+#define OMAP34XX_GPT10          (L4_BASE + 0x86000)
+#define OMAP34XX_GPT11          (L4_BASE + 0x88000)
+#define OMAP34XX_GPT12          (L4_BASE + 0x304000)
+
+#define TIDR                           0x00
+#define TIOCP_CFG                      0x10
+#define TISTAT                         0x14
+#define TISR                           0x18
+#define TIER                           0x1C
+#define TWER                           0x20
+#define TCLR                           0x24
+#define TCRR                           0x28
+#define TLDR                           0x2C
+#define TTGR                           0x30
+#define TWPS                           0x34
+#define TMAR                           0x38
+#define TCAR1                          0x3C
+#define TSICR                          0x40
+#define TCAR2                          0x44
+#define TPIR                           0x48
+#define TNIR                           0x4C
+#define TCVR                           0x50
+#define TOCR                           0x54
+#define TOWR                           0x58
+
+/* WatchDog Timers (1 secure, 3 GP) */
+#define WD1_BASE            (0x4830C000)
+#define WD2_BASE            (0x48314000)
+#define WD3_BASE            (0x49030000)
+
+#define WIDR           0x00
+#define WD_SYSCONFIG   0x10
+#define WD_SYSSTATUS   0x14
+#define WISR           0x18
+#define WIER           0x1C
+#define WCLR           0x24
+#define WCRR           0x28
+#define WLDR           0x2C
+#define WTGR           0x30
+#define WWPS           0x34
+#define WSPR           0x48
+
+#define W_PEND_WCLR    (1<<0)
+#define W_PEND_WCRR    (1<<1)
+#define W_PEND_WLDR    (1<<2)
+#define W_PEND_WTGR    (1<<3)
+#define W_PEND_WSPR    (1<<4)
+
+#define WD_UNLOCK1      0xAAAA
+#define WD_UNLOCK2      0x5555
+
+/* 32KTIMER */
+#define TIMER32K_BASE          (L4_BASE + 0x320000)
+#define TIMER32K_REV           (TIMER32K_BASE + 0x00)
+#define TIMER32K_CR                    (TIMER32K_BASE + 0x10)
+
+/* UART */
+#define OMAP_UART1_BASE     (L4_BASE + 0x6a000)
+#define OMAP_UART2_BASE     (L4_BASE + 0x6c000)
+#define OMAP_UART3_BASE     (L4_BASE + 0x01020000)
+
+#define UART_RHR    0
+#define UART_THR    0
+#define UART_DLL    0
+#define UART_IER    1
+#define UART_DLH    1
+#define UART_IIR    2
+#define UART_FCR    2
+#define UART_EFR    2
+#define UART_LCR    3
+#define UART_MCR    4
+#define UART_LSR    5
+#define UART_MSR    6
+#define UART_TCR    6
+#define UART_SPR    7
+#define UART_TLR    7
+#define UART_MDR1   8
+#define UART_MDR2   9
+#define UART_SFLSR  10
+#define UART_RESUME 11
+#define UART_TXFLL  10
+#define UART_TXFLH  11
+#define UART_SFREGL 12
+#define UART_SFREGH 13
+#define UART_RXFLL  12
+#define UART_RXFLH  13
+#define UART_BLR    14
+#define UART_UASR   14
+#define UART_ACREG  15
+#define UART_SCR    16
+#define UART_SSR    17
+#define UART_EBLR   18
+#define UART_MVR    19
+#define UART_SYSC   20
+
+/* MPU INTC */
+#define INTC_BASE                      (L4_BASE + 0x200000)
+#define INTC_REVISION          (INTC_BASE + 0x000)
+#define INTC_SYSCONFIG         (INTC_BASE + 0x010)
+#define INTC_SYSSTATUS         (INTC_BASE + 0x014)
+#define INTC_SIR_IRQ           (INTC_BASE + 0x040)
+#define INTC_SIR_FIQ           (INTC_BASE + 0x044)
+#define INTC_CONTROL           (INTC_BASE + 0x048)
+#define INTC_PROTECTION                (INTC_BASE + 0x04C)
+#define INTC_IDLE                      (INTC_BASE + 0x050)
+#define INTC_IRQ_PRIORITY      (INTC_BASE + 0x060)
+#define INTC_FIQ_PRIORITY      (INTC_BASE + 0x064)
+#define INTC_THRESHOLD         (INTC_BASE + 0x068)
+#define INTC_ITR(n)                    (INTC_BASE + 0x080 + (n) * 0x20)
+#define INTC_MIR(n)                    (INTC_BASE + 0x084 + (n) * 0x20)
+#define INTC_MIR_CLEAR(n)      (INTC_BASE + 0x088 + (n) * 0x20)
+#define INTC_MIR_SET(n)                (INTC_BASE + 0x08C + (n) * 0x20)
+#define INTC_ISR_SET(n)                (INTC_BASE + 0x090 + (n) * 0x20)
+#define INTC_ISR_CLEAR(n)      (INTC_BASE + 0x094 + (n) * 0x20)
+#define INTC_PENDING_IRQ(n)    (INTC_BASE + 0x098 + (n) * 0x20)
+#define INTC_PENDING_FIQ(n)    (INTC_BASE + 0x09C + (n) * 0x20)
+#define INTC_ILR(n)                    (INTC_BASE + 0x100 + (n) * 4)
+
+/* interrupts */
+#define INT_VECTORS            96
+#define GPT2_IRQ                       38
+
+/* HS USB */
+#define USB_HS_BASE                    (L4_BASE + 0xab000)
+
+/* USB OTG */
+#define OTG_BASE                       (L4_BASE + 0xab400)
+
+#define OTG_REVISION           (OTG_BASE + 0x00)
+#define OTG_SYSCONFIG          (OTG_BASE + 0x04)
+#define OTG_SYSSTATUS          (OTG_BASE + 0x08)
+#define OTG_INTERFSEL          (OTG_BASE + 0x0C)
+#define OTG_SIMENABLE          (OTG_BASE + 0x10)
+#define OTG_FORCESTDBY         (OTG_BASE + 0x14)
+
+/* I2C */
+#define I2C1_BASE              (L4_BASE + 0x70000)
+#define I2C2_BASE              (L4_BASE + 0x72000)
+#define I2C3_BASE              (L4_BASE + 0x60000)
+
+#define I2C_REV                                (0x00)
+#define I2C_IE                         (0x04)
+#define I2C_STAT                       (0x08)
+#define I2C_WE                         (0x0C)
+#define I2C_SYSS                       (0x10)
+#define I2C_BUF                                (0x14)
+#define I2C_CNT                                (0x18)
+#define I2C_DATA                       (0x1C)
+#define I2C_SYSC                       (0x20)
+#define I2C_CON                                (0x24)
+#define I2C_OA0                                (0x28)
+#define I2C_SA                         (0x2C)
+#define I2C_PSC                                (0x30)
+#define I2C_SCLL                       (0x34)
+#define I2C_SCLH                       (0x38)
+#define I2C_SYSTEST                    (0x3C)
+#define I2C_BUFSTAT                    (0x40)
+#define I2C_OA1                                (0x44)
+#define I2C_OA2                                (0x48)
+#define I2C_OA3                                (0x4C)
+#define I2C_ACTOA                      (0x50)
+#define I2C_SBLOCK                     (0x54)
+
+#endif
+
Index: headers/private/kernel/arch/arm/pxa270.h
===================================================================
--- headers/private/kernel/arch/arm/pxa270.h    (Revision 0)
+++ headers/private/kernel/arch/arm/pxa270.h    (Revision 0)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __PLATFORM_OMAP3_H
+#define __PLATFORM_OMAP3_H
+
+#define SDRAM_BASE 0xa2000000
+
+/* UART */
+#define FFUART_BASE    0x40100000
+#define BTUART_BASE    0x40200000
+#define STUART_BASE    0x40700000
+#define CKEN           0x41300004
+#define UART_RHR    0
+#define UART_THR    0
+#define UART_DLL    0
+#define UART_IER    1
+#define UART_DLH    1
+#define UART_IIR    2
+#define UART_FCR    2
+#define UART_EFR    2
+#define UART_LCR    3
+#define UART_MCR    4
+#define UART_LSR    5
+#define UART_MSR    6
+#define UART_TCR    6
+#define UART_SPR    7
+#define UART_TLR    7
+#define UART_MDR1   8
+#define UART_MDR2   9
+#define UART_SFLSR  10
+#define UART_RESUME 11
+#define UART_TXFLL  10
+#define UART_TXFLH  11
+#define UART_SFREGL 12
+#define UART_SFREGH 13
+#define UART_RXFLL  12
+#define UART_RXFLH  13
+#define UART_BLR    14
+#define UART_UASR   14
+#define UART_ACREG  15
+#define UART_SCR    16
+#define UART_SSR    17
+#define UART_EBLR   18
+#define UART_MVR    19
+#define UART_SYSC   20
+
+#endif
+
Index: headers/private/kernel/arch/arm/arch_cpu.h
===================================================================
--- headers/private/kernel/arch/arm/arch_cpu.h  (Revision 0)
+++ headers/private/kernel/arch/arm/arch_cpu.h  (Revision 0)
@@ -0,0 +1,101 @@
+/*
+** Copyright 2003-2004, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights 
reserved.
+** Distributed under the terms of the Haiku License.
+*/
+#ifndef _KERNEL_ARCH_M68K_CPU_H
+#define _KERNEL_ARCH_M68K_CPU_H
+
+#ifndef _ASSEMBLER
+
+#include <arch/arm/arch_thread_types.h>
+#include <kernel.h>
+
+#endif // !_ASSEMBLER
+
+
+
+#ifndef _ASSEMBLER
+
+/* raw exception frames */
+
+
+
+#warning ARM: check for missing regs/movem
+struct iframe {
+       uint32 r0;
+       uint32 r1;
+       uint32 r2;
+       uint32 r3;
+       uint32 r4;
+       uint32 r5;
+       uint32 r6;
+       uint32 r7;
+       uint32 r8;
+       uint32 r9;
+       uint32 r10;
+       uint32 r11;
+       uint32 r12;
+       uint32 r13;
+       uint32 lr;
+       uint32 pc;
+       uint32 cpsr;
+} _PACKED;
+
+
+typedef struct arch_cpu_info {
+       int null;
+} arch_cpu_info;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//extern void sethid0(unsigned int val);
+//extern unsigned int getl2cr(void);
+//extern void setl2cr(unsigned int val);
+extern long long get_time_base(void);
+
+//void __m68k_setup_system_time(vint32 *cvFactor);
+       // defined in libroot: os/arch/system_time.c
+//int64 __m68k_get_time_base(void);
+       // defined in libroot: os/arch/system_time_asm.S
+
+extern void arm_context_switch(void **_oldStackPointer, void *newStackPointer);
+
+extern bool arm_set_fault_handler(addr_t *handlerLocation, addr_t handler)
+       __attribute__((noinline));
+
+//extern bool m68k_is_hw_register_readable(addr_t address);
+//extern bool m68k_is_hw_register_writable(addr_t address, uint16 value);
+       // defined in kernel: arch/m68k/cpu_asm.S
+
+#ifdef __cplusplus
+}
+#endif
+
+struct arm_cpu_ops {
+       void (*flush_insn_pipeline)(void);
+       void (*flush_atc_all)(void);
+       void (*flush_atc_user)(void);
+       void (*flush_atc_addr)(addr_t addr);
+       void (*flush_dcache)(addr_t address, size_t len);
+       void (*flush_icache)(addr_t address, size_t len);
+       void (*idle)(void);
+};
+#warning ARM:check  cpu_ops 
+extern struct arm_cpu_ops cpu_ops;
+
+//#define
+
+
+extern int arch_cpu_type;
+extern int arch_fpu_type;
+extern int arch_mmu_type;
+extern int arch_platform;
+extern int arch_machine;
+
+#endif // !_ASSEMBLER
+
+#endif /* _KERNEL_ARCH_ARM_CPU_H */
Index: headers/private/kernel/arch/arm/arch_int.h
===================================================================
--- headers/private/kernel/arch/arm/arch_int.h  (Revision 0)
+++ headers/private/kernel/arch/arm/arch_int.h  (Revision 0)
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2005-2009, Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
+ *             Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
+ *             Johannes Wischert <johanneswi@xxxxxxxxx>
+ */
+#ifndef _KERNEL_ARCH_M68K_INT_H
+#define _KERNEL_ARCH_M68K_INT_H
+
+#include <SupportDefs.h>
+
+#define NUM_IO_VECTORS 256
+#warning "ARM: fix numm io vectors..."
+#endif /* _KERNEL_ARCH_M68K_INT_H */
Index: headers/private/kernel/arch/arm/arch_thread_types.h
===================================================================
--- headers/private/kernel/arch/arm/arch_thread_types.h (Revision 0)
+++ headers/private/kernel/arch/arm/arch_thread_types.h (Revision 0)
@@ -0,0 +1,40 @@
+/* 
+** Copyright 2001, Travis Geiselbrecht. All rights reserved.
+** Distributed under the terms of the NewOS License.
+*/
+#ifndef KERNEL_ARCH_ARM_THREAD_TYPES_H
+#define KERNEL_ARCH_ARM_THREAD_TYPES_H
+
+#include <kernel.h>
+
+#define        IFRAME_TRACE_DEPTH 4
+
+struct iframe_stack {
+       struct iframe *frames[IFRAME_TRACE_DEPTH];
+       int32   index;
+};
+
+// architecture specific thread info
+struct arch_thread {
+       void    *sp;    // stack pointer
+       void    *interrupt_stack;
+
+       // used to track interrupts on this thread
+       struct iframe_stack     iframes;
+};
+
+struct arch_team {
+       // gcc treats empty structures as zero-length in C, but as if they 
contain
+       // a char in C++. So we have to put a dummy in to be able to use the 
struct
+       // from both in a consistent way.
+       char    dummy;
+};
+
+struct arch_fork_arg {
+       // gcc treats empty structures as zero-length in C, but as if they 
contain
+       // a char in C++. So we have to put a dummy in to be able to use the 
struct
+       // from both in a consistent way.
+       char    dummy;
+};
+
+#endif /* KERNEL_ARCH_M68K_THREAD_TYPES_H */
Index: headers/private/system/arch/arm/asm_defs.h
===================================================================
--- headers/private/system/arch/arm/asm_defs.h  (Revision 0)
+++ headers/private/system/arch/arm/asm_defs.h  (Revision 0)
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2008, François Revol, revol@xxxxxxxx
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef SYSTEM_ARCH_ARM_ASM_DEFS_H
+#define SYSTEM_ARCH_ARM_ASM_DEFS_H
+
+
+#define SYMBOL(name)                   .global name; name
+#define SYMBOL_END(name)               1: .size name, 1b - name
+#define STATIC_FUNCTION(name)  .type name, %function; name
+#define FUNCTION(name)                 .global name; .type name, %function; 
name
+#define FUNCTION_END(name)             1: .size name, 1b - name
+
+
+#endif /* SYSTEM_ARCH_ARM_ASM_DEFS_H */
+
Index: headers/private/system/arch/arm/arch_config.h
===================================================================
--- headers/private/system/arch/arm/arch_config.h       (Revision 0)
+++ headers/private/system/arch/arm/arch_config.h       (Revision 0)
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2004, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _KERNEL_ARCH_ARM_CONFIG_H
+#define _KERNEL_ARCH_ARM_CONFIG_H
+
+
+#define FUNCTION_CALL_PARAMETER_ALIGNMENT_TYPE unsigned int
+
+#define STACK_GROWS_DOWNWARDS
+
+//#define ATOMIC_FUNCS_ARE_SYSCALLS
+//#define ATOMIC64_FUNCS_ARE_SYSCALLS
+
+
+#endif /* _KERNEL_ARCH_M68K_CONFIG_H */
Index: headers/private/system/arch/arm/arch_elf.h
===================================================================
--- headers/private/system/arch/arm/arch_elf.h  (Revision 0)
+++ headers/private/system/arch/arm/arch_elf.h  (Revision 0)
@@ -0,0 +1,55 @@
+/*
+** Copyright 2003, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved.
+** Distributed under the terms of the OpenBeOS License.
+*/
+#ifndef _KERNEL_ARCH_ARM_ELF_H
+#define _KERNEL_ARCH_ARM_ELF_H
+
+
+
+/* ARM relocs.  */
+#define R_ARM_NONE              0       /* No reloc */
+#define R_ARM_PC24              1       /* PC relative 26 bit branch */
+#define R_ARM_ABS32             2       /* Direct 32 bit  */
+#define R_ARM_REL32             3       /* PC relative 32 bit */
+#define R_ARM_PC13              4
+#define R_ARM_ABS16             5       /* Direct 16 bit */
+#define R_ARM_ABS12             6       /* Direct 12 bit */
+#define R_ARM_THM_ABS5          7
+#define R_ARM_ABS8              8       /* Direct 8 bit */
+#define R_ARM_SBREL32           9
+#define R_ARM_THM_PC22          10
+#define R_ARM_THM_PC8           11
+#define R_ARM_AMP_VCALL9        12
+#define R_ARM_SWI24             13
+#define R_ARM_THM_SWI8          14
+#define R_ARM_XPC25             15
+#define R_ARM_THM_XPC22         16
+#define R_ARM_COPY              20      /* Copy symbol at runtime */
+#define R_ARM_GLOB_DAT          21      /* Create GOT entry */
+#define R_ARM_JUMP_SLOT         22      /* Create PLT entry */
+#define R_ARM_RELATIVE          23      /* Adjust by program base */
+#define R_ARM_GOTOFF            24      /* 32 bit offset to GOT */
+#define R_ARM_GOTPC             25      /* 32 bit PC relative offset to GOT */
+#define R_ARM_GOT32             26      /* 32 bit GOT entry */
+#define R_ARM_PLT32             27      /* 32 bit PLT address */
+#define R_ARM_CALL              28
+#define R_ARM_JUMP24            29
+#define R_ARM_GNU_VTENTRY       100
+#define R_ARM_GNU_VTINHERIT     101
+#define R_ARM_THM_PC11          102     /* thumb unconditional branch */
+#define R_ARM_THM_PC9           103     /* thumb conditional branch */
+#define R_ARM_RXPC25            249
+#define R_ARM_RSBREL32          250
+#define R_ARM_THM_RPC22         251
+#define R_ARM_RREL32            252
+#define R_ARM_RABS22            253
+#define R_ARM_RPC24             254
+#define R_ARM_RBASE             255
+
+
+
+
+
+
+#endif /* _KERNEL_ARCH_M68K_ELF_H */
Index: headers/private/system/arch/arm/arch_commpage_defs.h
===================================================================
--- headers/private/system/arch/arm/arch_commpage_defs.h        (Revision 0)
+++ headers/private/system/arch/arm/arch_commpage_defs.h        (Revision 0)
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2007, Travis Geiselbrecht. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _SYSTEM_ARCH_M68K_COMMPAGE_DEFS_H
+#define _SYSTEM_ARCH_M68K_COMMPAGE_DEFS_H
+
+#ifndef _SYSTEM_COMMPAGE_DEFS_H
+#      error Must not be included directly. Include <commpage_defs.h> instead!
+#endif
+
+//#define COMMPAGE_ENTRY_M68K_SYSCALL  (COMMPAGE_ENTRY_FIRST_ARCH_SPECIFIC + 0)
+//#define COMMPAGE_ENTRY_M68K_MEMCPY   (COMMPAGE_ENTRY_FIRST_ARCH_SPECIFIC + 1)
+
+/* 0xffff0000 colides with IO space mapped with TT1 on Atari */
+#warning ARM: determine good place for compage..
+#define ARCH_USER_COMMPAGE_ADDR (0xfeff0000)
+
+#endif /* _SYSTEM_ARCH_M68K_COMMPAGE_DEFS_H */
Index: headers/private/system/arch/arm/arch_real_time_data.h
===================================================================
--- headers/private/system/arch/arm/arch_real_time_data.h       (Revision 0)
+++ headers/private/system/arch/arm/arch_real_time_data.h       (Revision 0)
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2006, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>.
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+#ifndef _KERNEL_ARCH_REAL_TIME_DATA_H
+#define _KERNEL_ARCH_REAL_TIME_DATA_H
+
+#include <StorageDefs.h>
+#include <SupportDefs.h>
+
+#warning ARM: fix system_time()
+
+struct arch_real_time_data {
+       vint32                                          
system_time_conversion_factor;
+       vint32                                          version;
+};
+
+#endif /* _KERNEL_ARCH_REAL_TIME_DATA_H */

Other related posts: