system.hh revision 10554
15132Sgblack@eecs.umich.edu/*
25132Sgblack@eecs.umich.edu * Copyright (c) 2007 The Hewlett-Packard Development Company
35132Sgblack@eecs.umich.edu * All rights reserved.
45132Sgblack@eecs.umich.edu *
57087Snate@binkert.org * The license below extends only to copyright in the software and shall
67087Snate@binkert.org * not be construed as granting a license to any other intellectual
77087Snate@binkert.org * property including but not limited to intellectual property relating
87087Snate@binkert.org * to a hardware implementation of the functionality of the software
97087Snate@binkert.org * licensed hereunder.  You may use the software subject to the license
107087Snate@binkert.org * terms below provided that you ensure that this notice is replicated
117087Snate@binkert.org * unmodified and in its entirety in all distributions of the software,
127087Snate@binkert.org * modified or unmodified, in source code or in binary form.
135132Sgblack@eecs.umich.edu *
147087Snate@binkert.org * Redistribution and use in source and binary forms, with or without
157087Snate@binkert.org * modification, are permitted provided that the following conditions are
167087Snate@binkert.org * met: redistributions of source code must retain the above copyright
177087Snate@binkert.org * notice, this list of conditions and the following disclaimer;
187087Snate@binkert.org * redistributions in binary form must reproduce the above copyright
197087Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
207087Snate@binkert.org * documentation and/or other materials provided with the distribution;
217087Snate@binkert.org * neither the name of the copyright holders nor the names of its
225132Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
237087Snate@binkert.org * this software without specific prior written permission.
245132Sgblack@eecs.umich.edu *
255132Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
265132Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
275132Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
285132Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
295132Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
305132Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
315132Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
325132Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
335132Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
345132Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
355132Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
365132Sgblack@eecs.umich.edu *
375132Sgblack@eecs.umich.edu * Authors: Gabe Black
385132Sgblack@eecs.umich.edu */
395132Sgblack@eecs.umich.edu
405132Sgblack@eecs.umich.edu#ifndef __ARCH_X86_SYSTEM_HH__
415132Sgblack@eecs.umich.edu#define __ARCH_X86_SYSTEM_HH__
425132Sgblack@eecs.umich.edu
435132Sgblack@eecs.umich.edu#include <string>
445132Sgblack@eecs.umich.edu#include <vector>
455132Sgblack@eecs.umich.edu
4610554Salexandru.dutu@amd.com#include "arch/x86/regs/misc.hh"
475132Sgblack@eecs.umich.edu#include "base/loader/symtab.hh"
485132Sgblack@eecs.umich.edu#include "cpu/pc_event.hh"
495132Sgblack@eecs.umich.edu#include "kern/system_events.hh"
505132Sgblack@eecs.umich.edu#include "params/X86System.hh"
515132Sgblack@eecs.umich.edu#include "sim/sim_object.hh"
525132Sgblack@eecs.umich.edu#include "sim/system.hh"
535132Sgblack@eecs.umich.edu
545334Sgblack@eecs.umich.edunamespace X86ISA
555334Sgblack@eecs.umich.edu{
565334Sgblack@eecs.umich.edu    namespace SMBios
575334Sgblack@eecs.umich.edu    {
585334Sgblack@eecs.umich.edu        class SMBiosTable;
595334Sgblack@eecs.umich.edu    }
605625Sgblack@eecs.umich.edu    namespace IntelMP
615625Sgblack@eecs.umich.edu    {
625625Sgblack@eecs.umich.edu        class FloatingPointer;
635625Sgblack@eecs.umich.edu        class ConfigTable;
645625Sgblack@eecs.umich.edu    }
6510299Salexandru.dutu@amd.com
6610554Salexandru.dutu@amd.com    void installSegDesc(ThreadContext *tc, SegmentRegIndex seg,
6710554Salexandru.dutu@amd.com                        SegDescriptor desc, bool longmode);
6810554Salexandru.dutu@amd.com
6910299Salexandru.dutu@amd.com    /* memory mappings for KVMCpu in SE mode */
7010299Salexandru.dutu@amd.com    const uint64_t syscallCodeVirtAddr = 0xffff800000000000;
7110299Salexandru.dutu@amd.com    const uint64_t syscallCodePhysAddr = 0x60000;
7210299Salexandru.dutu@amd.com    const uint64_t GDTVirtAddr = 0xffff800000001000;
7310299Salexandru.dutu@amd.com    const uint64_t GDTPhysAddr = 0x61000;
7410299Salexandru.dutu@amd.com    const uint64_t IDTVirtAddr = 0xffff800000002000;
7510299Salexandru.dutu@amd.com    const uint64_t IDTPhysAddr = 0x62000;
7610299Salexandru.dutu@amd.com    const uint64_t TSSVirtAddr = 0xffff800000003000;
7710299Salexandru.dutu@amd.com    const uint64_t TSSPhysAddr = 0x63000;
7810299Salexandru.dutu@amd.com    const uint64_t ISTVirtAddr = 0xffff800000004000;
7910299Salexandru.dutu@amd.com    const uint64_t ISTPhysAddr = 0x64000;
8010554Salexandru.dutu@amd.com    const uint64_t PFHandlerVirtAddr = 0xffff800000005000;
8110554Salexandru.dutu@amd.com    const uint64_t PFHandlerPhysAddr = 0x65000;
8210554Salexandru.dutu@amd.com    const uint64_t MMIORegionVirtAddr = 0xffffc90000000000;
8310554Salexandru.dutu@amd.com    const uint64_t MMIORegionPhysAddr = 0xffff0000;
8410299Salexandru.dutu@amd.com
8510299Salexandru.dutu@amd.com    const uint64_t pageTablePhysAddr = 0x70000;
865334Sgblack@eecs.umich.edu}
875334Sgblack@eecs.umich.edu
885132Sgblack@eecs.umich.educlass X86System : public System
895132Sgblack@eecs.umich.edu{
905132Sgblack@eecs.umich.edu  public:
915132Sgblack@eecs.umich.edu    typedef X86SystemParams Params;
925132Sgblack@eecs.umich.edu    X86System(Params *p);
935132Sgblack@eecs.umich.edu    ~X86System();
945132Sgblack@eecs.umich.edu
955132Sgblack@eecs.umich.edu/**
965132Sgblack@eecs.umich.edu * Serialization stuff
975132Sgblack@eecs.umich.edu */
985132Sgblack@eecs.umich.edu  public:
995299Sgblack@eecs.umich.edu
1007532Ssteve.reinhardt@amd.com    void initState();
1015132Sgblack@eecs.umich.edu
1025132Sgblack@eecs.umich.edu  protected:
1035334Sgblack@eecs.umich.edu
1045334Sgblack@eecs.umich.edu    X86ISA::SMBios::SMBiosTable * smbiosTable;
1055625Sgblack@eecs.umich.edu    X86ISA::IntelMP::FloatingPointer * mpFloatingPointer;
1065625Sgblack@eecs.umich.edu    X86ISA::IntelMP::ConfigTable * mpConfigTable;
1075627Sgblack@eecs.umich.edu    X86ISA::ACPI::RSDP * rsdp;
1085334Sgblack@eecs.umich.edu
1095615Sgblack@eecs.umich.edu    void writeOutSMBiosTable(Addr header,
1105615Sgblack@eecs.umich.edu            Addr &headerSize, Addr &tableSize, Addr table = 0);
1115334Sgblack@eecs.umich.edu
1125625Sgblack@eecs.umich.edu    void writeOutMPTable(Addr fp,
1135625Sgblack@eecs.umich.edu            Addr &fpSize, Addr &tableSize, Addr table = 0);
1145625Sgblack@eecs.umich.edu
1155132Sgblack@eecs.umich.edu    const Params *params() const { return (const Params *)_params; }
1165132Sgblack@eecs.umich.edu
1175132Sgblack@eecs.umich.edu    virtual Addr fixFuncEventAddr(Addr addr)
1185132Sgblack@eecs.umich.edu    {
1195132Sgblack@eecs.umich.edu        //XXX This may eventually have to do something useful.
1205132Sgblack@eecs.umich.edu        return addr;
1215132Sgblack@eecs.umich.edu    }
1225132Sgblack@eecs.umich.edu};
1235132Sgblack@eecs.umich.edu
1245132Sgblack@eecs.umich.edu#endif
1255132Sgblack@eecs.umich.edu
126