/*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2008 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _I386_POSTCODE_H_
#define _I386_POSTCODE_H_
-#ifndef DEBUG
-#include <debug.h>
-#endif
-
/* Define this to delay about 1 sec after posting each code */
-/* #define POSTCODE_DELAY 1 */
+//#define POSTCODE_DELAY 1
/* The POSTCODE is port 0x80 */
#define POSTPORT 0x80
* Macro to output byte value to postcode, destoying register al.
* Additionally, if POSTCODE_DELAY, spin for about a second.
*/
-
#if POSTCODE_DELAY
#define POSTCODE_AL \
outb %al,$(POSTPORT); \
CPU_PAUSE(); \
decl %eax; \
jne 1b
+#define POSTCODE_AX \
+ outw %ax,$(POSTPORT); \
+ movl $(SPINCOUNT), %eax; \
+1: \
+ CPU_PAUSE(); \
+ decl %eax; \
+ jne 1b
#else
#define POSTCODE_AL \
outb %al,$(POSTPORT)
+#define POSTCODE_AX \
+ outw %ax,$(POSTPORT)
#endif /* POSTCODE_DELAY */
#define POSTCODE(XX) \
mov $(XX), %al; \
POSTCODE_AL
+#define POSTCODE2(XXXX) \
+ mov $(XXXX), %ax; \
+ POSTCODE_AX
+
/* Output byte value to postcode, without destoying register eax */
#define POSTCODE_SAVE_EAX(XX) \
push %eax; \
#else /* DEBUG */
#define POSTCODE_AL
+#define POSTCODE_AX
#define POSTCODE(X)
+#define POSTCODE2(X)
+#define POSTCODE_SAVE_EAX(X)
#define POSTCODE32_EBX
#endif /* DEBUG */
#define _PSTART_RELOC 0xFE
#define PSTART_ENTRY 0xFD
#define PSTART_PAGE_TABLES 0xFC
+#if defined(__x86_64__)
+#define PSTART_BEFORE_ID_MAP 0xFB
+#else
#define PSTART_BEFORE_PAGING 0xFB
+#endif
#define VSTART_ENTRY 0xFA
#define VSTART_STACK_SWITCH 0xF9
-#define VSTART_EXIT 0xF8
-#define I386_INIT_ENTRY 0xF7
-#define CPU_INIT_D 0xF6
-#define PE_INIT_PLATFORM_D 0xF5
+#define VSTART_BEFORE_PAGING 0xF8
+#define VSTART_EXIT 0xF7
+#define I386_INIT_ENTRY 0xF6
+#define CPU_INIT_D 0xF5
+#define PE_INIT_PLATFORM_D 0xF4
#define SLAVE_RSTART_ENTRY 0xEF
#define SLAVE_REAL_TO_PROT_ENTRY 0xEE
#define SLAVE_STARTPROG_EXIT 0xEB
#define SLAVE_PSTART_ENTRY 0xEA
#define SLAVE_PSTART_EXIT 0xE9
+#if defined(__i386__)
#define SLAVE_VSTART_ENTRY 0xE8
#define SLAVE_VSTART_DESC_INIT 0xE7
#define SLAVE_VSTART_STACK_SWITCH 0xE6
#define SLAVE_VSTART_EXIT 0xE5
+#endif
#define I386_INIT_SLAVE 0xE4
#define PANIC_DOUBLE_FAULT 0xDF /* Double Fault exception */
{
asm volatile("outb %0, %1" : : "a" (xx), "N" (POSTPORT));
}
+inline static void
+_postcode2(uint16_t xxxx)
+{
+ asm volatile("outw %0, %1" : : "a" (xxxx), "N" (POSTPORT));
+}
#if DEBUG
inline static void
postcode(uint8_t xx)
_postcode_delay(SPINCOUNT);
#endif
}
+inline static void
+postcode2(uint8_t xxxx)
+{
+ _postcode2(xxxx);
+#if POSTCODE_DELAY
+ _postcode_delay(SPINCOUNT);
+#endif
+}
#else
-#define postcode(xx)
+#define postcode(xx) do {} while(0)
+#define postcode2(xxxx) do {} while(0)
#endif
#endif