2002-11-19 23:01:07 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2002
|
2011-08-04 16:45:45 +00:00
|
|
|
* Daniel Engström, Omicron Ceti AB, daniel@omicron.se
|
2003-06-27 21:31:46 +00:00
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2002-11-19 23:01:07 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ASM_PROCESSOR_H_
|
|
|
|
#define __ASM_PROCESSOR_H_ 1
|
2011-02-12 04:11:30 +00:00
|
|
|
|
2014-11-15 03:56:29 +00:00
|
|
|
#define X86_GDT_ENTRY_SIZE 8
|
|
|
|
|
|
|
|
#define X86_GDT_ENTRY_NULL 0
|
|
|
|
#define X86_GDT_ENTRY_UNUSED 1
|
|
|
|
#define X86_GDT_ENTRY_32BIT_CS 2
|
|
|
|
#define X86_GDT_ENTRY_32BIT_DS 3
|
|
|
|
#define X86_GDT_ENTRY_32BIT_FS 4
|
|
|
|
#define X86_GDT_ENTRY_16BIT_CS 5
|
|
|
|
#define X86_GDT_ENTRY_16BIT_DS 6
|
|
|
|
#define X86_GDT_ENTRY_16BIT_FLAT_CS 7
|
|
|
|
#define X86_GDT_ENTRY_16BIT_FLAT_DS 8
|
|
|
|
#define X86_GDT_NUM_ENTRIES 9
|
2011-12-30 23:24:36 +00:00
|
|
|
|
|
|
|
#define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE)
|
2011-02-12 04:11:30 +00:00
|
|
|
|
2014-11-11 01:00:24 +00:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
2014-11-13 05:42:19 +00:00
|
|
|
#define PORT_RESET 0xcf9
|
|
|
|
|
2014-11-11 01:00:24 +00:00
|
|
|
static inline __attribute__((always_inline)) void cpu_hlt(void)
|
|
|
|
{
|
|
|
|
asm("hlt");
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline ulong cpu_get_sp(void)
|
|
|
|
{
|
|
|
|
ulong result;
|
|
|
|
|
|
|
|
asm volatile(
|
|
|
|
"mov %%esp, %%eax"
|
|
|
|
: "=a" (result));
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
|
2002-11-19 23:01:07 +00:00
|
|
|
#endif
|