blob: b2854a978ab1903a38caa313e9ffeb61292530ee [file] [log] [blame]
wdenk67ff36c2002-11-19 23:01:07 +00001/*
2 * (C) Copyright 2002
Albert ARIBAUD60fbc8d2011-08-04 18:45:45 +02003 * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
wdenk57b2d802003-06-27 21:31:46 +00004 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenk67ff36c2002-11-19 23:01:07 +00006 */
7
8#ifndef __ASM_PROCESSOR_H_
9#define __ASM_PROCESSOR_H_ 1
Graeme Russ25391d12011-02-12 15:11:30 +110010
Graeme Russ391bb952011-12-31 10:24:36 +110011#define X86_GDT_ENTRY_SIZE 8
12
13#ifndef __ASSEMBLY__
14
15enum {
16 X86_GDT_ENTRY_NULL = 0,
17 X86_GDT_ENTRY_UNUSED,
18 X86_GDT_ENTRY_32BIT_CS,
19 X86_GDT_ENTRY_32BIT_DS,
Graeme Russ35368962011-12-31 22:58:15 +110020 X86_GDT_ENTRY_32BIT_FS,
Graeme Russ391bb952011-12-31 10:24:36 +110021 X86_GDT_ENTRY_16BIT_CS,
22 X86_GDT_ENTRY_16BIT_DS,
23 X86_GDT_NUM_ENTRIES
24};
25#else
26/* NOTE: If the above enum is modified, this define must be checked */
27#define X86_GDT_ENTRY_32BIT_DS 3
Graeme Russ007818a2012-11-27 15:38:36 +000028#define X86_GDT_NUM_ENTRIES 7
Graeme Russ391bb952011-12-31 10:24:36 +110029#endif
30
31#define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE)
Graeme Russ25391d12011-02-12 15:11:30 +110032
Simon Glassbe36df62014-11-10 18:00:24 -070033#ifndef __ASSEMBLY__
34
35static inline __attribute__((always_inline)) void cpu_hlt(void)
36{
37 asm("hlt");
38}
39
40static inline ulong cpu_get_sp(void)
41{
42 ulong result;
43
44 asm volatile(
45 "mov %%esp, %%eax"
46 : "=a" (result));
47 return result;
48}
49
50#endif /* __ASSEMBLY__ */
51
wdenk67ff36c2002-11-19 23:01:07 +000052#endif