Here attach the patch files.
About the sources, the gnumach apt sources are dated in 2018/02/18, so It
don't includes your latest fixes.
How can I download sources from git repository?
2018-06-19 2:26 GMT+02:00 Samuel Thibault <[email protected]>:
> Hello,
>
> Almudena Garcia, le lun. 18 juin 2018 21:16:28 +0200, a ecrit:
> > [1]http://dpaste.com/32VFE37
> >
> > [2]http://dpaste.com/1F3YETN
>
> Please post them as attached text files to your mail, so review can take
> place.
>
> > But my sources were downloaded from apt, so these are outdated.
>
> gnumach doesn't change that fast :)
>
> Samuel
>
diff -ruN gnumach-1.8+git20180218/i386/i386/cpu_number.h gnumach-1.8+git20180218~/i386/i386/cpu_number.h
--- gnumach-1.8+git20180218/i386/i386/cpu_number.h 2015-09-12 11:19:34.000000000 +0200
+++ gnumach-1.8+git20180218~/i386/i386/cpu_number.h 2018-06-17 02:36:41.000000000 +0200
@@ -33,7 +33,8 @@
#if NCPUS > 1
/* More-specific code must define cpu_number() and CPU_NUMBER. */
-#define CX(addr, reg) addr(,reg,4)
+#define CX(addr,reg) addr(,reg,4)
+#define CPU_NUMBER(reg)
#else /* NCPUS == 1 */
diff -ruN gnumach-1.8+git20180218/i386/i386/lock.h gnumach-1.8+git20180218~/i386/i386/lock.h
--- gnumach-1.8+git20180218/i386/i386/lock.h 2016-10-02 19:45:20.000000000 +0200
+++ gnumach-1.8+git20180218~/i386/i386/lock.h 2018-06-17 03:15:34.000000000 +0200
@@ -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 -ruN gnumach-1.8+git20180218/i386/intel/pmap.c gnumach-1.8+git20180218~/i386/intel/pmap.c
--- gnumach-1.8+git20180218/i386/intel/pmap.c 2018-01-28 15:35:43.000000000 +0100
+++ gnumach-1.8+git20180218~/i386/intel/pmap.c 2018-06-17 15:51:08.000000000 +0200
@@ -543,7 +543,7 @@
if (prot & VM_PROT_WRITE)
template |= INTEL_PTE_WRITE;
- PMAP_READ_LOCK(pmap, spl);
+ PMAP_READ_LOCK(pv_head_table->pmap, spl);
while (start < end) {
pte = pmap_pte(kernel_pmap, virt);
if (pte == PT_ENTRY_NULL)
@@ -572,7 +572,7 @@
if (n != i)
panic("couldn't pmap_map_bd\n");
#endif /* MACH_PV_PAGETABLES */
- PMAP_READ_UNLOCK(pmap, spl);
+ PMAP_READ_UNLOCK(pv_head_table->pmap, spl);
return(virt);
}
diff -ruN gnumach-1.8+git20180218/kern/cpu_number.h gnumach-1.8+git20180218~/kern/cpu_number.h
--- gnumach-1.8+git20180218/kern/cpu_number.h 2016-10-02 19:45:20.000000000 +0200
+++ gnumach-1.8+git20180218~/kern/cpu_number.h 2018-06-17 02:13:48.000000000 +0200
@@ -35,9 +35,41 @@
#if (NCPUS == 1)
/* cpu number is always 0 on a single processor system */
-#define cpu_number() (0)
+ #define cpu_number() (0)
+ #define CPU_L1_SIZE (1 << CPU_L1_SHIFT)
+
+#else
#define CPU_L1_SIZE (1 << CPU_L1_SHIFT)
+int apic2kernel[255];
+int cpu_number_start = 0, cpu_number_counter = 0;
+
+static int cpu_number(void) {
+ int eax = 1, ebx = 0, ecx = 0, edx = 0;
+ unsigned int i = 0;
+ int apic_id = 0;
+
+ if (!cpu_number_start) {
+ for (i = 0; i < 255; i++) {
+ apic2kernel[i] = -1;
+ }
+ cpu_number_start = 1;
+ }
+
+ asm("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (eax));
+ apic_id = (char) (ebx >> 24) & 0xff;
+ //printf("apic_id = %d\n", apic_id);
+
+ if (apic2kernel[apic_id] != -1) {
+ return apic2kernel[apic_id];
+ } else {
+ apic2kernel[apic_id] = cpu_number_counter;
+ cpu_number_counter++;
+ }
+
+ return apic2kernel[apic_id];
+}
+
#endif /* NCPUS == 1 */
#endif /* _KERN_CPU_NUMBER_H_ */
diff -ruN gnumach-1.8+git20180218/kern/machine.h gnumach-1.8+git20180218~/kern/machine.h
--- gnumach-1.8+git20180218/kern/machine.h 2016-10-02 19:45:20.000000000 +0200
+++ gnumach-1.8+git20180218~/kern/machine.h 2018-06-17 02:11:40.000000000 +0200
@@ -54,5 +54,6 @@
* action_thread() shuts down processors or changes their assignment.
*/
extern void action_thread_continue (void) __attribute__((noreturn));
+extern void action_thread (void)__attribute__((noreturn));
#endif /* _MACHINE_H_ */
diff -ruN gnumach-1.8+git20180218/kern/sched_prim.h gnumach-1.8+git20180218~/kern/sched_prim.h
--- gnumach-1.8+git20180218/kern/sched_prim.h 2017-06-10 01:26:02.000000000 +0200
+++ gnumach-1.8+git20180218~/kern/sched_prim.h 2018-06-17 02:22:27.000000000 +0200
@@ -185,4 +185,6 @@
extern void idle_thread(void) __attribute__((noreturn));
extern void sched_thread(void);
+extern void cause_ast_check(processor); /*new*/
+
#endif /* _KERN_SCHED_PRIM_H_ */
diff -ruN gnumach-1.8+git20180218/kern/thread.h gnumach-1.8+git20180218~/kern/thread.h
--- gnumach-1.8+git20180218/kern/thread.h 2016-10-02 19:45:20.000000000 +0200
+++ gnumach-1.8+git20180218~/kern/thread.h 2018-06-17 02:23:50.000000000 +0200
@@ -344,6 +344,9 @@
extern kern_return_t thread_assign_default(
thread_t thread);
extern void stack_collect(void);
+
+extern void cause_ast_check(processor); /*new*/
+
#endif
/*