Skip to contentSkip to conversation

Loading a 32 bit kernel from 64 bit grub-xen

DISCUSSION Phillip Susi 5 participants 17 messages Jul 1, 2014 – Jul 8, 2014

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTstxwAAoJEI5FoCIzSKrwTrkH/Ro3cvppQdn0vF0E5pJdsap7 I9ff+HZ+zhUVY+IBGtcQmfPMzeuQGfltHa+sjiFWwFKjhqTdUmbG6pJAvQLErOv0 q1/h8QUs6VAWXOCyn0veWD8tFOtoJ7LhAA3VYshTGLXclZbqoiKG233YHBPbT7j+ 0R8qMSLK7jPlYdvFbAAZn0DaXp1kYiulUEMioqtymLVHHR/0JdHn2KyqvuAPpjZU +xb4redG8ZV/B2Pe4locncgik0XGb9N7OVrg3wyXUsp3S077TT7kx9sLPkxfhqA+ bjgO0NQhFoy6ffQzYzvgiWnLBhjmxb0fegGMe3vx7MaYcihpB6mkfHwjzdz1cFs= =OqNA
-----END PGP SIGNATURE-----

#1 lore raw

Not possible without xen cooperation and xen has no hypercalls for this (main problem being page table layout)

Quoted 28 lines · Phillip Susi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTstxwAAoJEI5FoCIzSKrwTrkH/Ro3cvppQdn0vF0E5pJdsap7 I9ff+HZ+zhUVY+IBGtcQmfPMzeuQGfltHa+sjiFWwFKjhqTdUmbG6pJAvQLErOv0 q1/h8QUs6VAWXOCyn0veWD8tFOtoJ7LhAA3VYshTGLXclZbqoiKG233YHBPbT7j+ 0R8qMSLK7jPlYdvFbAAZn0DaXp1kYiulUEMioqtymLVHHR/0JdHn2KyqvuAPpjZU +xb4redG8ZV/B2Pe4locncgik0XGb9N7OVrg3wyXUsp3S077TT7kx9sLPkxfhqA+ bjgO0NQhFoy6ffQzYzvgiWnLBhjmxb0fegGMe3vx7MaYcihpB6mkfHwjzdz1cFs= =OqNA
-----END PGP SIGNATURE-----

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#2 lore raw
In reply to Phillip Susi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

В Tue, 01 Jul 2014 12:06:08 -0400
Phillip Susi <[email protected]> пишет:

Quoted 10 lines

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iEYEARECAAYFAlOy30YACgkQR6LMutpd94xm2ACfUl1BCFKgDzL3+E3d22imIrps BY8An26ImPakgGPBjQ+S5cZSS8I19zu5
=tEhO
-----END PGP SIGNATURE-----

#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 13 lines · Andrey Borzenkov

В Tue, 01 Jul 2014 12:06:08 -0400 Phillip Susi <[email protected]> пишет:

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

Quoted 5 lines

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?

The problem with that is that you have to know in advance which kernel you are going to boot. That makes configuring virtual hosts harder; they just want one grub image they can use to chainload whatever the guest wants to install in their domain.

Also there must be a way to do this otherwise a 64 bit kernel running under xen wouldn't be able to execute a 32 bit binary. I suppose I'll Cc xen-devel.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTsv2uAAoJEI5FoCIzSKrwvQQIAIZ/ipl4MRQcf2nhOBUFzEzM WTNx4ul/ZAtEDATMpokIpnhZuU1VDqzeOHbHZDXQfXZbYyhHM5LTKqiCLEGW0qnE Q+qW5Q9cKeXolx/hjZ4FrUU1fMHZ9tZ7dhb68iB1aGELZVtR7yXJFsl+4ZF6LPvN 5/w3g6WAd4fWpfEswL34EzaUW0RAfa0O4xmgHbQkkXftO1TLOoiswwGcW3xc9nai jr03H9NyOUTgZX89xhR/LAKuCMivs/FWARQ1UDMwy9KfY0IIoka94BfL36T4te01 HrYmiXtKoiaOZ0IyEhm5HY+X7bHBZU/eycQ3KdRG8aW694Y0zrCEEKhw0pJpbw0= =Vadi
-----END PGP SIGNATURE-----

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
In reply to Andrey Borzenkov

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 13 lines · Andrey Borzenkov

В Tue, 01 Jul 2014 12:06:08 -0400 Phillip Susi <[email protected]> пишет:

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

Quoted 5 lines

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?

