12faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes/*
22faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Copyright (C) 2011 The Android Open Source Project
32faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes *
42faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License");
52faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * you may not use this file except in compliance with the License.
62faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * You may obtain a copy of the License at
72faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes *
82faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes *      http://www.apache.org/licenses/LICENSE-2.0
92faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes *
102faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Unless required by applicable law or agreed to in writing, software
112faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS,
122faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * See the License for the specific language governing permissions and
142faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * limitations under the License.
152faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes */
16bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers
17bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers#include "context.h"
18bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers
19a963e1c5e1f229623cfb74f11e0ccc9325090b08TDYa#if defined(__arm__)
2057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers#include "arm/context_arm.h"
21b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith#elif defined(__aarch64__)
22b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith#include "arm64/context_arm64.h"
231a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#elif defined(__mips__) && !defined(__LP64__)
247fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao#include "mips/context_mips.h"
251a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#elif defined(__mips__) && defined(__LP64__)
261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#include "mips64/context_mips64.h"
277fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao#elif defined(__i386__)
2857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers#include "x86/context_x86.h"
29ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers#elif defined(__x86_64__)
30ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers#include "x86_64/context_x86_64.h"
31ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers#else
32ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers#include "base/logging.h"
33a963e1c5e1f229623cfb74f11e0ccc9325090b08TDYa#endif
34bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers
35bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogersnamespace art {
36bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers
37bdb0391258abc54bf77c676e36847d28a783bfe5Ian RogersContext* Context::Create() {
38bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers#if defined(__arm__)
39bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers  return new arm::ArmContext();
40b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith#elif defined(__aarch64__)
41b95a5345ae4217b70ca36f0cced92f68dda7caf5Stuart Monteith  return new arm64::Arm64Context();
421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#elif defined(__mips__) && !defined(__LP64__)
437fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao  return new mips::MipsContext();
441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#elif defined(__mips__) && defined(__LP64__)
451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe  return new mips64::Mips64Context();
467fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao#elif defined(__i386__)
47bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers  return new x86::X86Context();
48ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers#elif defined(__x86_64__)
49ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers  return new x86_64::X86_64Context();
507fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao#else
51c0228b8f02c05ed58bea58490e0d8bdcaf8c5bb8jeffhao  UNIMPLEMENTED(FATAL);
52ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers  return nullptr;
53bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers#endif
54bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers}
55bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers
56bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers}  // namespace art
57