metalsvm/arch/x86/include/asm/stddef.h
2011-04-04 18:12:08 +02:00

119 lines
3.1 KiB
C

/*
* Copyright 2010 Stefan Lankes, Chair for Operating Systems,
* RWTH Aachen University
*
* Licensed 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 is part of MetalSVM.
*/
/**
* @author Stefan Lankes
* @file arch/x86/include/asm/stddef.h
* @brief Standard datatypes
*
* This file contains typedefs for standard datatypes for numerical and character values.
*/
#ifndef __ARCH_STDDEF_H__
#define __ARCH_STDDEF_H__
#ifdef __cplusplus
extern "C" {
#endif
/// A popular type for addresses
typedef unsigned long size_t;
/// Pointer differences
typedef long ptrdiff_t;
#ifdef __KERNEL__
typedef long ssize_t;
typedef long off_t;
#endif
/// Unsigned 64 bit integer
typedef unsigned long long uint64_t;
/// Signed 64 bit integer
typedef long long int64_t;
/// Unsigned 32 bit integer
typedef unsigned int uint32_t;
/// Signed 32 bit integer
typedef int int32_t;
/// Unsigned 16 bit integer
typedef unsigned short uint16_t;
/// Signed 16 bit integer
typedef short int16_t;
/// Unsigned 8 bit integer (/char)
typedef unsigned char uint8_t;
/// Signed 8 bit integer (/char)
typedef char int8_t;
/// 16 bit wide char type
typedef unsigned short wchar_t;
#ifndef _WINT_T
#define _WINT_T
typedef unsigned int wint_t;
#endif
/** @brief This defines what the stack looks like after an ISR was called.
*
* All the interrupt handler routines use this type for their only parameter.
*/
struct state {
/*
* We switched from software- to hardwaree-based multitasking
* Therefore, we do not longer save the registers by hand.
*/
/*unsigned int gs, fs, es, ds; */ /* pushed the segs last */
/*
* Commented this out to write it out in a longer form for HTML-documentation
*/
//unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax; /* pushed by 'pusha' */
//unsigned int int_no, err_code; /* our 'push byte #' and ecodes do this */
/// EDI register
unsigned int edi;
/// ESI register
unsigned int esi;
/// EBP register
unsigned int ebp;
/// ESP register
unsigned int esp;
/// EBX register
unsigned int ebx;
/// EDX register
unsigned int edx;
/// ECX register
unsigned int ecx;
/// EAX register
unsigned int eax; /* pushed by 'pusha' */
/// Interrupt number
unsigned int int_no;
/// Error code
unsigned int err_code; /* our 'push byte #' and ecodes do this */
/*unsigned int eip, cs, eflags, useresp, ss;*/ /* pushed by the processor automatically */
};
/** @brief Read out APIC CPU ID
* @return The APIC CPU ID
*/
uint32_t apic_cpu_id(void);
/// Convenience-define constant
#define LOGICAL_CPUID apic_cpu_id()
#ifdef __cplusplus
}
#endif
#endif