The problem with that is that you have to know in advance which kernel you are going to boot. That makes configuring virtual hosts harder; they just want one grub image they can use to chainload whatever the guest wants to install in their domain.

Also there must be a way to do this otherwise a 64 bit kernel running under xen wouldn't be able to execute a 32 bit binary. I suppose I'll Cc xen-devel.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTsv2uAAoJEI5FoCIzSKrwvQQIAIZ/ipl4MRQcf2nhOBUFzEzM WTNx4ul/ZAtEDATMpokIpnhZuU1VDqzeOHbHZDXQfXZbYyhHM5LTKqiCLEGW0qnE Q+qW5Q9cKeXolx/hjZ4FrUU1fMHZ9tZ7dhb68iB1aGELZVtR7yXJFsl+4ZF6LPvN 5/w3g6WAd4fWpfEswL34EzaUW0RAfa0O4xmgHbQkkXftO1TLOoiswwGcW3xc9nai jr03H9NyOUTgZX89xhR/LAKuCMivs/FWARQ1UDMwy9KfY0IIoka94BfL36T4te01 HrYmiXtKoiaOZ0IyEhm5HY+X7bHBZU/eycQ3KdRG8aW694Y0zrCEEKhw0pJpbw0= =Vadi
-----END PGP SIGNATURE-----

#5 lore raw
Quoted 24 lines · Phillip Susi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 13 lines · Andrey Borzenkov

В Tue, 01 Jul 2014 12:06:08 -0400 Phillip Susi <[email protected]> пишет:

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

Quoted 5 lines

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?

Quoted 7 lines

The problem with that is that you have to know in advance which kernel you are going to boot. That makes configuring virtual hosts harder; they just want one grub image they can use to chainload whatever the guest wants to install in their domain.

Also there must be a way to do this otherwise a 64 bit kernel running under xen wouldn't be able to execute a 32 bit binary.

Binaries don't have to use e.g. paging table or hypercall mechanism. You need to either make xen switch all those structures or port kernels to fake-32-xen mode. When either is done GRUB part will be trivial but either of those tasks is outside of grub scope.

Quoted 16 lines

I suppose I'll
Cc xen-devel.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTsv2uAAoJEI5FoCIzSKrwvQQIAIZ/ipl4MRQcf2nhOBUFzEzM WTNx4ul/ZAtEDATMpokIpnhZuU1VDqzeOHbHZDXQfXZbYyhHM5LTKqiCLEGW0qnE Q+qW5Q9cKeXolx/hjZ4FrUU1fMHZ9tZ7dhb68iB1aGELZVtR7yXJFsl+4ZF6LPvN 5/w3g6WAd4fWpfEswL34EzaUW0RAfa0O4xmgHbQkkXftO1TLOoiswwGcW3xc9nai jr03H9NyOUTgZX89xhR/LAKuCMivs/FWARQ1UDMwy9KfY0IIoka94BfL36T4te01 HrYmiXtKoiaOZ0IyEhm5HY+X7bHBZU/eycQ3KdRG8aW694Y0zrCEEKhw0pJpbw0= =Vadi
-----END PGP SIGNATURE-----

Quoted 4 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw
In reply to Phillip Susi
Quoted 24 lines · Phillip Susi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 13 lines · Andrey Borzenkov

В Tue, 01 Jul 2014 12:06:08 -0400 Phillip Susi <[email protected]> пишет:

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

Quoted 5 lines

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?

Quoted 7 lines

The problem with that is that you have to know in advance which kernel you are going to boot. That makes configuring virtual hosts harder; they just want one grub image they can use to chainload whatever the guest wants to install in their domain.

Also there must be a way to do this otherwise a 64 bit kernel running under xen wouldn't be able to execute a 32 bit binary.

Binaries don't have to use e.g. paging table or hypercall mechanism. You need to either make xen switch all those structures or port kernels to fake-32-xen mode. When either is done GRUB part will be trivial but either of those tasks is outside of grub scope.

Quoted 20 lines

