Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
reenabled ASSEMBLER macro
  • Loading branch information
AlmuHS committed Feb 15, 2019
1 parent 64964b8 commit 342b7d6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
8 changes: 6 additions & 2 deletions i386/i386/cpu_number.h
Expand Up @@ -30,8 +30,6 @@
#ifndef _I386_CPU_NUMBER_H_
#define _I386_CPU_NUMBER_H_

#include <kern/cpu_number.h>

#if NCPUS > 1

/* More-specific code must define cpu_number() and CPU_NUMBER. */
Expand All @@ -44,4 +42,10 @@

#endif /* NCPUS == 1 */

#ifndef __ASSEMBLER__
#include "kern/cpu_number.h"
#else
#include <imps/cpu_number.h>
#endif

#endif /* _I386_CPU_NUMBER_H_ */
13 changes: 9 additions & 4 deletions i386/i386/cswitch.S
Expand Up @@ -28,18 +28,22 @@

#include <i386/proc_reg.h>
#include <i386/i386asm.h>
#include <i386/cpu_number.h>


#ifndef ASSEMBLER
#define ASSEMBLER
/*
* Context switch routines for i386.
*/

#include <i386/cpu_number.h>

ENTRY(Load_context)
movl S_ARG0,%ecx /* get thread */
movl TH_KERNEL_STACK(%ecx),%ecx /* get kernel stack */
lea KERNEL_STACK_SIZE-IKS_SIZE-IEL_SIZE(%ecx),%edx
/* point to stack top */
CPU_NUMBER(%eax)
CPU_NUMBER (%eax)
movl %ecx,CX(EXT(active_stacks),%eax) /* store stack address */
movl %edx,CX(EXT(kernel_stack),%eax) /* store stack top */

Expand All @@ -57,7 +61,7 @@ ENTRY(Load_context)
*/

ENTRY(Switch_context)
CPU_NUMBER(%edx)
CPU_NUMBER (%edx)
movl CX(EXT(active_stacks),%edx),%ecx /* get old kernel stack */

movl %ebx,KSS_EBX(%ecx) /* save registers */
Expand Down Expand Up @@ -109,7 +113,7 @@ ENTRY(Thread_continue)
* has no FPU state)
*/
ENTRY(switch_to_shutdown_context)
CPU_NUMBER(%edx)
CPU_NUMBER (%edx)
movl EXT(active_stacks)(,%edx,4),%ecx /* get old kernel stack */
movl %ebx,KSS_EBX(%ecx) /* save registers */
movl %ebp,KSS_EBP(%ecx)
Expand All @@ -136,3 +140,4 @@ ENTRY(switch_to_shutdown_context)
hlt /* (should never return) */

#endif /* NCPUS > 1 */
#endif
5 changes: 1 addition & 4 deletions imps/cpu_number.h
Expand Up @@ -39,12 +39,9 @@ cpu_number()
//#include "impsasm.h"

#define CPU_NUMBER(reg) \
movzbl APIC_LOCAL_VA+APIC_LOCAL_UNIT_ID+3,reg
movzbl APIC_LOCAL_VA+APIC_LOCAL_APIC_ID+3,reg

#endif


#include "i386/cpu_number.h"


#endif

0 comments on commit 342b7d6

Please sign in to comment.