mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
Flat address x86_64 port of Nuttx (#411)
* arch: x86_64: Pour-in the x86_64 code from cRTOS repository, excluding modifications of NuttX kernel, jailhouse support and linux compatibility layer * arch: x86_64: Refactor x86_64 loading procedure for better comprehension and included support for multiboot2 * arch: x86_64: Locate the kernel at 4GB~ and modify the page table initializing procedure accordingly * arch: x86_64: Implemented kconfig option for various x86_64 capabilities, dynamic probe and check capability on lowsetup before enabling * arch: x86_64: inte64_check_capability: Use Marco to prettify the capability checking procedure * arch: x86_64: intel64_timerisr.c: Refactor with new frequency calibrating method * arch: x86_64: Fix C alias of page table and GDT/IST * arch: x86_64: Reload GTDR with GDT in high address in up_lowsetup * arch: x86_64: Consolidate MSR definition in arch/arch.h * arch: x86_64: Edit the way of handling GDT/IST in C into structures * arch: x86_64: Correct the starting point of isr/irq stack * arch: x86_64: Update up_initialize.c with the new initializing procedure * arch: x86_64: up_map_region now take flags instead of assuming WR/PRESENT * arch: x86_64: Overhual of interrupt initialization procedure * arch: x86_64: Properly configure the heap to be memory as [_ebss, end of memory] * arch: x86_64: Try to probe the TSC frequency, fall-back to user specified frequency on failure * arch: x86_64: Remove debug printing during restore_aux, causing infinite CTX bug * arch: x86_64: for X86 16500 serial interrupt to work, OUT2 of MCR must be 1. Make it stuck at 1 after boot * arch: x86_64: Correctly apply license header, comment and format code * arch: x86_64: properly send a SIGFPE on floating point error * arch: x86_64: Remove unused variable in up_restore_auxstate * arch: x86_64: properly trash the processor with an infinite loop * arch: x86_64: Fix typo in ISR handler causing ISR not handled * arch: x86_64: Fix possibile race conditions with scheduler debug option on in signal handling path * arch: x86_64: Fix typo in MSR_X2APIC_LVTT_TSC_DEADLINE * arch: x86_64: Migrate tickless implementation to the new MSR naming and frequency calibration method * board: x86_64: qemu: Add guard to exclude up_netinitialize when compiling without net support * arch: x86_64: update defconfigs * arch: x86_64: rename qemu as qemu-intel64 * arch: x86_64: update Board readme
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
/chip
|
||||
/board
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
arch/x86_64/include/README.txt
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This directory holds x86_64-specific header files. The top-level header files in
|
||||
arch/x86_64/include simply include corresponding header files from lower lower-
|
||||
level chip-specific and architecture-specific directories.
|
||||
|
||||
Architecture-Specific Directories
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Architecture-specific directories hold common header files for specific x86_64
|
||||
architectures.
|
||||
|
||||
intel64
|
||||
This directory holds definitions appropriate for any instantiation of the
|
||||
Intel architecture in 64bit long mode.
|
||||
|
||||
Chip-Specific directories
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The same x86 architecture may be realized in different chip implementations.
|
||||
For SoC chips, in particular, on-chip devices and differing interrupt
|
||||
structures may require special, chip-specific definitions in these chip-
|
||||
specific directories.
|
||||
|
||||
broadwell
|
||||
This is the implementation of NuttX on the Intel Broadwell processors.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/arch.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through arch/arch.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_ARCH_H
|
||||
#define __ARCH_X86_64_INCLUDE_ARCH_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/* Include chip-specific definitions */
|
||||
|
||||
# include <arch/chip/arch.h>
|
||||
|
||||
/* Include architecture-specific definitions */
|
||||
|
||||
#ifdef CONFIG_ARCH_INTEL64
|
||||
# include <arch/intel64/arch.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_ARCH_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,230 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/intel64/inttypes.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_INTEL64_INTTYPES_H
|
||||
#define __ARCH_X86_64_INCLUDE_INTEL64_INTTYPES_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define PRId8 "d"
|
||||
#define PRId16 "d"
|
||||
#define PRId32 "d"
|
||||
#define PRId64 "lld"
|
||||
|
||||
#define PRIdLEAST8 "d"
|
||||
#define PRIdLEAST16 "d"
|
||||
#define PRIdLEAST32 "d"
|
||||
#define PRIdLEAST64 "lld"
|
||||
|
||||
#define PRIdFAST8 "d"
|
||||
#define PRIdFAST16 "d"
|
||||
#define PRIdFAST32 "d"
|
||||
#define PRIdFAST64 "lld"
|
||||
|
||||
#define PRIdMAX "lld"
|
||||
#define PRIdPTR "lld"
|
||||
|
||||
#define PRIi8 "i"
|
||||
#define PRIi16 "i"
|
||||
#define PRIi32 "i"
|
||||
#define PRIi64 "lli"
|
||||
|
||||
#define PRIiLEAST8 "i"
|
||||
#define PRIiLEAST16 "i"
|
||||
#define PRIiLEAST32 "i"
|
||||
#define PRIiLEAST64 "lli"
|
||||
|
||||
#define PRIiFAST8 "i"
|
||||
#define PRIiFAST16 "i"
|
||||
#define PRIiFAST32 "i"
|
||||
#define PRIiFAST64 "lli"
|
||||
|
||||
#define PRIiMAX "lli"
|
||||
#define PRIiPTR "lli"
|
||||
|
||||
#define PRIo8 "o"
|
||||
#define PRIo16 "o"
|
||||
#define PRIo32 "o"
|
||||
#define PRIo64 "llo"
|
||||
|
||||
#define PRIoLEAST8 "o"
|
||||
#define PRIoLEAST16 "o"
|
||||
#define PRIoLEAST32 "o"
|
||||
#define PRIoLEAST64 "llo"
|
||||
|
||||
#define PRIoFAST8 "o"
|
||||
#define PRIoFAST16 "o"
|
||||
#define PRIoFAST32 "o"
|
||||
#define PRIoFAST64 "llo"
|
||||
|
||||
#define PRIoMAX "llo"
|
||||
#define PRIoPTR "llo"
|
||||
|
||||
#define PRIu8 "u"
|
||||
#define PRIu16 "u"
|
||||
#define PRIu32 "u"
|
||||
#define PRIu64 "llu"
|
||||
|
||||
#define PRIuLEAST8 "u"
|
||||
#define PRIuLEAST16 "u"
|
||||
#define PRIuLEAST32 "u"
|
||||
#define PRIuLEAST64 "llu"
|
||||
|
||||
#define PRIuFAST8 "u"
|
||||
#define PRIuFAST16 "u"
|
||||
#define PRIuFAST32 "u"
|
||||
#define PRIuFAST64 "llu"
|
||||
|
||||
#define PRIuMAX "llu"
|
||||
#define PRIuPTR "llu"
|
||||
|
||||
#define PRIx8 "x"
|
||||
#define PRIx16 "x"
|
||||
#define PRIx32 "x"
|
||||
#define PRIx64 "llx"
|
||||
|
||||
#define PRIxLEAST8 "x"
|
||||
#define PRIxLEAST16 "x"
|
||||
#define PRIxLEAST32 "x"
|
||||
#define PRIxLEAST64 "llx"
|
||||
|
||||
#define PRIxFAST8 "x"
|
||||
#define PRIxFAST16 "x"
|
||||
#define PRIxFAST32 "x"
|
||||
#define PRIxFAST64 "llx"
|
||||
|
||||
#define PRIxMAX "llx"
|
||||
#define PRIxPTR "llx"
|
||||
|
||||
#define PRIX8 "X"
|
||||
#define PRIX16 "X"
|
||||
#define PRIX32 "X"
|
||||
#define PRIX64 "llX"
|
||||
|
||||
#define PRIXLEAST8 "X"
|
||||
#define PRIXLEAST16 "X"
|
||||
#define PRIXLEAST32 "X"
|
||||
#define PRIXLEAST64 "llX"
|
||||
|
||||
#define PRIXFAST8 "X"
|
||||
#define PRIXFAST16 "X"
|
||||
#define PRIXFAST32 "X"
|
||||
#define PRIXFAST64 "llX"
|
||||
|
||||
#define PRIXMAX "llX"
|
||||
#define PRIXPTR "llX"
|
||||
|
||||
#define SCNd8 "hhd"
|
||||
#define SCNd16 "hd"
|
||||
#define SCNd32 "d"
|
||||
#define SCNd64 "lld"
|
||||
|
||||
#define SCNdLEAST8 "hhd"
|
||||
#define SCNdLEAST16 "hd"
|
||||
#define SCNdLEAST32 "d"
|
||||
#define SCNdLEAST64 "lld"
|
||||
|
||||
#define SCNdFAST8 "hhd"
|
||||
#define SCNdFAST16 "hd"
|
||||
#define SCNdFAST32 "d"
|
||||
#define SCNdFAST64 "lld"
|
||||
|
||||
#define SCNdMAX "lld"
|
||||
#define SCNdPTR "lld"
|
||||
|
||||
#define SCNi8 "hhi"
|
||||
#define SCNi16 "hi"
|
||||
#define SCNi32 "i"
|
||||
#define SCNi64 "lli"
|
||||
|
||||
#define SCNiLEAST8 "hhi"
|
||||
#define SCNiLEAST16 "hi"
|
||||
#define SCNiLEAST32 "i"
|
||||
#define SCNiLEAST64 "lli"
|
||||
|
||||
#define SCNiFAST8 "hhi"
|
||||
#define SCNiFAST16 "hi"
|
||||
#define SCNiFAST32 "i"
|
||||
#define SCNiFAST64 "lli"
|
||||
|
||||
#define SCNiMAX "lli"
|
||||
#define SCNiPTR "lli"
|
||||
|
||||
#define SCNo8 "hho"
|
||||
#define SCNo16 "ho"
|
||||
#define SCNo32 "o"
|
||||
#define SCNo64 "llo"
|
||||
|
||||
#define SCNoLEAST8 "hho"
|
||||
#define SCNoLEAST16 "ho"
|
||||
#define SCNoLEAST32 "o"
|
||||
#define SCNoLEAST64 "llo"
|
||||
|
||||
#define SCNoFAST8 "hho"
|
||||
#define SCNoFAST16 "ho"
|
||||
#define SCNoFAST32 "o"
|
||||
#define SCNoFAST64 "llo"
|
||||
|
||||
#define SCNoMAX "llo"
|
||||
#define SCNoPTR "llo"
|
||||
|
||||
#define SCNu8 "hhu"
|
||||
#define SCNu16 "hu"
|
||||
#define SCNu32 "u"
|
||||
#define SCNu64 "llu"
|
||||
|
||||
#define SCNuLEAST8 "hhu"
|
||||
#define SCNuLEAST16 "hu"
|
||||
#define SCNuLEAST32 "u"
|
||||
#define SCNuLEAST64 "llu"
|
||||
|
||||
#define SCNuFAST8 "hhu"
|
||||
#define SCNuFAST16 "hu"
|
||||
#define SCNuFAST32 "u"
|
||||
#define SCNuFAST64 "llu"
|
||||
|
||||
#define SCNuMAX "llu"
|
||||
#define SCNuPTR "u"
|
||||
|
||||
#define SCNx8 "hhx"
|
||||
#define SCNx16 "hx"
|
||||
#define SCNx32 "x"
|
||||
#define SCNx64 "llx"
|
||||
|
||||
#define SCNxLEAST8 "hhx"
|
||||
#define SCNxLEAST16 "hx"
|
||||
#define SCNxLEAST32 "x"
|
||||
#define SCNxLEAST64 "llx"
|
||||
|
||||
#define SCNxFAST8 "hhx"
|
||||
#define SCNxFAST16 "hx"
|
||||
#define SCNxFAST32 "x"
|
||||
#define SCNxFAST64 "llx"
|
||||
|
||||
#define SCNxMAX "llx"
|
||||
#define SCNxPTR "x"
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_INTEL64_INTTYPES_H */
|
||||
@@ -0,0 +1,206 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/intel64/io.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through arch/io.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_INTEL64_IO_H
|
||||
#define __ARCH_X86_64_INCLUDE_INTEL64_IO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <arch/arch.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/* Standard x86 Port I/O */
|
||||
|
||||
static inline void outb(uint8_t regval, uint16_t port)
|
||||
{
|
||||
asm volatile(
|
||||
"\toutb %0,%1\n"
|
||||
:
|
||||
: "a" (regval), "dN" (port)
|
||||
);
|
||||
}
|
||||
|
||||
static inline uint8_t inb(uint16_t port)
|
||||
{
|
||||
uint8_t regval;
|
||||
asm volatile(
|
||||
"\tinb %1,%0\n"
|
||||
: "=a" (regval)
|
||||
: "dN" (port)
|
||||
);
|
||||
return regval;
|
||||
}
|
||||
|
||||
static inline void outw(uint16_t regval, uint16_t port)
|
||||
{
|
||||
asm volatile(
|
||||
"\toutw %0,%1\n"
|
||||
:
|
||||
: "a" (regval), "dN" (port)
|
||||
);
|
||||
}
|
||||
|
||||
static inline uint16_t inw(uint16_t port)
|
||||
{
|
||||
uint16_t regval;
|
||||
|
||||
asm volatile(
|
||||
"\tinw %1,%0\n"
|
||||
: "=a" (regval)
|
||||
: "dN" (port)
|
||||
);
|
||||
return regval;
|
||||
}
|
||||
|
||||
static inline void outl(uint32_t regval, uint16_t port)
|
||||
{
|
||||
asm volatile(
|
||||
"\toutl %0,%1\n"
|
||||
:
|
||||
: "a" (regval), "dN" (port)
|
||||
);
|
||||
}
|
||||
|
||||
static inline uint32_t inl(uint16_t port)
|
||||
{
|
||||
uint32_t regval;
|
||||
asm volatile(
|
||||
"\tinl %1,%0\n"
|
||||
: "=a" (regval)
|
||||
: "dN" (port)
|
||||
);
|
||||
return regval;
|
||||
}
|
||||
|
||||
/* MMIO */
|
||||
|
||||
static inline uint8_t mmio_read8(void *address)
|
||||
{
|
||||
return *(volatile uint8_t *)address;
|
||||
}
|
||||
|
||||
static inline uint16_t mmio_read16(void *address)
|
||||
{
|
||||
return *(volatile uint16_t *)address;
|
||||
}
|
||||
|
||||
static inline uint32_t mmio_read32(void *address)
|
||||
{
|
||||
uint32_t value;
|
||||
|
||||
/* Assembly-encoded to match the hypervisor MMIO parser support */
|
||||
|
||||
asm volatile("movl (%1),%0" : "=r" (value) : "r" (address));
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline uint64_t mmio_read64(void *address)
|
||||
{
|
||||
return *(volatile uint64_t *)address;
|
||||
}
|
||||
|
||||
static inline void mmio_write8(void *address, uint8_t value)
|
||||
{
|
||||
*(volatile uint8_t *)address = value;
|
||||
}
|
||||
|
||||
static inline void mmio_write16(void *address, uint16_t value)
|
||||
{
|
||||
*(volatile uint16_t *)address = value;
|
||||
}
|
||||
|
||||
static inline void mmio_write32(void *address, uint32_t value)
|
||||
{
|
||||
/* Assembly-encoded to match the hypervisor MMIO parser support */
|
||||
|
||||
asm volatile("movl %0,(%1)" : : "r" (value), "r" (address));
|
||||
}
|
||||
|
||||
static inline void mmio_write64(void *address, uint64_t value)
|
||||
{
|
||||
*(volatile uint64_t *)address = value;
|
||||
}
|
||||
|
||||
static inline void up_trash_cpu(void)
|
||||
{
|
||||
for (; ; )
|
||||
{
|
||||
asm volatile ("cli;hlt;");
|
||||
}
|
||||
|
||||
asm("ud2":::"memory");
|
||||
}
|
||||
|
||||
static inline void up_invalid_TLB(uintptr_t start, uintptr_t end)
|
||||
{
|
||||
uintptr_t i;
|
||||
|
||||
start = start & PAGE_MASK;
|
||||
end = (end + PAGE_SIZE - 1) & PAGE_MASK;
|
||||
|
||||
for (i = start; i < end; i += PAGE_SIZE)
|
||||
{
|
||||
asm("invlpg %0;":: "m"(i):"memory");
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_X86_64_INCLUDE_INTEL64_IO_H */
|
||||
@@ -0,0 +1,304 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/intel64/irq.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through nuttx/irq.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_INTEL64_IRQ_H
|
||||
#define __ARCH_X86_64_INCLUDE_INTEL64_IRQ_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
# include <stdbool.h>
|
||||
# include <arch/arch.h>
|
||||
# include <semaphore.h>
|
||||
# include <time.h>
|
||||
# include <debug.h>
|
||||
# include <nuttx/config.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* ISR and IRQ numbers */
|
||||
|
||||
#define ISR0 0 /* Division by zero exception */
|
||||
#define ISR1 1 /* Debug exception */
|
||||
#define ISR2 2 /* Non maskable interrupt */
|
||||
#define ISR3 3 /* Breakpoint exception */
|
||||
#define ISR4 4 /* 'Into detected overflow' */
|
||||
#define ISR5 5 /* Out of bounds exception */
|
||||
#define ISR6 6 /* Invalid opcode exception */
|
||||
#define ISR7 7 /* No coprocessor exception */
|
||||
#define ISR8 8 /* Double fault (pushes an error code) */
|
||||
#define ISR9 9 /* Coprocessor segment overrun */
|
||||
#define ISR10 10 /* Bad TSS (pushes an error code) */
|
||||
#define ISR11 11 /* Segment not present (pushes an error code) */
|
||||
#define ISR12 12 /* Stack fault (pushes an error code) */
|
||||
#define ISR13 13 /* General protection fault (pushes an error code) */
|
||||
#define ISR14 14 /* Page fault (pushes an error code) */
|
||||
#define ISR15 15 /* Unknown interrupt exception */
|
||||
#define ISR16 16 /* Coprocessor fault */
|
||||
#define ISR17 17 /* Alignment check exception */
|
||||
#define ISR18 18 /* Machine check exception */
|
||||
#define ISR19 19 /* SIMD Float-Point Exception*/
|
||||
#define ISR20 20 /* Virtualization Exception */
|
||||
#define ISR21 21 /* Reserved */
|
||||
#define ISR22 22 /* Reserved */
|
||||
#define ISR23 23 /* Reserved */
|
||||
#define ISR24 24 /* Reserved */
|
||||
#define ISR25 25 /* Reserved */
|
||||
#define ISR26 26 /* Reserved */
|
||||
#define ISR27 27 /* Reserved */
|
||||
#define ISR28 28 /* Reserved */
|
||||
#define ISR29 29 /* Reserved */
|
||||
#define ISR30 30 /* Security Exception */
|
||||
#define ISR31 31 /* Reserved */
|
||||
|
||||
#define IRQ0 32 /* System timer (cannot be changed) */
|
||||
#define IRQ1 33 /* Keyboard controller (cannot be changed) */
|
||||
#define IRQ2 34 /* Cascaded signals from IRQs 8~15 */
|
||||
#define IRQ3 35 /* Serial port controller for COM2/4 */
|
||||
#define IRQ4 36 /* serial port controller for COM1/3 */
|
||||
#define IRQ5 37 /* LPT port 2 or sound card */
|
||||
#define IRQ6 38 /* Floppy disk controller */
|
||||
#define IRQ7 39 /* LPT port 1 or sound card */
|
||||
#define IRQ8 40 /* Real time clock (RTC) */
|
||||
#define IRQ9 41 /* Open interrupt/available or SCSI host adapter */
|
||||
#define IRQ10 42 /* Open interrupt/available or SCSI or NIC */
|
||||
#define IRQ11 43 /* Open interrupt/available or SCSI or NIC */
|
||||
#define IRQ12 44 /* Mouse on PS/2 connector */
|
||||
#define IRQ13 45 /* Math coprocessor */
|
||||
#define IRQ14 46 /* Primary ATA channel */
|
||||
#define IRQ15 47 /* Secondary ATA channel */
|
||||
|
||||
#define IRQ_ERROR 51 /* APIC Error */
|
||||
#define IRQ_SPURIOUS 0xff /* Spurious Interrupts */
|
||||
|
||||
#define NR_IRQS 48
|
||||
|
||||
/* Common register save structure created by up_saveusercontext() and by
|
||||
* ISR/IRQ interrupt processing.
|
||||
*/
|
||||
|
||||
#define XCPTCONTEXT_XMM_AREA_SIZE 512
|
||||
#define XMMAREA_OFFSET XCPTCONTEXT_XMM_AREA_SIZE / 8
|
||||
|
||||
/* Data segments */
|
||||
|
||||
#define REG_ALIGN (0 + XMMAREA_OFFSET) /* " " "" " " "" " " " " */
|
||||
#define REG_FS (1 + XMMAREA_OFFSET) /* " " "" " " "" " " " " */
|
||||
#define REG_GS (2 + XMMAREA_OFFSET) /* " " "" " " "" " " " " */
|
||||
#define REG_ES (3 + XMMAREA_OFFSET) /* " " "" " " "" " " " " */
|
||||
#define REG_DS (4 + XMMAREA_OFFSET) /* Data segment selector */
|
||||
|
||||
/* Remaining regs */
|
||||
|
||||
#define REG_RAX (5 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_RBX (6 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_RBP (7 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_R10 (8 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_R11 (9 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_R12 (10 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_R13 (11 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_R14 (12 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_R15 (13 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
|
||||
/* ABI calling convention */
|
||||
|
||||
#define REG_R9 (14 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_R8 (15 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_RCX (16 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_RDX (17 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_RSI (18 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
#define REG_RDI (19 + XMMAREA_OFFSET) /* " " "" " " */
|
||||
|
||||
/* IRQ saved */
|
||||
|
||||
#define REG_ERRCODE (20 + XMMAREA_OFFSET) /* Error code */
|
||||
#define REG_RIP (21 + XMMAREA_OFFSET) /* Pushed by process on interrupt processing */
|
||||
#define REG_CS (22 + XMMAREA_OFFSET) /* " " "" " " "" " " " " */
|
||||
#define REG_RFLAGS (23 + XMMAREA_OFFSET) /* " " "" " " "" " " " " */
|
||||
#define REG_RSP (24 + XMMAREA_OFFSET) /* " " "" " " "" " " " " */
|
||||
#define REG_SS (25 + XMMAREA_OFFSET) /* " " "" " " "" " " " " */
|
||||
|
||||
/* NOTE 2: This is not really state data. Rather, this is just a convenient
|
||||
* way to pass parameters from the interrupt handler to C code.
|
||||
*/
|
||||
|
||||
#define XCPTCONTEXT_REGS (26 + XCPTCONTEXT_XMM_AREA_SIZE / 8)
|
||||
#define XCPTCONTEXT_SIZE (8 * XCPTCONTEXT_REGS + XCPTCONTEXT_XMM_AREA_SIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
enum ioapic_trigger_mode
|
||||
{
|
||||
TRIGGER_RISING_EDGE = 0,
|
||||
TRIGGER_FALLING_EDGE = (1 << 13),
|
||||
TRIGGER_LEVEL_ACTIVE_HIGH = 1 << 15,
|
||||
TRIGGER_LEVEL_ACTIVE_LOW = (1 << 15) | (1 << 13),
|
||||
};
|
||||
|
||||
/* This struct defines the way the registers are stored */
|
||||
|
||||
struct xcptcontext
|
||||
{
|
||||
/* The following function pointer is non-zero if there are pending signals
|
||||
* to be processed.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
||||
|
||||
/* These are saved copies of instruction pointer and EFLAGS used during
|
||||
* signal processing.
|
||||
*/
|
||||
|
||||
uint64_t saved_rip;
|
||||
uint64_t saved_rflags;
|
||||
uint64_t saved_rsp;
|
||||
#endif
|
||||
|
||||
/* Register save area */
|
||||
|
||||
uint64_t regs[XCPTCONTEXT_REGS] __attribute__((aligned (16)));
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* Name: up_irq_save, up_irq_restore, and friends.
|
||||
*
|
||||
* NOTE: This function should never be called from application code and,
|
||||
* as a general rule unless you really know what you are doing, this
|
||||
* function should not be called directly from operation system code either:
|
||||
* Typically, the wrapper functions, enter_critical_section() and
|
||||
* leave_critical section(), are probably what you really want.
|
||||
*/
|
||||
|
||||
/* Get the current FLAGS register contents */
|
||||
|
||||
static inline irqstate_t irqflags()
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
asm volatile(
|
||||
"\tpushfq\n"
|
||||
"\tpopq %0\n"
|
||||
: "=rm" (flags)
|
||||
:
|
||||
: "memory");
|
||||
return flags;
|
||||
}
|
||||
|
||||
/* Get a sample of the FLAGS register, determine if interrupts are disabled.
|
||||
* If the X86_FLAGS_IF is cleared by cli, then interrupts are disabled. If
|
||||
* if the X86_FLAGS_IF is set by sti, then interrupts are enable.
|
||||
*/
|
||||
|
||||
static inline bool up_irq_disabled(irqstate_t flags)
|
||||
{
|
||||
return ((flags & X86_64_RFLAGS_IF) == 0);
|
||||
}
|
||||
|
||||
static inline bool up_irq_enabled(irqstate_t flags)
|
||||
{
|
||||
return ((flags & X86_64_RFLAGS_IF) != 0);
|
||||
}
|
||||
|
||||
/* Disable interrupts unconditionally */
|
||||
|
||||
static inline void up_irq_disable(void)
|
||||
{
|
||||
asm volatile("cli": : :"memory");
|
||||
}
|
||||
|
||||
/* Enable interrupts unconditionally */
|
||||
|
||||
static inline void up_irq_enable(void)
|
||||
{
|
||||
asm volatile("sti": : :"memory");
|
||||
}
|
||||
|
||||
/* Disable interrupts, but return previous interrupt state */
|
||||
|
||||
static inline irqstate_t up_irq_save(void)
|
||||
{
|
||||
irqstate_t flags = irqflags();
|
||||
up_irq_disable();
|
||||
return flags;
|
||||
}
|
||||
|
||||
/* Conditionally disable interrupts */
|
||||
|
||||
static inline void up_irq_restore(irqstate_t flags)
|
||||
{
|
||||
if (up_irq_enabled(flags))
|
||||
{
|
||||
up_irq_enable();
|
||||
}
|
||||
}
|
||||
|
||||
static inline unsigned int up_apic_cpu_id(void)
|
||||
{
|
||||
return read_msr(MSR_X2APIC_ID);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
void up_ioapic_pin_set_vector(unsigned int pin,
|
||||
enum ioapic_trigger_mode trigger_mode,
|
||||
unsigned int vector);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_X86_INCLUDE_I486_IRQ_H */
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/intel64/limits.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_INTEL64_LIMITS_H
|
||||
#define __ARCH_X86_64_INCLUDE_INTEL64_LIMITS_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define CHAR_BIT 8
|
||||
#define SCHAR_MIN (-SCHAR_MAX - 1)
|
||||
#define SCHAR_MAX 127
|
||||
#define UCHAR_MAX 255
|
||||
|
||||
/* These could be different on machines where char is unsigned */
|
||||
|
||||
#ifdef __CHAR_UNSIGNED__
|
||||
#define CHAR_MIN 0
|
||||
#define CHAR_MAX UCHAR_MAX
|
||||
#else
|
||||
#define CHAR_MIN SCHAR_MIN
|
||||
#define CHAR_MAX SCHAR_MAX
|
||||
#endif
|
||||
|
||||
#define SHRT_MIN (-SHRT_MAX - 1)
|
||||
#define SHRT_MAX 32767
|
||||
#define USHRT_MAX 65535U
|
||||
|
||||
#define INT_MIN (-INT_MAX - 1)
|
||||
#define INT_MAX 2147483647
|
||||
#define UINT_MAX 4294967295U
|
||||
|
||||
/* For 64-bit x86 with Linux ABI, long is identical to long long */
|
||||
|
||||
#define LONG_MIN LLONG_MIN
|
||||
#define LONG_MAX LLONG_MAX
|
||||
#define ULONG_MAX ULLONG_MAX
|
||||
|
||||
#define LLONG_MIN (-LLONG_MAX - 1)
|
||||
#define LLONG_MAX 9223372036854775807LL
|
||||
#define ULLONG_MAX 18446744073709551615ULL
|
||||
|
||||
/* A pointer is 8 bytes */
|
||||
|
||||
#define PTR_MIN (-PTR_MAX - 1)
|
||||
#define PTR_MAX LLONG_MAX
|
||||
#define UPTR_MAX ULLONG_MAX
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_INTEL64_LIMITS_H */
|
||||
@@ -0,0 +1,156 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/intel64/syscall.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through include/syscall.h or include/sys/sycall.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_INTEL64_SYSCALL_H
|
||||
#define __ARCH_X86_64_INCLUDE_INTEL64_SYSCALL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
void enable_syscall(void);
|
||||
void syscall_entry(void);
|
||||
uint64_t syscall_handler(unsigned long nbr, uintptr_t parm1, uintptr_t parm2,
|
||||
uintptr_t parm3, uintptr_t parm4, uintptr_t parm5,
|
||||
uintptr_t parm6);
|
||||
uint64_t linux_interface(unsigned long nbr, uintptr_t parm1, uintptr_t parm2,
|
||||
uintptr_t parm3, uintptr_t parm4, uintptr_t parm5,
|
||||
uintptr_t parm6);
|
||||
|
||||
/* SWI with SYS_ call number and six parameters */
|
||||
|
||||
static inline uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4, uintptr_t parm5,
|
||||
uintptr_t parm6);
|
||||
|
||||
/* SWI with SYS_ call number and no parameters */
|
||||
|
||||
static inline uintptr_t sys_call0(unsigned int nbr)
|
||||
{
|
||||
return sys_call6(nbr, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and one parameter */
|
||||
|
||||
static inline uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1)
|
||||
{
|
||||
return sys_call6(nbr, parm1, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and two parameters */
|
||||
|
||||
static inline uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and three parameters */
|
||||
|
||||
static inline uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, parm3, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and four parameters */
|
||||
|
||||
static inline uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, parm3, parm4, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and five parameters */
|
||||
|
||||
static inline uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4, uintptr_t parm5)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, parm3, parm4, parm5, 0);
|
||||
}
|
||||
|
||||
static inline uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4, uintptr_t parm5,
|
||||
uintptr_t parm6)
|
||||
{
|
||||
register uint64_t reg0 __asm__("rax") = (uint64_t)(nbr);
|
||||
register uint64_t reg1 __asm__("rdi") = (uint64_t)(parm1);
|
||||
register uint64_t reg2 __asm__("rsi") = (uint64_t)(parm2);
|
||||
register uint64_t reg3 __asm__("rdx") = (uint64_t)(parm3);
|
||||
register uint64_t reg4 __asm__("r10") = (uint64_t)(parm4);
|
||||
register uint64_t reg5 __asm__("r8") = (uint64_t)(parm5);
|
||||
register uint64_t reg6 __asm__("r9") = (uint64_t)(parm6);
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"syscall"
|
||||
: "=r"(reg0)
|
||||
: "r"(reg0), "r"(reg1), "r"(reg2),
|
||||
"r"(reg3), "r"(reg4), "r"(reg5), "r"(reg6)
|
||||
: "memory"
|
||||
);
|
||||
|
||||
return reg0;
|
||||
}
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_INTEL64_SYSCALL_H */
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/intel64/types.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only
|
||||
* indirectly through arch/types.h (which is, in turn only accessed
|
||||
* through sys/types.h or stdint.h).
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_INTEL64_TYPES_H
|
||||
#define __ARCH_X86_64_INCLUDE_INTEL64_TYPES_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* These are the sizes of the standard integer types. NOTE that these type
|
||||
* names have a leading underscore character. This file will be included
|
||||
* (indirectly) by include/stdint.h and typedef'ed to the final name without
|
||||
* the underscore character. This roundabout way of doings things allows
|
||||
* the stdint.h to be removed from the include/ directory in the event that
|
||||
* the user prefers to use the definitions provided by their toolchain header
|
||||
* files
|
||||
*/
|
||||
|
||||
typedef signed char _int8_t;
|
||||
typedef unsigned char _uint8_t;
|
||||
|
||||
typedef signed short _int16_t;
|
||||
typedef unsigned short _uint16_t;
|
||||
|
||||
typedef signed int _int32_t;
|
||||
typedef unsigned int _uint32_t;
|
||||
|
||||
typedef signed long long _int64_t;
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A pointer is 8 bytes */
|
||||
|
||||
typedef signed long long _intptr_t;
|
||||
typedef unsigned long long _uintptr_t;
|
||||
|
||||
#if defined(__SIZE_TYPE__)
|
||||
/* If __SIZE_TYPE__ is defined we define ssize_t based on size_t.
|
||||
* We simply change "unsigned" to "signed" for this single definition
|
||||
* to make sure ssize_t and size_t only differ by their signedness.
|
||||
*/
|
||||
|
||||
#define unsigned signed
|
||||
typedef __SIZE_TYPE__ _ssize_t;
|
||||
#undef unsigned
|
||||
typedef __SIZE_TYPE__ _size_t;
|
||||
|
||||
#elif defined(CONFIG_ARCH_SIZET_LONG)
|
||||
|
||||
typedef signed long _ssize_t;
|
||||
typedef unsigned long _size_t;
|
||||
|
||||
#else
|
||||
|
||||
typedef signed int _ssize_t;
|
||||
typedef unsigned int _size_t;
|
||||
|
||||
#endif
|
||||
|
||||
/* This is the size of the interrupt state save returned by
|
||||
* up_irq_save()
|
||||
*/
|
||||
|
||||
typedef unsigned long irqstate_t;
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_INTEL64_TYPES_H */
|
||||
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/inttypes.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_INTTYPES_H
|
||||
#define __ARCH_X86_64_INCLUDE_INTTYPES_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_INTEL64
|
||||
# include <arch/intel64/inttypes.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_INTTYPES_H */
|
||||
@@ -0,0 +1,72 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/io.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_IO_H
|
||||
#define __ARCH_X86_64_INCLUDE_IO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/* Include architecture-specific IO definitions (These are probably common
|
||||
* across all architectures, but this gives a little bit of flexibility).
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_INTEL64
|
||||
# include <arch/intel64/io.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_IO_H */
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/irq.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through nuttx/irq.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_IRQ_H
|
||||
#define __ARCH_X86_64_INCLUDE_IRQ_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/* Include NuttX-specific IRQ definitions */
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
/* Include chip-specific IRQ definitions (including IRQ numbers) */
|
||||
|
||||
#include <arch/chip/irq.h>
|
||||
|
||||
/* Include architecture-specific IRQ definitions (including register save
|
||||
* structure and up_irq_save()/up_irq_restore() macros).
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_INTEL64
|
||||
# include <arch/intel64/irq.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_IRQ_H */
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/limits.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_LIMITS_H
|
||||
#define __ARCH_X86_64_INCLUDE_LIMITS_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/* Include architecture-specific limits */
|
||||
|
||||
#ifdef CONFIG_ARCH_INTEL64
|
||||
# include <arch/intel64/limits.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_LIMITS_H */
|
||||
@@ -0,0 +1,438 @@
|
||||
/****************************************************************************
|
||||
* multiboot2.h - Multiboot 2 header file.
|
||||
*
|
||||
* Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* 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 ANY
|
||||
* DEVELOPER OR DISTRIBUTOR 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 __ARCH_X86_64_INCLUDE_MULTIBOOT2_H
|
||||
#define __ARCH_X86_64_INCLUDE_MULTIBOOT2_H 1
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* How many bytes from the start of the file we search for the header. */
|
||||
|
||||
#define MULTIBOOT_SEARCH 32768
|
||||
#define MULTIBOOT_HEADER_ALIGN 8
|
||||
|
||||
/* The magic field should contain this. */
|
||||
|
||||
#define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
|
||||
|
||||
/* This should be in %eax. */
|
||||
|
||||
#define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289
|
||||
|
||||
/* Alignment of multiboot modules. */
|
||||
|
||||
#define MULTIBOOT_MOD_ALIGN 0x00001000
|
||||
|
||||
/* Alignment of the multiboot info structure. */
|
||||
|
||||
#define MULTIBOOT_INFO_ALIGN 0x00000008
|
||||
|
||||
/* Flags set in the ’flags’ member of the multiboot header. */
|
||||
|
||||
#define MULTIBOOT_TAG_ALIGN 8
|
||||
#define MULTIBOOT_TAG_TYPE_END 0
|
||||
#define MULTIBOOT_TAG_TYPE_CMDLINE 1
|
||||
#define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME 2
|
||||
#define MULTIBOOT_TAG_TYPE_MODULE 3
|
||||
#define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4
|
||||
#define MULTIBOOT_TAG_TYPE_BOOTDEV 5
|
||||
#define MULTIBOOT_TAG_TYPE_MMAP 6
|
||||
#define MULTIBOOT_TAG_TYPE_VBE 7
|
||||
#define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8
|
||||
#define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9
|
||||
#define MULTIBOOT_TAG_TYPE_APM 10
|
||||
#define MULTIBOOT_TAG_TYPE_EFI32 11
|
||||
#define MULTIBOOT_TAG_TYPE_EFI64 12
|
||||
#define MULTIBOOT_TAG_TYPE_SMBIOS 13
|
||||
#define MULTIBOOT_TAG_TYPE_ACPI_OLD 14
|
||||
#define MULTIBOOT_TAG_TYPE_ACPI_NEW 15
|
||||
#define MULTIBOOT_TAG_TYPE_NETWORK 16
|
||||
#define MULTIBOOT_TAG_TYPE_EFI_MMAP 17
|
||||
#define MULTIBOOT_TAG_TYPE_EFI_BS 18
|
||||
#define MULTIBOOT_TAG_TYPE_EFI32_IH 19
|
||||
#define MULTIBOOT_TAG_TYPE_EFI64_IH 20
|
||||
#define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR 21
|
||||
|
||||
#define MULTIBOOT_HEADER_TAG_END 0
|
||||
#define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1
|
||||
#define MULTIBOOT_HEADER_TAG_ADDRESS 2
|
||||
#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS 3
|
||||
#define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS 4
|
||||
#define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5
|
||||
#define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6
|
||||
#define MULTIBOOT_HEADER_TAG_EFI_BS 7
|
||||
#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI32 8
|
||||
#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9
|
||||
#define MULTIBOOT_HEADER_TAG_RELOCATABLE 10
|
||||
|
||||
#define MULTIBOOT_ARCHITECTURE_I386 0
|
||||
#define MULTIBOOT_ARCHITECTURE_MIPS32 4
|
||||
#define MULTIBOOT_HEADER_TAG_OPTIONAL 1
|
||||
|
||||
#define MULTIBOOT_LOAD_PREFERENCE_NONE 0
|
||||
#define MULTIBOOT_LOAD_PREFERENCE_LOW 1
|
||||
#define MULTIBOOT_LOAD_PREFERENCE_HIGH 2
|
||||
|
||||
#define MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED 1
|
||||
#define MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
typedef unsigned char multiboot_uint8_t;
|
||||
typedef unsigned short multiboot_uint16_t;
|
||||
typedef unsigned int multiboot_uint32_t;
|
||||
typedef unsigned long long multiboot_uint64_t;
|
||||
|
||||
struct multiboot_header
|
||||
{
|
||||
/* Must be MULTIBOOT_MAGIC - see above. */
|
||||
|
||||
multiboot_uint32_t magic;
|
||||
|
||||
/* ISA */
|
||||
|
||||
multiboot_uint32_t architecture;
|
||||
|
||||
/* Total header length. */
|
||||
|
||||
multiboot_uint32_t header_length;
|
||||
|
||||
/* The above fields plus this one must equal 0 mod 2^32. */
|
||||
|
||||
multiboot_uint32_t checksum;
|
||||
};
|
||||
|
||||
struct multiboot_header_tag
|
||||
{
|
||||
multiboot_uint16_t type;
|
||||
multiboot_uint16_t flags;
|
||||
multiboot_uint32_t size;
|
||||
};
|
||||
|
||||
struct multiboot_header_tag_information_request
|
||||
{
|
||||
multiboot_uint16_t type;
|
||||
multiboot_uint16_t flags;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t requests[0];
|
||||
};
|
||||
|
||||
struct multiboot_header_tag_address
|
||||
{
|
||||
multiboot_uint16_t type;
|
||||
multiboot_uint16_t flags;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t header_addr;
|
||||
multiboot_uint32_t load_addr;
|
||||
multiboot_uint32_t load_end_addr;
|
||||
multiboot_uint32_t bss_end_addr;
|
||||
};
|
||||
|
||||
struct multiboot_header_tag_entry_address
|
||||
{
|
||||
multiboot_uint16_t type;
|
||||
multiboot_uint16_t flags;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t entry_addr;
|
||||
};
|
||||
|
||||
struct multiboot_header_tag_console_flags
|
||||
{
|
||||
multiboot_uint16_t type;
|
||||
multiboot_uint16_t flags;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t console_flags;
|
||||
};
|
||||
|
||||
struct multiboot_header_tag_framebuffer
|
||||
{
|
||||
multiboot_uint16_t type;
|
||||
multiboot_uint16_t flags;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t width;
|
||||
multiboot_uint32_t height;
|
||||
multiboot_uint32_t depth;
|
||||
};
|
||||
|
||||
struct multiboot_header_tag_module_align
|
||||
{
|
||||
multiboot_uint16_t type;
|
||||
multiboot_uint16_t flags;
|
||||
multiboot_uint32_t size;
|
||||
};
|
||||
|
||||
struct multiboot_header_tag_relocatable
|
||||
{
|
||||
multiboot_uint16_t type;
|
||||
multiboot_uint16_t flags;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t min_addr;
|
||||
multiboot_uint32_t max_addr;
|
||||
multiboot_uint32_t align;
|
||||
multiboot_uint32_t preference;
|
||||
};
|
||||
|
||||
struct multiboot_color
|
||||
{
|
||||
multiboot_uint8_t red;
|
||||
multiboot_uint8_t green;
|
||||
multiboot_uint8_t blue;
|
||||
};
|
||||
|
||||
struct multiboot_mmap_entry
|
||||
{
|
||||
multiboot_uint64_t addr;
|
||||
multiboot_uint64_t len;
|
||||
#define MULTIBOOT_MEMORY_AVAILABLE 1
|
||||
#define MULTIBOOT_MEMORY_RESERVED 2
|
||||
#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
|
||||
#define MULTIBOOT_MEMORY_NVS 4
|
||||
#define MULTIBOOT_MEMORY_BADRAM 5
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t zero;
|
||||
};
|
||||
|
||||
typedef struct multiboot_mmap_entry multiboot_memory_map_t;
|
||||
|
||||
struct multiboot_tag
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
};
|
||||
|
||||
struct multiboot_tag_string
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
char string[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_module
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t mod_start;
|
||||
multiboot_uint32_t mod_end;
|
||||
char cmdline[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_basic_meminfo
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t mem_lower;
|
||||
multiboot_uint32_t mem_upper;
|
||||
};
|
||||
|
||||
struct multiboot_tag_bootdev
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t biosdev;
|
||||
multiboot_uint32_t slice;
|
||||
multiboot_uint32_t part;
|
||||
};
|
||||
|
||||
struct multiboot_tag_mmap
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t entry_size;
|
||||
multiboot_uint32_t entry_version;
|
||||
struct multiboot_mmap_entry entries[0];
|
||||
};
|
||||
|
||||
struct multiboot_vbe_info_block
|
||||
{
|
||||
multiboot_uint8_t external_specification[512];
|
||||
};
|
||||
|
||||
struct multiboot_vbe_mode_info_block
|
||||
{
|
||||
multiboot_uint8_t external_specification[256];
|
||||
};
|
||||
|
||||
struct multiboot_tag_vbe
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
|
||||
multiboot_uint16_t vbe_mode;
|
||||
multiboot_uint16_t vbe_interface_seg;
|
||||
multiboot_uint16_t vbe_interface_off;
|
||||
multiboot_uint16_t vbe_interface_len;
|
||||
|
||||
struct multiboot_vbe_info_block vbe_control_info;
|
||||
struct multiboot_vbe_mode_info_block vbe_mode_info;
|
||||
};
|
||||
|
||||
struct multiboot_tag_framebuffer_common
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
|
||||
multiboot_uint64_t framebuffer_addr;
|
||||
multiboot_uint32_t framebuffer_pitch;
|
||||
multiboot_uint32_t framebuffer_width;
|
||||
multiboot_uint32_t framebuffer_height;
|
||||
multiboot_uint8_t framebuffer_bpp;
|
||||
#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
|
||||
#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
|
||||
#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
|
||||
multiboot_uint8_t framebuffer_type;
|
||||
multiboot_uint16_t reserved;
|
||||
};
|
||||
|
||||
struct multiboot_tag_framebuffer
|
||||
{
|
||||
struct multiboot_tag_framebuffer_common common;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
multiboot_uint16_t framebuffer_palette_num_colors;
|
||||
struct multiboot_color framebuffer_palette[0];
|
||||
};
|
||||
struct
|
||||
{
|
||||
multiboot_uint8_t framebuffer_red_field_position;
|
||||
multiboot_uint8_t framebuffer_red_mask_size;
|
||||
multiboot_uint8_t framebuffer_green_field_position;
|
||||
multiboot_uint8_t framebuffer_green_mask_size;
|
||||
multiboot_uint8_t framebuffer_blue_field_position;
|
||||
multiboot_uint8_t framebuffer_blue_mask_size;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
struct multiboot_tag_elf_sections
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t num;
|
||||
multiboot_uint32_t entsize;
|
||||
multiboot_uint32_t shndx;
|
||||
char sections[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_apm
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint16_t version;
|
||||
multiboot_uint16_t cseg;
|
||||
multiboot_uint32_t offset;
|
||||
multiboot_uint16_t cseg_16;
|
||||
multiboot_uint16_t dseg;
|
||||
multiboot_uint16_t flags;
|
||||
multiboot_uint16_t cseg_len;
|
||||
multiboot_uint16_t cseg_16_len;
|
||||
multiboot_uint16_t dseg_len;
|
||||
};
|
||||
|
||||
struct multiboot_tag_efi32
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t pointer;
|
||||
};
|
||||
|
||||
struct multiboot_tag_efi64
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint64_t pointer;
|
||||
};
|
||||
|
||||
struct multiboot_tag_smbios
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint8_t major;
|
||||
multiboot_uint8_t minor;
|
||||
multiboot_uint8_t reserved[6];
|
||||
multiboot_uint8_t tables[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_old_acpi
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint8_t rsdp[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_new_acpi
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint8_t rsdp[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_network
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint8_t dhcpack[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_efi_mmap
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t descr_size;
|
||||
multiboot_uint32_t descr_vers;
|
||||
multiboot_uint8_t efi_mmap[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_efi32_ih
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t pointer;
|
||||
};
|
||||
|
||||
struct multiboot_tag_efi64_ih
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint64_t pointer;
|
||||
};
|
||||
|
||||
struct multiboot_tag_load_base_addr
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t load_base_addr;
|
||||
};
|
||||
|
||||
#endif /* !ASM_FILE */
|
||||
|
||||
#endif /* !__ARCH_X86_64_INCLUDE_MULTIBOOT2_H */
|
||||
@@ -0,0 +1,73 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/syscall.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through include/syscall.h or include/sys/sycall.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_SYSCALL_H
|
||||
#define __ARCH_X86_64_INCLUDE_SYSCALL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/* Include x86 architecture-specific syscall macros */
|
||||
|
||||
#ifdef CONFIG_ARCH_INTEL64
|
||||
# include <arch/intel64/syscall.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_SYSCALL_H */
|
||||
@@ -0,0 +1,50 @@
|
||||
/****************************************************************************
|
||||
* arch/x86_64/include/types.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through sys/types.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_X86_64_INCLUDE_TYPES_H
|
||||
#define __ARCH_X86_64_INCLUDE_TYPES_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/* Include architecture-specific limits */
|
||||
|
||||
#ifdef CONFIG_ARCH_INTEL64
|
||||
# include <arch/intel64/types.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_TYPES_H */
|
||||
Reference in New Issue
Block a user