I suppose I'll
Cc xen-devel.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTsv2uAAoJEI5FoCIzSKrwvQQIAIZ/ipl4MRQcf2nhOBUFzEzM WTNx4ul/ZAtEDATMpokIpnhZuU1VDqzeOHbHZDXQfXZbYyhHM5LTKqiCLEGW0qnE Q+qW5Q9cKeXolx/hjZ4FrUU1fMHZ9tZ7dhb68iB1aGELZVtR7yXJFsl+4ZF6LPvN 5/w3g6WAd4fWpfEswL34EzaUW0RAfa0O4xmgHbQkkXftO1TLOoiswwGcW3xc9nai jr03H9NyOUTgZX89xhR/LAKuCMivs/FWARQ1UDMwy9KfY0IIoka94BfL36T4te01 HrYmiXtKoiaOZ0IyEhm5HY+X7bHBZU/eycQ3KdRG8aW694Y0zrCEEKhw0pJpbw0= =Vadi
-----END PGP SIGNATURE-----

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#7 lore raw
In reply to Phillip Susi
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 01.07.14 at 20:27, <[email protected]> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 13 lines · Andrey Borzenkov

В Tue, 01 Jul 2014 12:06:08 -0400 Phillip Susi <[email protected]> пишет:

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

Quoted 5 lines

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?

Quoted 8 lines

The problem with that is that you have to know in advance which kernel you are going to boot. That makes configuring virtual hosts harder; they just want one grub image they can use to chainload whatever the guest wants to install in their domain.

Also there must be a way to do this otherwise a 64 bit kernel running under xen wouldn't be able to execute a 32 bit binary. I suppose I'll Cc xen-devel.

Perhaps there's some confusion about what "kernel" here means:
The thing that's the kernel from GrUB's perspective is the hypervisor, i.e. xen.gz or xen.efi. While the former expects to be entered in 32-bit mode, on the Xen side we all agree that this isn't the way things should work under UEFI; Daniel already proposed how to handle this case (Xen should be entered in 64-bit mode, with ExitBootServices() not having got called yet).

The thing that you'd traditionally call kernel (e.g. Linux) can be 32- or 64-bit irrespective of GrUB's bitness: Xen knows how to load either (both for Dom0 and, likely irrelevant here, DomU).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#8 lore raw
In reply to Phillip Susi
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 01.07.14 at 20:27, <[email protected]> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 13 lines · Andrey Borzenkov

В Tue, 01 Jul 2014 12:06:08 -0400 Phillip Susi <[email protected]> пишет:

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

Quoted 5 lines

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?

Quoted 8 lines

The problem with that is that you have to know in advance which kernel you are going to boot. That makes configuring virtual hosts harder; they just want one grub image they can use to chainload whatever the guest wants to install in their domain.

Also there must be a way to do this otherwise a 64 bit kernel running under xen wouldn't be able to execute a 32 bit binary. I suppose I'll Cc xen-devel.

Perhaps there's some confusion about what "kernel" here means:
The thing that's the kernel from GrUB's perspective is the hypervisor, i.e. xen.gz or xen.efi. While the former expects to be entered in 32-bit mode, on the Xen side we all agree that this isn't the way things should work under UEFI; Daniel already proposed how to handle this case (Xen should be entered in 64-bit mode, with ExitBootServices() not having got called yet).

The thing that you'd traditionally call kernel (e.g. Linux) can be 32- or 64-bit irrespective of GrUB's bitness: Xen knows how to load either (both for Dom0 and, likely irrelevant here, DomU).

Jan

#9 lore raw
Quoted 42 lines · Jan Beulich
Quoted 25 lines
Quoted 2 lines
Quoted 2 lines · On 01.07.14 at 20:27, <[email protected]> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 13 lines · Andrey Borzenkov

В Tue, 01 Jul 2014 12:06:08 -0400 Phillip Susi <[email protected]> пишет:

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

Quoted 5 lines

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?

Quoted 8 lines

The problem with that is that you have to know in advance which kernel you are going to boot. That makes configuring virtual hosts harder; they just want one grub image they can use to chainload whatever the guest wants to install in their domain.

Also there must be a way to do this otherwise a 64 bit kernel running under xen wouldn't be able to execute a 32 bit binary. I suppose I'll Cc xen-devel.

Perhaps there's some confusion about what "kernel" here means:
The thing that's the kernel from GrUB's perspective is the hypervisor, i.e. xen.gz or xen.efi. While the former expects to be entered in 32-bit mode, on the Xen side we all agree that this isn't the way things should work under UEFI; Daniel already proposed how to handle this case (Xen should be entered in 64-bit mode, with ExitBootServices() not having got called yet).

Quoted 4 lines

The thing that you'd traditionally call kernel (e.g. Linux) can be 32- or 64-bit irrespective of GrUB's bitness: Xen knows how to load either (both for Dom0 and, likely irrelevant here, DomU).

Actually you're the first one to speak about dom0 here. Whole discussion was about domU.

Quoted 6 lines

