FreeBSD/Linux Kernel Cross Reference
sys/sqt/_boot.s
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: _boot.s,v $
29 * Revision 2.3 91/05/14 17:39:49 mrt
30 * Correcting copyright
31 *
32 * Revision 2.2 91/05/08 12:50:41 dbg
33 * Created.
34 * [91/04/26 14:46:24 dbg]
35 *
36 * Revision 2.1.1.1 91/02/26 10:52:23 dbg
37 * Created.
38 * [91/02/26 dbg]
39 *
40 */
41
42 /*
43 * Sequent code to bootstrap from real to protected mode.
44 */
45 / at 0x20
46 .text
47 / segment 8: code
48 .long 0x0000ffff / length[0..15] = FFFF
49 / base[0..15] = 0
50 .long 0x00cf9a00 / base[16..23],base[24..31] = 0
51 / limit[16..19] = F
52 / G D
53 / pl = 0; code
54 .long 0x0000ffff
55 .long 0x00cf9200 / data
56 / at 0x30
57 .word 0x0017 / length (GDT) - 1
58 .long 0x00000018 / address of GDT
59 .word 0 / align to long boundary
60 .long 0,0,0 / filler
61 / at 0x44
62 / code / should be at address 0x44
63 boot: .byte 0x67 / use 32-bit addressing from real mode
64 .byte 0x66 / 32-bit data from real mode
65 lgdt 0x30 / load GDT
66 mov %cr0,%ebx / get CR0
67 orb $0x1,%bl / turn on protected-mode enable
68 mov %ebx,%cr0 / turn on protected mode
69 .byte 0xea / 16-bit long jump
70 .word 0x5b / to location 0x5b,
71 .word 0x08 / segment 8 (32-bit code)
72 / location 0x5b
73 movl $0x10,%ebx / get number for data segment
74 /// movw %bx,%ds / set up DS
75 .byte 0x8e,0xdb / (gas always generates Data16)
76 /// movw %bx,%ss / SS
77 .byte 0x8e,0xd3 / (gas always generates Data16)
78 /// movw %bx,%es / and ES
79 .byte 0x8e,0xc3 / (gas always generates Data16)
80 jmp *0x6c / jump to start of program
81 / location 0x6c
82 .long _pstart-0xC0000000
83 / physical address of pstart
84
85 / location 0x70
86 .fill 0x4000-0x70,1,0x0
87
Cache object: 6896aa3c12778d27da30faf2560ca070
|