-
Notifications
You must be signed in to change notification settings - Fork 0
/
entry.S
55 lines (37 loc) · 904 Bytes
/
entry.S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// SYS86 project
// Main entry point
.code16
.text
.global entry
//------------------------------------------------------------------------------
entry:
// Setup data segment
// in tiny memory model
mov %cs,%ax
mov %ax,%ds
mov %ax,%es
// Temporary stack at end of data segment
// until first task switch and heap initialization
cli
mov %ax,%ss
xor %ax,%ax
mov %ax,%sp
sti
// Reset BSS section as required by GCC-IA16
// for zero or uninitialized global variables
mov $_bss_begin,%di
mov $_free_begin,%cx
sub %di,%cx
xor %al,%al
cld
// REP STOSB too long for HW watchdog
// so split instruction to allow interrupt
// and MON86 timer tick to quiet the dog
1: stosb
loop 1b
// Main C function
call main
// Unexpected return
1: hlt
jmp 1b
//------------------------------------------------------------------------------