Jan

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#10 lore raw
In reply to Jan Beulich
Quoted 41 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 01.07.14 at 20:27, <[email protected]> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 13 lines · Andrey Borzenkov

В Tue, 01 Jul 2014 12:06:08 -0400 Phillip Susi <[email protected]> пишет:

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

Quoted 5 lines

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?

Quoted 8 lines

The problem with that is that you have to know in advance which kernel you are going to boot. That makes configuring virtual hosts harder; they just want one grub image they can use to chainload whatever the guest wants to install in their domain.

Also there must be a way to do this otherwise a 64 bit kernel running under xen wouldn't be able to execute a 32 bit binary. I suppose I'll Cc xen-devel.

Perhaps there's some confusion about what "kernel" here means:
The thing that's the kernel from GrUB's perspective is the hypervisor, i.e. xen.gz or xen.efi. While the former expects to be entered in 32-bit mode, on the Xen side we all agree that this isn't the way things should work under UEFI; Daniel already proposed how to handle this case (Xen should be entered in 64-bit mode, with ExitBootServices() not having got called yet).

Quoted 3 lines

The thing that you'd traditionally call kernel (e.g. Linux) can be 32- or 64-bit irrespective of GrUB's bitness: Xen knows how to load either (both for Dom0 and, likely irrelevant here, DomU).

Actually, I read Philips message as refering to launching a domU kernel from a PV grub-xen, not a dom0 thing.

Ian

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#11 lore raw
In reply to Jan Beulich
Quoted 41 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 01.07.14 at 20:27, <[email protected]> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 13 lines · Andrey Borzenkov

В Tue, 01 Jul 2014 12:06:08 -0400 Phillip Susi <[email protected]> пишет:

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

Quoted 5 lines

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?

Quoted 8 lines

The problem with that is that you have to know in advance which kernel you are going to boot. That makes configuring virtual hosts harder; they just want one grub image they can use to chainload whatever the guest wants to install in their domain.

Also there must be a way to do this otherwise a 64 bit kernel running under xen wouldn't be able to execute a 32 bit binary. I suppose I'll Cc xen-devel.

Perhaps there's some confusion about what "kernel" here means:
The thing that's the kernel from GrUB's perspective is the hypervisor, i.e. xen.gz or xen.efi. While the former expects to be entered in 32-bit mode, on the Xen side we all agree that this isn't the way things should work under UEFI; Daniel already proposed how to handle this case (Xen should be entered in 64-bit mode, with ExitBootServices() not having got called yet).

Quoted 3 lines

The thing that you'd traditionally call kernel (e.g. Linux) can be 32- or 64-bit irrespective of GrUB's bitness: Xen knows how to load either (both for Dom0 and, likely irrelevant here, DomU).

Actually, I read Philips message as refering to launching a domU kernel from a PV grub-xen, not a dom0 thing.

Ian

#12 lore raw
In reply to Phillip Susi
Quoted 20 lines · Phillip Susi
Quoted 13 lines · Andrey Borzenkov

В Tue, 01 Jul 2014 12:06:08 -0400 Phillip Susi <[email protected]> пишет:

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

Quoted 5 lines

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?

Quoted 8 lines

The problem with that is that you have to know in advance which kernel you are going to boot. That makes configuring virtual hosts harder; they just want one grub image they can use to chainload whatever the guest wants to install in their domain.

Also there must be a way to do this otherwise a 64 bit kernel running under xen wouldn't be able to execute a 32 bit binary. I suppose I'll Cc xen-devel.

Running a 32-bit userspace under a 64-bit kernel is a very different thing to switching a kernel from 64-bit down to 32-bit (or vice versa).

While the former is of course supported just fine the latter is not and IIRC doing so would be very difficult for a PV kernel due to the way the interfaces are constructed (e.g. to p2m entries change size, the maximum addressable machine address changes).

Yes, this is a massive Pain In The A**.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#13 lore raw
In reply to Phillip Susi
Quoted 20 lines · Phillip Susi
Quoted 13 lines · Andrey Borzenkov

В Tue, 01 Jul 2014 12:06:08 -0400 Phillip Susi <[email protected]> пишет:

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

I have been trying to fix grub to load a 32 bit kernel from the 64 bit xen build. After fixing up one or two minor issues with the elf loader, I believe I now have it to the point where it jumps correctly to the 32 bit kernel and it crashes there, since it is 32 bit code still executing on a cpu in 64 bit mode. The question is how to return the cpu to 32 bit mode *under xen*?

Quoted 5 lines

IIRC it was already discussed not long ago and it seems to be Xen limitation. You probably need to ask on xen-devel to be sure.

