diff options
author | Abel Romero Pérez <romeroperezabel@gmail.com> | 2018-06-28 01:34:03 -0400 |
---|---|---|
committer | Abel Romero Pérez <romeroperezabel@gmail.com> | 2018-06-28 01:34:03 -0400 |
commit | 3fed2f3264ebe6a1c7dd40a010c73c2882d2c6f5 (patch) | |
tree | b40da648aafa825a259e691126af37ec82733242 | |
parent | f9bc3d6248f5d3192bbe863db0468b6b5202caf1 (diff) |
uncomented needed macro; moved cpu_number() from cpu_number.h to cpu_number.c
-rw-r--r-- | Makefrag.am | 1 | ||||
-rw-r--r-- | i386/i386/lock.h | 18 | ||||
-rw-r--r-- | 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; |