[EMAIL PROTECTED]: [PATCH] Fix for gnumach's LDT code]

2005-10-30 Thread Alfred M\. Szmidt
Ping?

--- Start of forwarded message ---
Date: Sun, 18 Sep 2005 15:27:46 +0200
From: Jeroen Dekkers <[EMAIL PROTECTED]>
To: bug-hurd@gnu.org
Subject: [PATCH] Fix for gnumach's LDT code

A few weeks ago I was working on getting TLS working on the
Hurd. Unfortunately, I don't have much time anymore to work further on
it, so I share the bugfixes I already have. The patch below fixes
gnumach's LDT code, so we can use the gs segment register for TLS.

The first part of the patch makes sure the fs and gs registers are
correct when entering kernel mode. This needs to be done because when
running in kernel mode we use the kernel LDT and the fs/gs registers
point to segment descriptors in the user LDT if we created our own
segments.

The second part of the patch makes sure we always copy the master LDT
from the kernel when there doesn't exist a modified LDT for the user
yet. If we don't do this, we don't have any segment descriptors for
the cs and ds segments when switching to the new LDT.

With this patch I didn't experience any gnumach crashes anymore when
working on TLS.

Jeroen Dekkers

2005-09-18  Jeroen Dekkers  <[EMAIL PROTECTED]>

* i386/i386/locore.S (trap_push_segs): Switch fs and gs to kernel
data segment too.
(syscall_entry_2): Likewise.
* i386/i386/user_ldt.c (i386_set_ldt): Always copy the master LDT
when there is no old user LDT.

Index: i386/i386/locore.S
===
RCS file: /cvsroot/hurd/gnumach/i386/i386/locore.S,v
retrieving revision 1.6.2.1
diff -u -p -r1.6.2.1 locore.S
- --- i386/i386/locore.S28 Nov 2004 17:29:35 -  1.6.2.1
+++ i386/i386/locore.S  30 Aug 2005 10:34:02 -
@@ -464,6 +464,8 @@ trap_push_segs:
mov %ss,%ax /* switch to kernel data segment */
mov %ax,%ds /* (same as kernel stack segment) */
mov %ax,%es
+   mov %ax,%fs
+   mov %ax,%gs
 
 trap_set_segs:
