1 /******************************************************************************
2 * Copyright (c) 2004, 2008 IBM Corporation
4 * This program and the accompanying materials
5 * are made available under the terms of the BSD License
6 * which accompanies this distribution, and is available at
7 * http://www.opensource.org/licenses/bsd-license.php
10 * IBM Corporation - initial implementation
11 *****************************************************************************/
15 /* the exception frame should be page aligned
16 * the_exception_frame is used by the handler to store a copy of all
17 * registers after an exception; this copy can then be used by paflof's
18 * exception handler to printout a register dump */
19 cell the_exception_frame[0x400 / CELLSIZE] __attribute__ ((aligned(PAGE_SIZE)));;
21 /* the_client_frame is the register save area when starting a client */
22 cell the_client_frame[0x1000 / CELLSIZE] __attribute__ ((aligned(0x100)));
23 cell the_client_stack[0x8000 / CELLSIZE] __attribute__ ((aligned(0x100)));
25 cell the_data_stack[0x2000 / CELLSIZE] __attribute__ ((aligned(0x100)));
26 /* the forth return stack */
27 cell the_return_stack[0x2000 / CELLSIZE] __attribute__ ((aligned(0x100)));
29 /* forth stack and return-stack pointers */
33 /* terminal input buffer */
34 cell the_tib[0x1000 / CELLSIZE] __attribute__ ((aligned(0x100)));
35 /* temporary string buffers */
36 char the_pockets[NUMPOCKETS * POCKETSIZE] __attribute__ ((aligned(0x100)));
38 cell the_comp_buffer[0x1000 / CELLSIZE] __attribute__ ((aligned(0x100)));
40 cell the_heap[HEAP_SIZE / CELLSIZE] __attribute__ ((aligned(0x1000)));
41 cell *the_heap_start = &the_heap[0];
42 cell *the_heap_end = &the_heap[HEAP_SIZE / CELLSIZE];
44 extern void io_putchar(unsigned char);
47 static unsigned long __attribute__((noinline))
48 call_c(cell arg0, cell arg1, cell arg2, cell entry)
50 register unsigned long r3 asm("r3") = arg0.u;
51 register unsigned long r4 asm("r4") = arg1.u;
52 register unsigned long r5 asm("r5") = arg2.u;
53 register unsigned long r6 = entry.u ;
55 asm volatile("mflr 31 ; mtctr %4 ; bctrl ; mtlr 31"
57 : "r" (r3), "r" (r4), "r" (r5), "r" (r6)
58 : "ctr", "r6", "r7", "r8", "r9", "r10", "r11",
59 "r12", "r13", "r31", "lr", "cc");
66 writeLogByte_wrapper(long x, long y)
71 result = writeLogByte(x, y);
79 * Standard write function for the libc.
81 * @param fd file descriptor (should always be 1 or 2)
82 * @param buf pointer to the array with the output characters
83 * @param count number of bytes to be written
84 * @return the number of bytes that have been written successfully
87 write(int fd, const void *buf, int count)
90 char *ptr = (char *)buf;
92 if (fd != 1 && fd != 2)
95 for (i = 0; i < count; i++) {
104 /* This should probably be temporary until a better solution is found */
106 asm_cout(long Character, long UART, long NVRAM __attribute__((unused)))
109 io_putchar(Character);