Rev 285 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 285 | Rev 347 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | 36 | ||
37 | .code16 |
37 | .code16 |
38 | .section K_TEXT_START_2 |
38 | .section K_TEXT_START_2 |
39 | 39 | ||
40 | memmap_arch_init: |
40 | memmap_arch_init: |
41 | - | ||
42 | e820begin: |
41 | e820begin: |
43 | xorl %ebx,%ebx # during first call, ebx must be 0 |
42 | xorl %ebx,%ebx # during first call, ebx must be 0 |
44 | movw %bx,%ds |
- | |
45 | movw %bx,%es |
- | |
46 | movw $e820table_boot,%di |
43 | movw $e820table_boot,%di |
47 | movb $MEMMAP_E820_MAX_RECORDS,e820counter_boot |
44 | movb $MEMMAP_E820_MAX_RECORDS,e820counter_boot |
48 | e820loop: |
45 | e820loop: |
49 | movl $E820_SMAP,%edx # control sequence "SMAP" |
46 | movl $E820_SMAP,%edx # control sequence "SMAP" |
50 | 47 | ||
51 | movl $0x0000e820,%eax # service |
48 | movl $0x0000e820,%eax # service |
52 | movl $MEMMAP_E820_RECORD_SIZE,%ecx |
49 | movl $MEMMAP_E820_RECORD_SIZE,%ecx |
53 | int $0x15 |
50 | int $0x15 |
54 | jc e820err |
51 | jc e820err |
55 | 52 | ||
56 | cmpl $E820_SMAP,%eax # verifying BIOS |
53 | cmpl $E820_SMAP,%eax # verifying BIOS |
57 | jne e820err |
54 | jne e820err |
58 | 55 | ||
59 | cmpl $MEMMAP_E820_RECORD_SIZE,%ecx |
56 | cmpl $MEMMAP_E820_RECORD_SIZE,%ecx |
60 | jne e820err # bad record size - bug in bios |
57 | jne e820err # bad record size - bug in bios |
61 | 58 | ||
62 | movw %di,%ax # next record |
59 | movw %di,%ax # next record |
63 | addw $MEMMAP_E820_RECORD_SIZE,%ax |
60 | addw $MEMMAP_E820_RECORD_SIZE,%ax |
64 | movw %ax,%di |
61 | movw %ax,%di |
65 | 62 | ||
66 | decb e820counter_boot # buffer is full |
63 | decb e820counter_boot # buffer is full |
67 | jz e820end |
64 | jz e820end |
68 | 65 | ||
69 | cmpl $0,%ebx |
66 | testl %ebx,%ebx |
70 | jne e820loop |
67 | jnz e820loop |
71 | 68 | ||
72 | e820end: |
69 | e820end: |
73 | movb $MEMMAP_E820_MAX_RECORDS,%al |
70 | movb $MEMMAP_E820_MAX_RECORDS,%al |
74 | subb e820counter_boot,%al |
71 | subb e820counter_boot,%al |
75 | movb %al,e820counter_boot # store # of valid entries in e820counter |
72 | movb %al,e820counter_boot # store # of valid entries in e820counter |
76 | 73 | ||
77 | jmp e801begin |
74 | jmp e801begin |
78 | 75 | ||
79 | e820err: |
76 | e820err: |
80 | movb $0,e820counter_boot |
77 | movb $0,e820counter_boot |
Line 89... | Line 86... | ||
89 | stc |
86 | stc |
90 | int $0x15 |
87 | int $0x15 |
91 | 88 | ||
92 | jc e801end |
89 | jc e801end |
93 | 90 | ||
94 | # fix problem with some BIOSes which use ax:bx rather than cx:dx |
91 | # fix problem with some BIOSes which use ax:bx rather than cx:dx |
95 | testw %cx,%cx |
92 | testw %cx,%cx |
96 | jnz e801cxdx |
93 | jnz e801cxdx |
97 | testw %dx,%dx |
94 | testw %dx,%dx |
98 | jnz e801cxdx |
95 | jnz e801cxdx |
99 | 96 | ||
Line 103... | Line 100... | ||
103 | e801cxdx: |
100 | e801cxdx: |
104 | andl $0xffff,%edx |
101 | andl $0xffff,%edx |
105 | shll $6,%edx |
102 | shll $6,%edx |
106 | andl $0xffff,%ecx |
103 | andl $0xffff,%ecx |
107 | addl %ecx,%edx |
104 | addl %ecx,%edx |
108 | addl $0x0400,%edx # add lower 1 MB - it's not included by e801 method |
105 | addl $0x0400,%edx # add lower 1 MB - it's not included by e801 method |
109 | movl %edx,e801memorysize |
106 | movl %edx,e801memorysize |
110 | e801end: |
107 | e801end: |
111 | ret |
108 | ret |
112 | 109 | ||
- | 110 | ||
- | 111 | .section K_DATA_START |
|
- | 112 | ||
113 | #memory size in 1 kb chunks |
113 | #memory size in 1 kb chunks |
114 | e801memorysize: |
114 | e801memorysize: |
115 | .long 0 |
115 | .long 0 |
116 | - |