blob: b9317cb34b22bc343173ea0291798923d1874bae [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
Simon Glassf226c412014-11-12 22:42:19 -070035#define PORT_RESET 0xcf9
36
Simon Glassbe36df62014-11-10 18:00:24 -070037static inline __attribute__((always_inline)) void cpu_hlt(void)
38{
39 asm("hlt");
40}
41
42static inline ulong cpu_get_sp(void)
43{
44 ulong result;
45
46 asm volatile(
47 "mov %%esp, %%eax"
48 : "=a" (result));
49 return result;
50}
51
52#endif /* __ASSEMBLY__ */
53
wdenk67ff36c2002-11-19 23:01:07 +000054#endif