summaryrefslogtreecommitdiff
path: root/i386/i386/cpuboot.S
diff options
context:
space:
mode:
authorAlmuHS <almuhs@github.com>2019-04-21 18:12:29 +0200
committerAlmuHS <almuhs@github.com>2019-04-21 18:12:29 +0200
commit5940f892c7ccdadf0707f8758eae299ea343b09e (patch)
tree9065e94a4b5c3d2fc5c41e018beee75826d0eadb /i386/i386/cpuboot.S
parent9e657666c2d82ab09a18c268cc4f1a64a87603c1 (diff)
recovered interrupt stack
Diffstat (limited to 'i386/i386/cpuboot.S')
-rw-r--r--i386/i386/cpuboot.S30
1 files changed, 29 insertions, 1 deletions
diff --git a/i386/i386/cpuboot.S b/i386/i386/cpuboot.S
index 876966fb..a39e59b2 100644
--- a/i386/i386/cpuboot.S
+++ b/i386/i386/cpuboot.S
@@ -32,7 +32,7 @@ boot_gdt:
/* boot DS = 8 . Data segment*/
.word 0xffff /*Segment limit */
.word (-KERNELBASE) & 0xffff /*Base first 0-15 bits*/
- .byte ((-KERNELBASE) >> 16) & 0xff
+ .byte ((-KERNELBASE) >> 16) & 0xff
.byte 0x92 /*Access byte*/
.byte 0xcf /* High 4 bits */
.byte ((-KERNELBASE) >> 24) & 0xff /*Base 24-31 bits */
@@ -96,10 +96,38 @@ _apboot:
movl stack_ptr, %esp
addl $STACK_SIZE, %esp
+ /* Switch to our own interrupt stack. */
+ movl $_intstack+INTSTACK_SIZE,%esp
+
/* Reset EFLAGS to a known state. */
pushl $0
popf
+ /* Clear uninitialized data. */
+ lea _edata,%edi
+ lea _end,%ecx
+ subl %edi,%ecx
+ xorl %eax,%eax
+ rep
+ stosb
+
+ /* Fix ifunc entries */
+ movl $__rel_iplt_start,%esi
+ movl $__rel_iplt_end,%edi
+
+iplt_cont:
+ cmpl %edi,%esi
+ jae iplt_done
+ movl (%esi),%ebx /* r_offset */
+ movb 4(%esi),%al /* info */
+ cmpb $42,%al /* IRELATIVE */
+ jnz iplt_next
+ call *(%ebx) /* call ifunc */
+ movl %eax,(%ebx) /* fixed address */
+iplt_next:
+ addl $8,%esi
+ jmp iplt_cont
+iplt_done:
pushl stack_ptr
call cpu_ap_main