Is it not more simple to use 32 bit grub with 32 bit kernel to start with?

Quoted 8 lines

The problem with that is that you have to know in advance which kernel you are going to boot. That makes configuring virtual hosts harder; they just want one grub image they can use to chainload whatever the guest wants to install in their domain.

Also there must be a way to do this otherwise a 64 bit kernel running under xen wouldn't be able to execute a 32 bit binary. I suppose I'll Cc xen-devel.

Running a 32-bit userspace under a 64-bit kernel is a very different thing to switching a kernel from 64-bit down to 32-bit (or vice versa).

While the former is of course supported just fine the latter is not and IIRC doing so would be very difficult for a PV kernel due to the way the interfaces are constructed (e.g. to p2m entries change size, the maximum addressable machine address changes).

Yes, this is a massive Pain In The A**.

Ian.

#14 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 7/2/2014 5:26 AM, Ian Campbell wrote:

So you are saying that you could put the cpu into 32 bit mode, but xen would still believe that the domU is 64 bit, and thus, expect the hypercalls to be 64 bit?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTvBA6AAoJEI5FoCIzSKrw9HEH/iNhIXDNtU7bUhUgNxFc9ONo QcV09XkMB7dFZF4YqzthssonpK0M9OJAaAbe4ie6uxYRAvnSP6SUou5rS5C0hEnX gXxQt2wr7uF7kK+OInTzcz7kUpFAFuAD1rLuYjfigZdKxP87K79gQJNEf+pPYseL b4nvTUoxqQd4h2tT9PjBg98jEhktw7abiO5DZXqJLRwfPEEsXPg1vw+QDHBbpDwi 5AJc0inxPRfvmKrgBpfkOTXpCRgQnXabNhQGH6tZGADgJSmU0k5Yi23qDD/fUe+Z sEP4L5nRUhzOHeWvdiAZB/K81v7QI0eRil+DwRuf75ntANhdoCbZ8tKdCVKiEx0= =4OA8
-----END PGP SIGNATURE-----

#15 lore raw
Quoted 3 lines · Phillip Susi

On 7/2/2014 5:26 AM, Ian Campbell wrote:

So you are saying

I don't know, because you've helpfully trimmed all of the context of something I said a week ago.

/me consults list archive, I think you are responding to:

Quoted 7 lines
Quoted 7 lines

Running a 32-bit userspace under a 64-bit kernel is a very different thing to switching a kernel from 64-bit down to 32-bit (or vice versa).

While the former is of course supported just fine the latter is not and IIRC doing so would be very difficult for a PV kernel due to the way the interfaces are constructed (e.g. to p2m entries change size, the maximum addressable machine address changes).

----

Quoted 3 lines

that you could put the cpu into 32 bit mode, but xen
would still believe that the domU is 64 bit, and thus, expect the hypercalls to be 64 bit?

Assuming you are asking about 32-bit kernel mode then a Xen PV 64-bit guest cannot be transitioned to run in kernel mode in anything other than 64-bit mode. There is simply no way to put the cpu into 32 bit mode while remaining in kernel mode.

If you meant in userspace then all userspace hypercalls are made via a kernel driver and thus appear to come from the 64-bit kernel and Xen sees them as such.

Ian.

#16 lore raw
In reply to Phillip Susi
Quoted 3 lines · Phillip Susi

On 7/2/2014 5:26 AM, Ian Campbell wrote:

So you are saying

I don't know, because you've helpfully trimmed all of the context of something I said a week ago.

/me consults list archive, I think you are responding to:

Quoted 7 lines
Quoted 7 lines

Running a 32-bit userspace under a 64-bit kernel is a very different thing to switching a kernel from 64-bit down to 32-bit (or vice versa).

While the former is of course supported just fine the latter is not and IIRC doing so would be very difficult for a PV kernel due to the way the interfaces are constructed (e.g. to p2m entries change size, the maximum addressable machine address changes).

----

Quoted 3 lines

that you could put the cpu into 32 bit mode, but xen
would still believe that the domU is 64 bit, and thus, expect the hypercalls to be 64 bit?

Assuming you are asking about 32-bit kernel mode then a Xen PV 64-bit guest cannot be transitioned to run in kernel mode in anything other than 64-bit mode. There is simply no way to put the cpu into 32 bit mode while remaining in kernel mode.

If you meant in userspace then all userspace hypercalls are made via a kernel driver and thus appear to come from the 64-bit kernel and Xen sees them as such.

Ian.