cld /* clear direction flag */
@@ -982,6 +984,8 @@ syscall_entry_2:
mov %ss,%dx /* switch to kernel data segment */
mov %dx,%ds
mov %dx,%es
+   mov %dx,%fs
+   mov %dx,%gs
 
 /*
  * Shuffle eflags,eip,cs into proper places
Index: i386/i386/user_ldt.c
===
RCS file: /cvsroot/hurd/gnumach/i386/i386/user_ldt.c,v
retrieving revision 1.2
diff -u -p -r1.2 user_ldt.c
- --- i386/i386/user_ldt.c  16 Sep 1999 02:17:48 -  1.2
+++ i386/i386/user_ldt.c30 Aug 2005 10:34:02 -
@@ -225,7 +225,7 @@ i386_set_ldt(thread, first_selector, des
  (char *)&new_ldt->ldt[0],
  old_ldt->desc.limit_low + 1);
}
- - else if (thread == current_thread()) {
+   else {
struct real_descriptor template = {0, 0, 0, ACC_P, 0, 0 ,0};
 
for (dp = &new_ldt->ldt[0], i = 0; i < first_desc; i++, dp++) {


___
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd
--- End of forwarded message ---


___
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd


Re: [PATCH] Building the Hurd with gcc-4.0

2005-10-30 Thread Alfred M\. Szmidt
I commited the following to ams-branch:

boot/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

* boot.c (boot_script_exec_cmd): Fix invalid lvalues.

nfsd/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

* loop.c (server_loop): Fix invalid lvalues.

pfinet/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

* glue-include/asm/system.h (xchg): Fix invalid lvalue.
* linux-src/net/ipv4/tcp_ipv4.c (tcp_v4_rst_req): Don't use ?: as a
lvalue.

ufs/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

* dir.h (DIRECT_NAMELEN): Don't use ?: as a lvalue.

ufs-utils/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

* mkfs.c (parse_opt): Move UP's functionality into UP_INT
in order to fix invalid lvalues.

utils/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

* ps.c (current_tty_name): Don't declare as `static'.
* rpctrace.c (print_contents): Don't use ?: as a lvalue.
(msgids_file_p): Don't declare as `static'.

I didn't commit the following:

libdiskfs/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

* priv.h: Include .


since it is already fixed in ams-branch.

Sorry for the delay...


___
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd


[EMAIL PROTECTED]: Re: gnumach and gcc 4.0 (patch 1)]

2005-10-30 Thread Alfred M\. Szmidt
Ping?

Roland, could I get free hands over gnumach-1-branch (I'll pipe any
`big' changes through the mailing list anyway, but obvious bug fixes
like this would be nice not to go through you)?

--- Start of forwarded message ---
Date: Mon, 26 Sep 2005 05:53:04 -0400
From: Thomas Schwinge <[EMAIL PROTECTED]>
To: bug-hurd@gnu.org
Subject: Re: gnumach and gcc 4.0 (patch 1)

On Sun, May 29, 2005 at 07:35:34PM -0400, Alfred M. Szmidt wrote:
> --- linux/src/drivers/net/ne2k-pci.c
> +++ linux/src/drivers/net/ne2k-pci.c
> @@ -542,7 +542,10 @@
>   if (count & 3) {
>   buf += count & ~3;
>   if (count & 2)
> - *((u16*)buf)++ = inw(NE_BASE + NE_DATAPORT);
> + {
> + *buf = *(u16 *) buf + 1;
> + *buf = inw(NE_BASE + NE_DATAPORT);
> + }
>   if (count & 1)
>   *buf = inb(NE_BASE + NE_DATAPORT);
>   }
> @@ -605,7 +608,8 @@
>   if (count & 3) {
>   buf += count & ~3;
>   if (count & 2)
> - outw(*((u16*)buf)++, NE_BASE + NE_DATAPORT);
> + outw(*buf++, NE_BASE + NE_DATAPORT);
> +
>   }
>  #else
>   outsw(NE_BASE + NE_DATAPORT, buf, count>>1);

This patch is wrong imo.
A patch to correct this on gnumach-1-branch follows:

2005-09-26  Thomas Schwinge  <[EMAIL PROTECTED]>

* linux/src/drivers/net/ne2k-pci.c (ne_block_input) and
(ne_block_output): Fix previous patch.

- --- old-gnumach-1-branch.1.ne2k-pci-fixes/linux/src/drivers/net/ne2k-pci.c
2005-09-26 11:48:05.433286440 +0200
+++ new-gnumach-1-branch.1.ne2k-pci-fixes/linux/src/drivers/net/ne2k-pci.c  
2005-09-26 11:48:05.439285528 +0200
@@ -541,11 +541,10 @@
insl(NE_BASE + NE_DATAPORT, buf, count>>2);
if (count & 3) {
buf += count & ~3;
- - if (count & 2)
- - {
- - *buf = *(u16 *) buf + 1;
- - *buf = inw(NE_BASE + NE_DATAPORT);
- - }
+   if (count & 2) {
+   *((u16 *) buf) = inw(NE_BASE + NE_DATAPORT);
+   buf = (char *) ((u16 *) buf + 1);
+   }
if (count & 1)
*buf = inb(NE_BASE + NE_DATAPORT);
}
@@ -607,8 +606,10 @@
outsl(NE_BASE + NE_DATAPORT, buf, count>>2);
if (count & 3) {
buf += count & ~3;
- - if (count & 2)
- - outw(*buf++, NE_BASE + NE_DATAPORT);
+   if (count & 2) {
+   outw(*((u16 *) buf), NE_BASE + NE_DATAPORT);
+   buf = (unsigned char *) ((u16 *) buf + 1);
+   }
 
}
 #else


Regards,
 Thomas


___
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd
--- End of forwarded message ---


___
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd


gnumach and gcc 4.x

2005-10-30 Thread Alfred M\. Szmidt
The following patch fixes the following problem (reported by Sergio):

| I'm having trouble with the GNU Mach of your tarball, it stalls with
| "panic: free_irq: bad irq number" just after the floppy disk
| detection.  I've tried it on a P3 1000 Mhz laptop, on a AMD 700 Mhz
| tower and on qemu with the same result in all cases (no IRQ sharing
| problem).

since (also from Sergio):

| The problem seems to be a little bug (MAXIRQ value is 16, while
| reg_IRQ array range is 0-15) in eata_dma and eata_pio scsi drivers
| triggered by using gcc-4.0. Please try the attached patch, it works
| for me.

Here is the patch (once again from Sergio):

2005-10-29  Alfred M. Szmidt  <[EMAIL PROTECTED]>

* linux/src/drivers/scsi/eata_pio.c (eata_pio_detect): Fix a
off-by-one error when probing.
* linux/src/drivers/scsi/eata_dma.c (eata_detect): Likewise.
* linux/dev/drivers/scsi/eata_dma.c (eata_detect): Likewise.
Patch by Sergio Lopez <[EMAIL PROTECTED]>.

--- linux/src/drivers/scsi/eata_dma.c
+++ linux/src/drivers/scsi/eata_dma.c
@@ -1532,7 +1532,7 @@
 
 find_ISA(&gc, tpnt);
 
-for (i = 0; i <= MAXIRQ; i++) { /* Now that we know what we have, we */
+for (i = 0; i < MAXIRQ; i++) {  /* Now that we know what we have, we */
if (reg_IRQ[i] >= 1){   /* exchange the interrupt handler which  */
free_irq(i, NULL);  /* we used for probing with the real one */
request_irq(i, (void *)(eata_int_handler), SA_INTERRUPT|SA_SHIRQ, 
--- linux/src/drivers/scsi/eata_pio.c
+++ linux/src/drivers/scsi/eata_pio.c
@@ -981,7 +981,7 @@
 
 find_pio_ISA(&gc, tpnt);
 
-for (i = 0; i <= MAXIRQ; i++)
+for (i = 0; i < MAXIRQ; i++)
if (reg_IRQ[i])
request_irq(i, eata_pio_int_handler, SA_INTERRUPT, "EATA-PIO", 
NULL);
 
--- linux/dev/drivers/scsi/eata_dma.c
+++ linux/dev/drivers/scsi/eata_dma.c
@@ -1536,7 +1536,7 @@
 
 find_ISA(&gc, tpnt);
 
-for (i = 0; i <= MAXIRQ; i++) { /* Now that we know what we have, we */
+for (i = 0; i < MAXIRQ; i++) {  /* Now that we know what we have, we */
if (reg_IRQ[i] >= 1){   /* exchange the interrupt handler which  */
free_irq(i, NULL);  /* we used for probing with the real one */
request_irq(i, (void *)(eata_int_handler), SA_INTERRUPT|SA_SHIRQ, 


___
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd