From 3fed2f3264ebe6a1c7dd40a010c73c2882d2c6f5 Mon Sep 17 00:00:00 2001 From: Abel Romero PĂ©rez Date: Thu, 28 Jun 2018 01:34:03 -0400 Subject: uncomented needed macro; moved cpu_number() from cpu_number.h to cpu_number.c --- Makefrag.am | 1 + i386/i386/lock.h | 18 +++++++++--------- kern/cpu_number.c | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Makefrag.am b/Makefrag.am index 4625b487..8b855cb8 100644 --- a/Makefrag.am +++ b/Makefrag.am @@ -139,6 +139,7 @@ libkernel_a_SOURCES += \ kern/counters.c \ kern/counters.h \ kern/cpu_number.h \ + kern/cpu_number.c \ kern/debug.c \ kern/debug.h \ kern/eventcount.c \ diff --git a/i386/i386/lock.h b/i386/i386/lock.h index 29214538..35e2ea4c 100644 --- a/i386/i386/lock.h +++ b/i386/i386/lock.h @@ -43,15 +43,15 @@ * The code here depends on the GNU C compiler. */ -/*#define _simple_lock_xchg_(lock, new_val) \ - * ({ int _old_val_; \ - * asm volatile("xchgl %0, %2" \ - * : "=r" (_old_val_) \ - * : "0" (new_val), "m" (*(lock)) : "memory" \ - * ); \ - * _old_val_; \ - * }) -*/ +#define _simple_lock_xchg_(lock, new_val) \ + ({ int _old_val_; \ + asm volatile("xchgl %0, %2" \ + : "=r" (_old_val_) \ + : "0" (new_val), "m" (*(lock)) : "memory" \ + ); \ + _old_val_; \ + }) + #define simple_lock_init(l) \ ((l)->lock_data = 0) diff --git a/kern/cpu_number.c b/kern/cpu_number.c index 324ed752..0b2e2f1c 100644 --- a/kern/cpu_number.c +++ b/kern/cpu_number.c @@ -1,7 +1,7 @@ int apic2kernel[255]; int cpu_number_start = 0, cpu_number_counter = 0; -static int cpu_number(void) { +int cpu_number(void) { int eax = 1, ebx = 0, ecx = 0, edx = 0; unsigned int i = 0; int apic_id = 0; -- cgit v1.2.3