From ef4943053475cd8bf341c42dd0b538bc630b92a3 Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 6 Sep 2018 01:58:10 +0200 Subject: working on smp --- asm/asm_int.s | 49 +++++++++++++++++++++++++++---------------------- asm/asm_mp.asm | 6 +++++- asm/asm_x86.s | 6 +++--- 3 files changed, 35 insertions(+), 26 deletions(-) (limited to 'asm') diff --git a/asm/asm_int.s b/asm/asm_int.s index 566b646..94785bc 100644 --- a/asm/asm_int.s +++ b/asm/asm_int.s @@ -103,7 +103,7 @@ push \num // pass in this interrupt number push %eax // pass in original %esp (saved just few lines before) - call \func + call \func // call aligned mov %eax,%esp // use the %esp we got from c function pop %gs // pop everything back... @@ -125,8 +125,13 @@ .endm -.macro excx func - call \func +.macro excx num func + mov %esp,%eax // remember THIS stack position + and $-16,%esp // padding to align stack on 16byte boundary before CALL + sub $8,%esp // ... + push \num // pass in this interrupt number + push %eax // pass in original %esp (saved just few lines before) + call \func // call aligned jmp . .endm @@ -153,22 +158,22 @@ int129: intx ack0 $129 interrupt_handler int255: intx ack0 $255 interrupt_handler -exc0: excx exception_handle_0 -exc1: excx exception_handle_1 -exc2: excx exception_handle_2 -exc3: excx exception_handle_3 -exc4: excx exception_handle_4 -exc5: excx exception_handle_5 -exc6: excx exception_handle_6 -exc7: excx exception_handle_7 -exc8: excx exception_handle_8 -exc9: excx exception_handle_9 -exc10: excx exception_handle_10 -exc11: excx exception_handle_11 -exc12: excx exception_handle_12 -exc13: excx exception_handle_13 -exc14: excx exception_handle_14 -exc15: excx exception_handle_15 -exc16: excx exception_handle_16 -exc17: excx exception_handle_17 -exc18: excx exception_handle_18 +exc0: excx $0 exception_handle +exc1: excx $1 exception_handle +exc2: excx $2 exception_handle +exc3: excx $3 exception_handle +exc4: excx $4 exception_handle +exc5: excx $5 exception_handle +exc6: excx $6 exception_handle +exc7: excx $7 exception_handle +exc8: excx $8 exception_handle +exc9: excx $9 exception_handle +exc10: excx $10 exception_handle +exc11: excx $11 exception_handle +exc12: excx $12 exception_handle +exc13: excx $13 exception_handle +exc14: excx $14 exception_handle +exc15: excx $15 exception_handle +exc16: excx $16 exception_handle +exc17: excx $17 exception_handle +exc18: excx $18 exception_handle diff --git a/asm/asm_mp.asm b/asm/asm_mp.asm index c4eb4a9..a2dcee0 100644 --- a/asm/asm_mp.asm +++ b/asm/asm_mp.asm @@ -1,7 +1,8 @@ global smp_start +global LLOCK extern smp_main + ; master boot record for application processors -;[org 0x7000] smp_start: [bits 16] @@ -41,6 +42,9 @@ boot_32_pm: cmp eax,1 je boot_32_pm + mov ebp, 0x7000 + mov esp, ebp + call smp_main jmp $ ; should never be reached diff --git a/asm/asm_x86.s b/asm/asm_x86.s index 35052b1..3481ec2 100644 --- a/asm/asm_x86.s +++ b/asm/asm_x86.s @@ -123,9 +123,9 @@ set_cr4: ret x86_xchg: - mov 8(%esp), %eax // addr - mov 4(%esp), %edx // value - xchg %edx, (%eax) //LOCK protocol impemented anyway + mov 8(%esp), %eax // value + mov 4(%esp), %edx // addr + xchg %eax, (%edx) //LOCK protocol impemented anyway ret x86_invlpg: -- cgit v1.2.3