1 | /* _load_segments |
---|
2 | * |
---|
3 | * This file assists the board independent startup code by |
---|
4 | * loading the proper segment register values. The values |
---|
5 | * loaded are board dependent. |
---|
6 | * |
---|
7 | * NOTE: No stack has been established when this routine |
---|
8 | * is invoked. It returns by jumping back to bspentry. |
---|
9 | * |
---|
10 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * All rights assigned to U.S. Government, 1994. |
---|
13 | * |
---|
14 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
15 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
16 | * notice must appear in all copies of this file and its derivatives. |
---|
17 | * |
---|
18 | * $Id$ |
---|
19 | */ |
---|
20 | |
---|
21 | #include "asm.h" |
---|
22 | |
---|
23 | BEGIN_CODE |
---|
24 | |
---|
25 | /* |
---|
26 | * FORCEBUG loads us into a virtual address space which |
---|
27 | * really starts at PHYSICAL_ADDRESS_BASE. |
---|
28 | */ |
---|
29 | |
---|
30 | .set PHYSICAL_ADDRESS_BASE, 0x00002000 |
---|
31 | |
---|
32 | /* |
---|
33 | * At reset time, FORCEBUG normally has the segment selectors preloaded. |
---|
34 | * If a human resets the instruction pointer, this will not have occurred. |
---|
35 | * However, no guarantee can be made of the other registers if cs:ip was |
---|
36 | * modified to restart the program. Because of this, the BSP reloads all |
---|
37 | * segment registers (except cs) with the values they have following |
---|
38 | * a reset. |
---|
39 | */ |
---|
40 | |
---|
41 | |
---|
42 | .set RESET_SS, 0x40 # initial value of stack segment register |
---|
43 | .set RESET_DS, 0x40 # initial value of data segment register |
---|
44 | .set RESET_ES, 0x40 # initial value of extra segment register |
---|
45 | .set RESET_FS, 0x40 # initial value of "f" segment register |
---|
46 | .set RESET_GS, 0x30 # initial value of "g" segment register |
---|
47 | |
---|
48 | |
---|
49 | #define LOAD_SEGMENTS(_value,_segment) \ |
---|
50 | movw $ ## _value, ax ; \ |
---|
51 | movw _segment, ax |
---|
52 | |
---|
53 | EXTERN (establish_stack) |
---|
54 | |
---|
55 | PUBLIC (_load_segments) |
---|
56 | SYM (_load_segments): |
---|
57 | LOAD_SEGMENTS( RESET_SS, ss ) |
---|
58 | LOAD_SEGMENTS( RESET_DS, ds ) |
---|
59 | LOAD_SEGMENTS( RESET_ES, es ) |
---|
60 | LOAD_SEGMENTS( RESET_FS, fs ) |
---|
61 | LOAD_SEGMENTS( RESET_GS, gs ) |
---|
62 | |
---|
63 | jmp SYM (_establish_stack) # return to the bsp entry code |
---|
64 | |
---|
65 | PUBLIC (_return_to_monitor) |
---|
66 | SYM (_return_to_monitor): |
---|
67 | |
---|
68 | call SYM (Clock_exit) |
---|
69 | movb $0,al |
---|
70 | int $0x20 # restart FORCEbug |
---|
71 | jmp SYM (start) # FORCEbug does not reset PC |
---|
72 | |
---|
73 | END_CODE |
---|
74 | |
---|
75 | BEGIN_DATA |
---|
76 | |
---|
77 | PUBLIC (_Do_Load_IDT) |
---|
78 | SYM (_Do_Load_IDT): |
---|
79 | .byte 1 |
---|
80 | |
---|
81 | PUBLIC (_Do_Load_GDT) |
---|
82 | SYM (_Do_Load_GDT): |
---|
83 | .byte 0 |
---|
84 | |
---|
85 | END_DATA |
---|
86 | END |
---|