ia64/xen-unstable
changeset 16720:d13c4d2836a8
Merge with ia64 tree.
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Tue Jan 15 14:39:23 2008 +0000 (2008-01-15) |
parents | 235bef53d5bd fba4e7357744 |
children | b953c358d0ad |
files |
line diff
1.1 --- a/tools/blktap/drivers/Makefile Tue Jan 15 07:07:01 2008 -0700 1.2 +++ b/tools/blktap/drivers/Makefile Tue Jan 15 14:39:23 2008 +0000 1.3 @@ -28,28 +28,29 @@ LIBS += -L$(XEN_XENSTORE) -lxenstor 1.4 1.5 AIOLIBS := $(LIBAIO_DIR)/libaio.a 1.6 1.7 -BLK-OBJS := block-aio.o 1.8 -BLK-OBJS += block-sync.o 1.9 -BLK-OBJS += block-vmdk.o 1.10 -BLK-OBJS += block-ram.o 1.11 -BLK-OBJS += block-qcow.o 1.12 -BLK-OBJS += aes.o 1.13 -BLK-OBJS += tapaio.o 1.14 +BLK-OBJS-y := block-aio.o 1.15 +BLK-OBJS-y += block-sync.o 1.16 +BLK-OBJS-y += block-vmdk.o 1.17 +BLK-OBJS-y += block-ram.o 1.18 +BLK-OBJS-y += block-qcow.o 1.19 +BLK-OBJS-y += aes.o 1.20 +BLK-OBJS-y += tapaio.o 1.21 +BLK-OBJS-$(CONFIG_Linux) += blk_linux.c 1.22 1.23 all: $(IBIN) qcow-util 1.24 1.25 blktapctrl: blktapctrl.c 1.26 $(CC) $(CFLAGS) -o blktapctrl $(LIBS) blktapctrl.c 1.27 1.28 -tapdisk: $(BLK-OBJS) tapdisk.c 1.29 - $(CC) $(CFLAGS) -o tapdisk $(BLK-OBJS) tapdisk.c \ 1.30 +tapdisk: $(BLK-OBJS-y) tapdisk.c 1.31 + $(CC) $(CFLAGS) -o tapdisk $(BLK-OBJS-y) tapdisk.c \ 1.32 $(AIOLIBS) $(LIBS) 1.33 1.34 .PHONY: qcow-util 1.35 qcow-util: img2qcow qcow2raw qcow-create 1.36 1.37 -img2qcow qcow2raw qcow-create: %: $(BLK-OBJS) 1.38 - $(CC) $(CFLAGS) -o $* $(BLK-OBJS) $*.c $(AIOLIBS) $(LIBS) 1.39 +img2qcow qcow2raw qcow-create: %: $(BLK-OBJS-y) 1.40 + $(CC) $(CFLAGS) -o $* $(BLK-OBJS-y) $*.c $(AIOLIBS) $(LIBS) 1.41 1.42 install: all 1.43 $(INSTALL_PROG) $(IBIN) $(QCOW_UTIL) $(VHD_UTIL) $(DESTDIR)$(INST_DIR)
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/tools/blktap/drivers/blk.h Tue Jan 15 14:39:23 2008 +0000 2.3 @@ -0,0 +1,3 @@ 2.4 + 2.5 +int blk_getimagesize(int fd, uint64_t *size); 2.6 +int blk_getsectorsize(int fd, uint64_t *sector_size);
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tools/blktap/drivers/blk_linux.c Tue Jan 15 14:39:23 2008 +0000 3.3 @@ -0,0 +1,42 @@ 3.4 +#include <inttypes.h> 3.5 +#include <sys/ioctl.h> 3.6 +#include <linux/fs.h> 3.7 +#include "tapdisk.h" 3.8 +#include "blk.h" 3.9 + 3.10 +int blk_getimagesize(int fd, uint64_t *size) 3.11 +{ 3.12 + int rc; 3.13 + 3.14 + *size = 0; 3.15 + rc = ioctl(fd, BLKGETSIZE, size); 3.16 + if (rc) { 3.17 + DPRINTF("ERR: BLKGETSIZE failed, couldn't stat image"); 3.18 + return -EINVAL; 3.19 + } 3.20 + 3.21 + return 0; 3.22 +} 3.23 + 3.24 +int blk_getsectorsize(int fd, uint64_t *sector_size) 3.25 +{ 3.26 +#if defined(BLKSSZGET) 3.27 + int rc; 3.28 + 3.29 + *sector_size = DEFAULT_SECTOR_SIZE; 3.30 + rc = ioctl(fd, BLKSSZGET, sector_size); 3.31 + if (rc) { 3.32 + DPRINTF("ERR: BLKSSZGET failed. Falling back to use default sector size"); 3.33 + *sector_size = DEFAULT_SECTOR_SIZE; 3.34 + } 3.35 + 3.36 + if (*sector_size != DEFAULT_SECTOR_SIZE) 3.37 + DPRINTF("Note: sector size is %"PRIu64" (not %u)\n", 3.38 + *sector_size, DEFAULT_SECTOR_SIZE); 3.39 +#else 3.40 + *sector_size = DEFAULT_SECTOR_SIZE; 3.41 +#endif 3.42 + 3.43 + return 0; 3.44 +} 3.45 +
4.1 --- a/tools/blktap/drivers/block-aio.c Tue Jan 15 07:07:01 2008 -0700 4.2 +++ b/tools/blktap/drivers/block-aio.c Tue Jan 15 14:39:23 2008 +0000 4.3 @@ -41,12 +41,17 @@ 4.4 #include <sys/statvfs.h> 4.5 #include <sys/stat.h> 4.6 #include <sys/ioctl.h> 4.7 -#include <linux/fs.h> 4.8 #include "tapdisk.h" 4.9 #include "tapaio.h" 4.10 +#include "blk.h" 4.11 4.12 #define MAX_AIO_REQS (MAX_REQUESTS * MAX_SEGMENTS_PER_REQ) 4.13 4.14 +/* *BSD has no O_LARGEFILE */ 4.15 +#ifndef O_LARGEFILE 4.16 +#define O_LARGEFILE 0 4.17 +#endif 4.18 + 4.19 struct pending_aio { 4.20 td_callback_t cb; 4.21 int id; 4.22 @@ -87,11 +92,8 @@ static int get_image_info(struct td_stat 4.23 4.24 if (S_ISBLK(stat.st_mode)) { 4.25 /*Accessing block device directly*/ 4.26 - s->size = 0; 4.27 - if (ioctl(fd,BLKGETSIZE,&s->size)!=0) { 4.28 - DPRINTF("ERR: BLKGETSIZE failed, couldn't stat image"); 4.29 + if (blk_getimagesize(fd, &s->size) != 0) 4.30 return -EINVAL; 4.31 - } 4.32 4.33 DPRINTF("Image size: \n\tpre sector_shift [%llu]\n\tpost " 4.34 "sector_shift [%llu]\n", 4.35 @@ -99,19 +101,8 @@ static int get_image_info(struct td_stat 4.36 (long long unsigned)s->size); 4.37 4.38 /*Get the sector size*/ 4.39 -#if defined(BLKSSZGET) 4.40 - { 4.41 - int arg; 4.42 + if (blk_getsectorsize(fd, &s->sector_size) != 0) 4.43 s->sector_size = DEFAULT_SECTOR_SIZE; 4.44 - ioctl(fd, BLKSSZGET, &s->sector_size); 4.45 - 4.46 - if (s->sector_size != DEFAULT_SECTOR_SIZE) 4.47 - DPRINTF("Note: sector size is %ld (not %d)\n", 4.48 - s->sector_size, DEFAULT_SECTOR_SIZE); 4.49 - } 4.50 -#else 4.51 - s->sector_size = DEFAULT_SECTOR_SIZE; 4.52 -#endif 4.53 4.54 } else { 4.55 /*Local file? try fstat instead*/
5.1 --- a/tools/blktap/drivers/block-qcow.c Tue Jan 15 07:07:01 2008 -0700 5.2 +++ b/tools/blktap/drivers/block-qcow.c Tue Jan 15 14:39:23 2008 +0000 5.3 @@ -29,7 +29,6 @@ 5.4 #include <sys/statvfs.h> 5.5 #include <sys/stat.h> 5.6 #include <sys/ioctl.h> 5.7 -#include <linux/fs.h> 5.8 #include <string.h> 5.9 #include <zlib.h> 5.10 #include <inttypes.h> 5.11 @@ -39,6 +38,12 @@ 5.12 #include "aes.h" 5.13 #include "tapdisk.h" 5.14 #include "tapaio.h" 5.15 +#include "blk.h" 5.16 + 5.17 +/* *BSD has no O_LARGEFILE */ 5.18 +#ifndef O_LARGEFILE 5.19 +#define O_LARGEFILE 0 5.20 +#endif 5.21 5.22 #if 1 5.23 #define ASSERT(_p) \ 5.24 @@ -284,8 +289,7 @@ static int get_filesize(char *filename, 5.25 fd = open(filename, O_RDONLY); 5.26 if (fd < 0) 5.27 return -1; 5.28 - if (ioctl(fd,BLKGETSIZE,size)!=0) { 5.29 - printf("Unable to get Block device size\n"); 5.30 + if (blk_getimagesize(fd, size) != 0) { 5.31 close(fd); 5.32 return -1; 5.33 } 5.34 @@ -990,8 +994,8 @@ int tdqcow_open (struct disk_driver *dd, 5.35 if (!final_cluster) 5.36 s->fd_end = s->l1_table_offset + l1_table_size; 5.37 else { 5.38 - s->fd_end = lseek64(fd, 0, SEEK_END); 5.39 - if (s->fd_end == (off64_t)-1) 5.40 + s->fd_end = lseek(fd, 0, SEEK_END); 5.41 + if (s->fd_end == (off_t)-1) 5.42 goto fail; 5.43 } 5.44 5.45 @@ -1230,7 +1234,7 @@ int qcow_create(const char *filename, ui 5.46 DPRINTF("Qcow_create: size %llu\n",(long long unsigned)total_size); 5.47 5.48 fd = open(filename, 5.49 - O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, 5.50 + O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, 5.51 0644); 5.52 if (fd < 0) 5.53 return -1;
6.1 --- a/tools/blktap/drivers/block-ram.c Tue Jan 15 07:07:01 2008 -0700 6.2 +++ b/tools/blktap/drivers/block-ram.c Tue Jan 15 14:39:23 2008 +0000 6.3 @@ -33,16 +33,22 @@ 6.4 #include <fcntl.h> 6.5 #include <stdio.h> 6.6 #include <stdlib.h> 6.7 +#include <inttypes.h> 6.8 #include <unistd.h> 6.9 #include <sys/statvfs.h> 6.10 #include <sys/stat.h> 6.11 #include <sys/ioctl.h> 6.12 -#include <linux/fs.h> 6.13 #include <string.h> 6.14 #include "tapdisk.h" 6.15 +#include "blk.h" 6.16 6.17 #define MAX_DISK_SIZE 1024000 /*500MB disk limit*/ 6.18 6.19 +/* *BSD has no O_LARGEFILE */ 6.20 +#ifndef O_LARGEFILE 6.21 +#define O_LARGEFILE 0 6.22 +#endif 6.23 + 6.24 char *img; 6.25 long int disksector_size; 6.26 long int disksize; 6.27 @@ -71,11 +77,8 @@ static int get_image_info(struct td_stat 6.28 6.29 if (S_ISBLK(stat.st_mode)) { 6.30 /*Accessing block device directly*/ 6.31 - s->size = 0; 6.32 - if (ioctl(fd,BLKGETSIZE,&s->size)!=0) { 6.33 - DPRINTF("ERR: BLKGETSIZE failed, couldn't stat image"); 6.34 + if (blk_getimagesize(fd, &s->size) != 0) 6.35 return -EINVAL; 6.36 - } 6.37 6.38 DPRINTF("Image size: \n\tpre sector_shift [%llu]\n\tpost " 6.39 "sector_shift [%llu]\n", 6.40 @@ -83,19 +86,8 @@ static int get_image_info(struct td_stat 6.41 (long long unsigned)s->size); 6.42 6.43 /*Get the sector size*/ 6.44 -#if defined(BLKSSZGET) 6.45 - { 6.46 - int arg; 6.47 + if (blk_getsectorsize(fd, &s->sector_size) != 0) 6.48 s->sector_size = DEFAULT_SECTOR_SIZE; 6.49 - ioctl(fd, BLKSSZGET, &s->sector_size); 6.50 - 6.51 - if (s->sector_size != DEFAULT_SECTOR_SIZE) 6.52 - DPRINTF("Note: sector size is %ld (not %d)\n", 6.53 - s->sector_size, DEFAULT_SECTOR_SIZE); 6.54 - } 6.55 -#else 6.56 - s->sector_size = DEFAULT_SECTOR_SIZE; 6.57 -#endif 6.58 6.59 } else { 6.60 /*Local file? try fstat instead*/ 6.61 @@ -117,7 +109,7 @@ static int get_image_info(struct td_stat 6.62 disksector_size = s->sector_size; 6.63 disksize = s->size; 6.64 diskinfo = s->info; 6.65 - DPRINTF("Image sector_size: \n\t[%lu]\n", 6.66 + DPRINTF("Image sector_size: \n\t[%"PRIu64"]\n", 6.67 s->sector_size); 6.68 6.69 return 0; 6.70 @@ -159,7 +151,7 @@ int tdram_open (struct disk_driver *dd, 6.71 "sector_shift [%llu]\n", 6.72 (long long unsigned)(s->size << SECTOR_SHIFT), 6.73 (long long unsigned)s->size); 6.74 - DPRINTF("Image sector_size: \n\t[%lu]\n", 6.75 + DPRINTF("Image sector_size: \n\t[%"PRIu64"]\n", 6.76 s->sector_size); 6.77 6.78 prv->fd = -1;
7.1 --- a/tools/blktap/drivers/block-sync.c Tue Jan 15 07:07:01 2008 -0700 7.2 +++ b/tools/blktap/drivers/block-sync.c Tue Jan 15 14:39:23 2008 +0000 7.3 @@ -37,8 +37,13 @@ 7.4 #include <sys/statvfs.h> 7.5 #include <sys/stat.h> 7.6 #include <sys/ioctl.h> 7.7 -#include <linux/fs.h> 7.8 #include "tapdisk.h" 7.9 +#include "blk.h" 7.10 + 7.11 +/* *BSD has no O_LARGEFILE */ 7.12 +#ifndef O_LARGEFILE 7.13 +#define O_LARGEFILE 0 7.14 +#endif 7.15 7.16 struct tdsync_state { 7.17 int fd; 7.18 @@ -62,11 +67,8 @@ static int get_image_info(struct td_stat 7.19 7.20 if (S_ISBLK(stat.st_mode)) { 7.21 /*Accessing block device directly*/ 7.22 - s->size = 0; 7.23 - if (ioctl(fd,BLKGETSIZE,&s->size)!=0) { 7.24 - DPRINTF("ERR: BLKGETSIZE failed, couldn't stat image"); 7.25 + if (blk_getimagesize(fd, &s->size) != 0) 7.26 return -EINVAL; 7.27 - } 7.28 7.29 DPRINTF("Image size: \n\tpre sector_shift [%llu]\n\tpost " 7.30 "sector_shift [%llu]\n", 7.31 @@ -74,19 +76,8 @@ static int get_image_info(struct td_stat 7.32 (long long unsigned)s->size); 7.33 7.34 /*Get the sector size*/ 7.35 -#if defined(BLKSSZGET) 7.36 - { 7.37 - int arg; 7.38 + if (blk_getsectorsize(fd, &s->sector_size) != 0) 7.39 s->sector_size = DEFAULT_SECTOR_SIZE; 7.40 - ioctl(fd, BLKSSZGET, &s->sector_size); 7.41 - 7.42 - if (s->sector_size != DEFAULT_SECTOR_SIZE) 7.43 - DPRINTF("Note: sector size is %ld (not %d)\n", 7.44 - s->sector_size, DEFAULT_SECTOR_SIZE); 7.45 - } 7.46 -#else 7.47 - s->sector_size = DEFAULT_SECTOR_SIZE; 7.48 -#endif 7.49 7.50 } else { 7.51 /*Local file? try fstat instead*/
8.1 --- a/tools/blktap/drivers/block-vmdk.c Tue Jan 15 07:07:01 2008 -0700 8.2 +++ b/tools/blktap/drivers/block-vmdk.c Tue Jan 15 14:39:23 2008 +0000 8.3 @@ -42,11 +42,15 @@ 8.4 #include <sys/statvfs.h> 8.5 #include <sys/stat.h> 8.6 #include <sys/ioctl.h> 8.7 -#include <linux/fs.h> 8.8 #include <string.h> 8.9 #include "tapdisk.h" 8.10 #include "bswap.h" 8.11 8.12 +/* *BSD has no O_LARGEFILE */ 8.13 +#ifndef O_LARGEFILE 8.14 +#define O_LARGEFILE 0 8.15 +#endif 8.16 + 8.17 #define safer_free(_x) \ 8.18 do { \ 8.19 if (NULL != _x) { \
9.1 --- a/tools/blktap/drivers/img2qcow.c Tue Jan 15 07:07:01 2008 -0700 9.2 +++ b/tools/blktap/drivers/img2qcow.c Tue Jan 15 14:39:23 2008 +0000 9.3 @@ -37,9 +37,9 @@ 9.4 #include <sys/statvfs.h> 9.5 #include <sys/stat.h> 9.6 #include <sys/ioctl.h> 9.7 -#include <linux/fs.h> 9.8 #include <string.h> 9.9 #include "tapdisk.h" 9.10 +#include "blk.h" 9.11 9.12 #if 1 9.13 #define DFPRINTF(_f, _a...) fprintf ( stderr, _f , ## _a ) 9.14 @@ -47,6 +47,12 @@ 9.15 #define DFPRINTF(_f, _a...) ((void)0) 9.16 #endif 9.17 9.18 +/* *BSD has no O_LARGEFILE */ 9.19 +#ifndef O_LARGEFILE 9.20 +#define O_LARGEFILE 0 9.21 +#endif 9.22 + 9.23 + 9.24 #define TAPDISK 1 9.25 #define BLOCK_PROCESSSZ 4096 9.26 9.27 @@ -109,12 +115,8 @@ static int get_image_info(struct td_stat 9.28 9.29 if (S_ISBLK(stat.st_mode)) { 9.30 /*Accessing block device directly*/ 9.31 - s->size = 0; 9.32 - if (ioctl(fd,BLKGETSIZE,&s->size)!=0) { 9.33 - DFPRINTF("ERR: BLKGETSIZE failed, " 9.34 - "couldn't stat image"); 9.35 + if (blk_getimagesize(fd, &s->size) != 0) 9.36 return -EINVAL; 9.37 - } 9.38 9.39 DFPRINTF("Image size: \n\tpre sector_shift [%llu]\n\tpost " 9.40 "sector_shift [%llu]\n", 9.41 @@ -122,19 +124,8 @@ static int get_image_info(struct td_stat 9.42 (long long unsigned)s->size); 9.43 9.44 /*Get the sector size*/ 9.45 -#if defined(BLKSSZGET) 9.46 - { 9.47 - int arg; 9.48 + if (blk_getsectorsize(fd, &s->sector_size) != 0) 9.49 s->sector_size = DEFAULT_SECTOR_SIZE; 9.50 - ioctl(fd, BLKSSZGET, &s->sector_size); 9.51 - 9.52 - if (s->sector_size != DEFAULT_SECTOR_SIZE) 9.53 - DFPRINTF("Note: sector size is %ld (not %d)\n", 9.54 - s->sector_size, DEFAULT_SECTOR_SIZE); 9.55 - } 9.56 -#else 9.57 - s->sector_size = DEFAULT_SECTOR_SIZE; 9.58 -#endif 9.59 9.60 } else { 9.61 /*Local file? try fstat instead*/
10.1 --- a/tools/blktap/drivers/qcow2raw.c Tue Jan 15 07:07:01 2008 -0700 10.2 +++ b/tools/blktap/drivers/qcow2raw.c Tue Jan 15 14:39:23 2008 +0000 10.3 @@ -33,13 +33,14 @@ 10.4 #include <fcntl.h> 10.5 #include <stdio.h> 10.6 #include <stdlib.h> 10.7 +#include <inttypes.h> 10.8 #include <unistd.h> 10.9 #include <sys/statvfs.h> 10.10 #include <sys/stat.h> 10.11 #include <sys/ioctl.h> 10.12 -#include <linux/fs.h> 10.13 #include <string.h> 10.14 #include "tapdisk.h" 10.15 +#include "blk.h" 10.16 10.17 #if 1 10.18 #define DFPRINTF(_f, _a...) fprintf ( stderr, _f , ## _a ) 10.19 @@ -47,6 +48,12 @@ 10.20 #define DFPRINTF(_f, _a...) ((void)0) 10.21 #endif 10.22 10.23 + 10.24 +/* *BSD has no O_LARGEFILE */ 10.25 +#ifndef O_LARGEFILE 10.26 +#define O_LARGEFILE 0 10.27 +#endif 10.28 + 10.29 #define TAPDISK 1 10.30 #define BLOCK_PROCESSSZ 4096 10.31 10.32 @@ -142,7 +149,7 @@ static int send_read_responses(struct di 10.33 int main(int argc, char *argv[]) 10.34 { 10.35 int ret = -1, fd, len,input; 10.36 - long int size; 10.37 + uint64_t size; 10.38 fd_set readfds; 10.39 struct timeval timeout; 10.40 uint64_t i; 10.41 @@ -227,16 +234,15 @@ int main(int argc, char *argv[]) 10.42 } 10.43 10.44 if (S_ISBLK(finfo.st_mode)) { 10.45 - if(ioctl(fd,BLKGETSIZE,&size)!=0) { 10.46 - DFPRINTF("ERROR: BLKGETSIZE failed, " 10.47 - "couldn't stat image [%s]\n", 10.48 - argv[1]); 10.49 + if (blk_getimagesize(fd, &size) != 0) { 10.50 close(fd); 10.51 - exit(-1); 10.52 + return -1; 10.53 } 10.54 + 10.55 if (size < ddqcow.td_state->size<<9) { 10.56 DFPRINTF("ERROR: Not enough space on device " 10.57 - "%s (%lu bytes available, %llu bytes required\n", 10.58 + "%s (%"PRIu64" bytes available, " 10.59 + "%llu bytes required\n", 10.60 argv[1], size, 10.61 (long long unsigned)ddqcow.td_state->size<<9); 10.62 close(fd);
11.1 --- a/tools/blktap/drivers/tapdisk.h Tue Jan 15 07:07:01 2008 -0700 11.2 +++ b/tools/blktap/drivers/tapdisk.h Tue Jan 15 14:39:23 2008 +0000 11.3 @@ -108,8 +108,8 @@ struct td_state { 11.4 void *image; 11.5 void *ring_info; 11.6 void *fd_entry; 11.7 - unsigned long sector_size; 11.8 - unsigned long long size; 11.9 + uint64_t sector_size; 11.10 + uint64_t size; 11.11 unsigned int info; 11.12 }; 11.13
12.1 --- a/tools/firmware/rombios/rombios.c Tue Jan 15 07:07:01 2008 -0700 12.2 +++ b/tools/firmware/rombios/rombios.c Tue Jan 15 14:39:23 2008 +0000 12.3 @@ -2031,6 +2031,229 @@ print_cdromboot_failure( code ) 12.4 return; 12.5 } 12.6 12.7 +#define WAIT_HZ 18 12.8 +/** 12.9 + * Check for keystroke. 12.10 + * @returns True if keystroke available, False if not. 12.11 + */ 12.12 +Bit8u check_for_keystroke() 12.13 +{ 12.14 +ASM_START 12.15 + mov ax, #0x100 12.16 + int #0x16 12.17 + jz no_key 12.18 + mov al, #1 12.19 + jmp done 12.20 +no_key: 12.21 + xor al, al 12.22 +done: 12.23 +ASM_END 12.24 +} 12.25 + 12.26 +/** 12.27 + * Get keystroke. 12.28 + * @returns BIOS scan code. 12.29 + */ 12.30 +Bit8u get_keystroke() 12.31 +{ 12.32 +ASM_START 12.33 + mov ax, #0x0 12.34 + int #0x16 12.35 + xchg ah, al 12.36 +ASM_END 12.37 +} 12.38 + 12.39 +/** 12.40 + * Waits (sleeps) for the given number of ticks. 12.41 + * Checks for keystroke. 12.42 + * 12.43 + * @returns BIOS scan code if available, 0 if not. 12.44 + * @param ticks Number of ticks to sleep. 12.45 + * @param stop_on_key Whether to stop immediately upon keypress. 12.46 + */ 12.47 +Bit8u wait(ticks, stop_on_key) 12.48 + Bit16u ticks; 12.49 + Bit8u stop_on_key; 12.50 +{ 12.51 + long ticks_to_wait, delta; 12.52 + Bit32u prev_ticks, t; 12.53 + Bit8u scan_code = 0; 12.54 + 12.55 + /* 12.56 + * The 0:046c wraps around at 'midnight' according to a 18.2Hz clock. 12.57 + * We also have to be careful about interrupt storms. 12.58 + */ 12.59 + ticks_to_wait = ticks; 12.60 + prev_ticks = read_dword(0x0, 0x46c); 12.61 + do 12.62 + { 12.63 + t = read_dword(0x0, 0x46c); 12.64 + if (t > prev_ticks) 12.65 + { 12.66 + delta = t - prev_ticks; /* The temp var is required or bcc screws up. */ 12.67 + ticks_to_wait -= delta; 12.68 + } 12.69 + else if (t < prev_ticks) 12.70 + ticks_to_wait -= t; /* wrapped */ 12.71 + prev_ticks = t; 12.72 + 12.73 + if (check_for_keystroke()) 12.74 + { 12.75 + scan_code = get_keystroke(); 12.76 + bios_printf(BIOS_PRINTF_DEBUG, "Key pressed: %x\n", scan_code); 12.77 + if (stop_on_key) 12.78 + return scan_code; 12.79 + } 12.80 + } while (ticks_to_wait > 0); 12.81 + return scan_code; 12.82 +} 12.83 + 12.84 +static void clearscreen() { 12.85 + /* Hide cursor, clear screen and move cursor to starting position */ 12.86 +ASM_START 12.87 + push bx 12.88 + push cx 12.89 + push dx 12.90 + 12.91 + mov ax, #0x100 12.92 + mov cx, #0x1000 12.93 + int #0x10 12.94 + 12.95 + mov ax, #0x700 12.96 + mov bh, #7 12.97 + xor cx, cx 12.98 + mov dx, #0x184f 12.99 + int #0x10 12.100 + 12.101 + mov ax, #0x200 12.102 + xor bx, bx 12.103 + xor dx, dx 12.104 + int #0x10 12.105 + 12.106 + pop dx 12.107 + pop cx 12.108 + pop bx 12.109 +ASM_END 12.110 +} 12.111 + 12.112 +int bootmenu(selected) 12.113 + int selected; 12.114 +{ 12.115 + Bit8u scode; 12.116 + int max; 12.117 + 12.118 + /* get the number of boot devices */ 12.119 + max = read_word(IPL_SEG, IPL_COUNT_OFFSET); 12.120 + 12.121 + for(;;) { 12.122 + if (selected > max || selected < 1) selected = 1; 12.123 + clearscreen(); 12.124 + bios_printf(BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO, "\n\n\n\n\n\n\n"); 12.125 + bios_printf(BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO, " Select boot device\n\n"); 12.126 + bios_printf(BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO, " 1. Floppy\n"); 12.127 + bios_printf(BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO, " 2. Hard drive\n"); 12.128 + bios_printf(BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO, " 3. CD-ROM\n"); 12.129 + if (max == 4) 12.130 + bios_printf(BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO, " 4. Network\n"); 12.131 + bios_printf(BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO, "\n\n Currently selected: %d\n", selected); 12.132 + 12.133 + do { 12.134 + scode = wait(WAIT_HZ, 1); 12.135 + } while (scode == 0); 12.136 + switch(scode) { 12.137 + case 0x02: 12.138 + case 0x03: 12.139 + case 0x04: 12.140 + selected = scode - 1; 12.141 + break; 12.142 + case 0x05: 12.143 + if (max == 4) 12.144 + selected = scode -1 ; 12.145 + else 12.146 + scode = 0; 12.147 + break; 12.148 + case 0x48: 12.149 + selected -= 1; 12.150 + if (selected < 1) 12.151 + selected = 1; 12.152 + scode = 0; 12.153 + break; 12.154 + case 0x50: 12.155 + selected += 1; 12.156 + if (selected > max) 12.157 + selected = max; 12.158 + scode = 0; 12.159 + break; 12.160 + case 0x1c: 12.161 + break; 12.162 + default: 12.163 + scode = 0; 12.164 + break; 12.165 + } 12.166 + if (scode != 0) 12.167 + break; 12.168 + } 12.169 + 12.170 + switch (selected) { 12.171 + case 1: 12.172 + return 0x3D; 12.173 + case 2: 12.174 + return 0x3E; 12.175 + case 3: 12.176 + return 0x3F; 12.177 + case 4: 12.178 + return 0x58; 12.179 + default: 12.180 + return 0; 12.181 + } 12.182 +} 12.183 + 12.184 +void interactive_bootkey() 12.185 +{ 12.186 + Bit16u i; 12.187 + Bit8u scan = 0; 12.188 + 12.189 + bios_printf(BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO, "\n\nPress F10 to select boot device.\n"); 12.190 + for (i = 3; i > 0; i--) 12.191 + { 12.192 + scan = wait(WAIT_HZ, 0); 12.193 + switch (scan) { 12.194 + case 0x3D: 12.195 + case 0x3E: 12.196 + case 0x3F: 12.197 + case 0x58: 12.198 + break; 12.199 + case 0x44: 12.200 + scan = bootmenu(inb_cmos(0x3d) & 0x0f); 12.201 + break; 12.202 + default: 12.203 + scan = 0; 12.204 + break; 12.205 + } 12.206 + if (scan != 0) 12.207 + break; 12.208 + } 12.209 + 12.210 + /* set the default based on the keypress or menu */ 12.211 + switch(scan) { 12.212 + case 0x3D: 12.213 + outb_cmos(0x3d, 0x01); 12.214 + break; 12.215 + case 0x3E: 12.216 + outb_cmos(0x3d, 0x02); 12.217 + break; 12.218 + case 0x3F: 12.219 + outb_cmos(0x3d, 0x03); 12.220 + break; 12.221 + case 0x58: 12.222 + outb_cmos(0x3d, 0x04); 12.223 + break; 12.224 + default: 12.225 + break; 12.226 + } 12.227 +} 12.228 + 12.229 + 12.230 void 12.231 nmi_handler_msg() 12.232 { 12.233 @@ -9825,7 +10048,9 @@ post_default_ints: 12.234 call _cdemu_init 12.235 ;; 12.236 #endif // BX_ELTORITO_BOOT 12.237 - 12.238 + 12.239 + call _interactive_bootkey 12.240 + 12.241 #if BX_TCGBIOS 12.242 call _tcpa_calling_int19h /* specs: 8.2.3 step 1 */ 12.243 call _tcpa_add_event_separators /* specs: 8.2.3 step 2 */
13.1 --- a/tools/python/xen/xend/XendNode.py Tue Jan 15 07:07:01 2008 -0700 13.2 +++ b/tools/python/xen/xend/XendNode.py Tue Jan 15 14:39:23 2008 +0000 13.3 @@ -377,13 +377,7 @@ class XendNode: 13.4 def xen_version(self): 13.5 info = self.xc.xeninfo() 13.6 13.7 - try: 13.8 - from xen import VERSION 13.9 - info = {'Xen': '%(xen_major)d.%(xen_minor)d' % info, 13.10 - 'Xend': VERSION} 13.11 - except (ImportError, AttributeError): 13.12 - info = {'Xen': '%(xen_major)d.%(xen_minor)d' % info, 13.13 - 'Xend': '3.0.3'} 13.14 + info = {'Xen': '%(xen_major)d.%(xen_minor)d' % info} 13.15 13.16 # Add xend_config_format 13.17 info.update(self.xendinfo_dict())
14.1 --- a/tools/python/xen/xend/server/SrvDaemon.py Tue Jan 15 07:07:01 2008 -0700 14.2 +++ b/tools/python/xen/xend/server/SrvDaemon.py Tue Jan 15 14:39:23 2008 +0000 14.3 @@ -335,12 +335,6 @@ class Daemon: 14.4 log.info("Xend changeset: %s.", xinfo['xen_changeset']) 14.5 del xc 14.6 14.7 - try: 14.8 - from xen import VERSION 14.9 - log.info("Xend version: %s", VERSION) 14.10 - except ImportError: 14.11 - log.info("Xend version: Unknown.") 14.12 - 14.13 relocate.listenRelocation() 14.14 servers = SrvServer.create() 14.15 servers.start(status)
15.1 --- a/xen/Makefile Tue Jan 15 07:07:01 2008 -0700 15.2 +++ b/xen/Makefile Tue Jan 15 14:39:23 2008 +0000 15.3 @@ -1,8 +1,8 @@ 15.4 # This is the correct place to edit the build version. 15.5 # All other places this is stored (eg. compile.h) should be autogenerated. 15.6 export XEN_VERSION = 3 15.7 -export XEN_SUBVERSION = 2 15.8 -export XEN_EXTRAVERSION ?= .0-rc6$(XEN_VENDORVERSION) 15.9 +export XEN_SUBVERSION = 3 15.10 +export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION) 15.11 export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION) 15.12 -include xen-version 15.13
16.1 --- a/xen/arch/x86/mm.c Tue Jan 15 07:07:01 2008 -0700 16.2 +++ b/xen/arch/x86/mm.c Tue Jan 15 14:39:23 2008 +0000 16.3 @@ -1342,21 +1342,30 @@ static inline int update_intpte(intpte_t 16.4 intpte_t old, 16.5 intpte_t new, 16.6 unsigned long mfn, 16.7 - struct vcpu *v) 16.8 + struct vcpu *v, 16.9 + int preserve_ad) 16.10 { 16.11 int rv = 1; 16.12 #ifndef PTE_UPDATE_WITH_CMPXCHG 16.13 - rv = paging_write_guest_entry(v, p, new, _mfn(mfn)); 16.14 -#else 16.15 + if ( !preserve_ad ) 16.16 + { 16.17 + rv = paging_write_guest_entry(v, p, new, _mfn(mfn)); 16.18 + } 16.19 + else 16.20 +#endif 16.21 { 16.22 intpte_t t = old; 16.23 for ( ; ; ) 16.24 { 16.25 - rv = paging_cmpxchg_guest_entry(v, p, &t, new, _mfn(mfn)); 16.26 + intpte_t _new = new; 16.27 + if ( preserve_ad ) 16.28 + _new |= old & (_PAGE_ACCESSED | _PAGE_DIRTY); 16.29 + 16.30 + rv = paging_cmpxchg_guest_entry(v, p, &t, _new, _mfn(mfn)); 16.31 if ( unlikely(rv == 0) ) 16.32 { 16.33 MEM_LOG("Failed to update %" PRIpte " -> %" PRIpte 16.34 - ": saw %" PRIpte, old, new, t); 16.35 + ": saw %" PRIpte, old, _new, t); 16.36 break; 16.37 } 16.38 16.39 @@ -1369,20 +1378,19 @@ static inline int update_intpte(intpte_t 16.40 old = t; 16.41 } 16.42 } 16.43 -#endif 16.44 return rv; 16.45 } 16.46 16.47 /* Macro that wraps the appropriate type-changes around update_intpte(). 16.48 * Arguments are: type, ptr, old, new, mfn, vcpu */ 16.49 -#define UPDATE_ENTRY(_t,_p,_o,_n,_m,_v) \ 16.50 +#define UPDATE_ENTRY(_t,_p,_o,_n,_m,_v,_ad) \ 16.51 update_intpte(&_t ## e_get_intpte(*(_p)), \ 16.52 _t ## e_get_intpte(_o), _t ## e_get_intpte(_n), \ 16.53 - (_m), (_v)) 16.54 + (_m), (_v), (_ad)) 16.55 16.56 /* Update the L1 entry at pl1e to new value nl1e. */ 16.57 static int mod_l1_entry(l1_pgentry_t *pl1e, l1_pgentry_t nl1e, 16.58 - unsigned long gl1mfn) 16.59 + unsigned long gl1mfn, int preserve_ad) 16.60 { 16.61 l1_pgentry_t ol1e; 16.62 struct vcpu *curr = current; 16.63 @@ -1393,7 +1401,7 @@ static int mod_l1_entry(l1_pgentry_t *pl 16.64 return 0; 16.65 16.66 if ( unlikely(paging_mode_refcounts(d)) ) 16.67 - return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr); 16.68 + return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr, preserve_ad); 16.69 16.70 if ( l1e_get_flags(nl1e) & _PAGE_PRESENT ) 16.71 { 16.72 @@ -1415,12 +1423,14 @@ static int mod_l1_entry(l1_pgentry_t *pl 16.73 16.74 /* Fast path for identical mapping, r/w and presence. */ 16.75 if ( !l1e_has_changed(ol1e, nl1e, _PAGE_RW | _PAGE_PRESENT) ) 16.76 - return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr); 16.77 + return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr, 16.78 + preserve_ad); 16.79 16.80 if ( unlikely(!get_page_from_l1e(nl1e, FOREIGNDOM)) ) 16.81 return 0; 16.82 16.83 - if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr)) ) 16.84 + if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr, 16.85 + preserve_ad)) ) 16.86 { 16.87 put_page_from_l1e(nl1e, d); 16.88 return 0; 16.89 @@ -1428,7 +1438,8 @@ static int mod_l1_entry(l1_pgentry_t *pl 16.90 } 16.91 else 16.92 { 16.93 - if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr)) ) 16.94 + if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr, 16.95 + preserve_ad)) ) 16.96 return 0; 16.97 } 16.98 16.99 @@ -1441,7 +1452,8 @@ static int mod_l1_entry(l1_pgentry_t *pl 16.100 static int mod_l2_entry(l2_pgentry_t *pl2e, 16.101 l2_pgentry_t nl2e, 16.102 unsigned long pfn, 16.103 - unsigned long type) 16.104 + unsigned long type, 16.105 + int preserve_ad) 16.106 { 16.107 l2_pgentry_t ol2e; 16.108 struct vcpu *curr = current; 16.109 @@ -1469,18 +1481,20 @@ static int mod_l2_entry(l2_pgentry_t *pl 16.110 16.111 /* Fast path for identical mapping and presence. */ 16.112 if ( !l2e_has_changed(ol2e, nl2e, _PAGE_PRESENT)) 16.113 - return UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr); 16.114 + return UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr, preserve_ad); 16.115 16.116 if ( unlikely(!get_page_from_l2e(nl2e, pfn, d)) ) 16.117 return 0; 16.118 16.119 - if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr)) ) 16.120 + if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr, 16.121 + preserve_ad)) ) 16.122 { 16.123 put_page_from_l2e(nl2e, pfn); 16.124 return 0; 16.125 } 16.126 } 16.127 - else if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr)) ) 16.128 + else if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr, 16.129 + preserve_ad)) ) 16.130 { 16.131 return 0; 16.132 } 16.133 @@ -1494,7 +1508,8 @@ static int mod_l2_entry(l2_pgentry_t *pl 16.134 /* Update the L3 entry at pl3e to new value nl3e. pl3e is within frame pfn. */ 16.135 static int mod_l3_entry(l3_pgentry_t *pl3e, 16.136 l3_pgentry_t nl3e, 16.137 - unsigned long pfn) 16.138 + unsigned long pfn, 16.139 + int preserve_ad) 16.140 { 16.141 l3_pgentry_t ol3e; 16.142 struct vcpu *curr = current; 16.143 @@ -1532,18 +1547,20 @@ static int mod_l3_entry(l3_pgentry_t *pl 16.144 16.145 /* Fast path for identical mapping and presence. */ 16.146 if (!l3e_has_changed(ol3e, nl3e, _PAGE_PRESENT)) 16.147 - return UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr); 16.148 + return UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr, preserve_ad); 16.149 16.150 if ( unlikely(!get_page_from_l3e(nl3e, pfn, d)) ) 16.151 return 0; 16.152 16.153 - if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr)) ) 16.154 + if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr, 16.155 + preserve_ad)) ) 16.156 { 16.157 put_page_from_l3e(nl3e, pfn); 16.158 return 0; 16.159 } 16.160 } 16.161 - else if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr)) ) 16.162 + else if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr, 16.163 + preserve_ad)) ) 16.164 { 16.165 return 0; 16.166 } 16.167 @@ -1564,7 +1581,8 @@ static int mod_l3_entry(l3_pgentry_t *pl 16.168 /* Update the L4 entry at pl4e to new value nl4e. pl4e is within frame pfn. */ 16.169 static int mod_l4_entry(l4_pgentry_t *pl4e, 16.170 l4_pgentry_t nl4e, 16.171 - unsigned long pfn) 16.172 + unsigned long pfn, 16.173 + int preserve_ad) 16.174 { 16.175 struct vcpu *curr = current; 16.176 struct domain *d = curr->domain; 16.177 @@ -1592,18 +1610,20 @@ static int mod_l4_entry(l4_pgentry_t *pl 16.178 16.179 /* Fast path for identical mapping and presence. */ 16.180 if (!l4e_has_changed(ol4e, nl4e, _PAGE_PRESENT)) 16.181 - return UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr); 16.182 + return UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr, preserve_ad); 16.183 16.184 if ( unlikely(!get_page_from_l4e(nl4e, pfn, d)) ) 16.185 return 0; 16.186 16.187 - if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr)) ) 16.188 + if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr, 16.189 + preserve_ad)) ) 16.190 { 16.191 put_page_from_l4e(nl4e, pfn); 16.192 return 0; 16.193 } 16.194 } 16.195 - else if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr)) ) 16.196 + else if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr, 16.197 + preserve_ad)) ) 16.198 { 16.199 return 0; 16.200 } 16.201 @@ -1946,7 +1966,7 @@ int new_guest_cr3(unsigned long mfn) 16.202 l4e_from_pfn( 16.203 mfn, 16.204 (_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED)), 16.205 - pagetable_get_pfn(v->arch.guest_table)); 16.206 + pagetable_get_pfn(v->arch.guest_table), 0); 16.207 if ( unlikely(!okay) ) 16.208 { 16.209 MEM_LOG("Error while installing new compat baseptr %lx", mfn); 16.210 @@ -2458,13 +2478,16 @@ int do_mmu_update( 16.211 { 16.212 /* 16.213 * MMU_NORMAL_PT_UPDATE: Normal update to any level of page table. 16.214 + * MMU_UPDATE_PT_PRESERVE_AD: As above but also preserve (OR) 16.215 + * current A/D bits. 16.216 */ 16.217 case MMU_NORMAL_PT_UPDATE: 16.218 - 16.219 + case MMU_PT_UPDATE_PRESERVE_AD: 16.220 rc = xsm_mmu_normal_update(d, req.val); 16.221 if ( rc ) 16.222 break; 16.223 16.224 + req.ptr -= cmd; 16.225 gmfn = req.ptr >> PAGE_SHIFT; 16.226 mfn = gmfn_to_mfn(d, gmfn); 16.227 16.228 @@ -2501,20 +2524,23 @@ int do_mmu_update( 16.229 case PGT_l1_page_table: 16.230 { 16.231 l1_pgentry_t l1e = l1e_from_intpte(req.val); 16.232 - okay = mod_l1_entry(va, l1e, mfn); 16.233 + okay = mod_l1_entry(va, l1e, mfn, 16.234 + cmd == MMU_PT_UPDATE_PRESERVE_AD); 16.235 } 16.236 break; 16.237 case PGT_l2_page_table: 16.238 { 16.239 l2_pgentry_t l2e = l2e_from_intpte(req.val); 16.240 - okay = mod_l2_entry(va, l2e, mfn, type_info); 16.241 + okay = mod_l2_entry(va, l2e, mfn, type_info, 16.242 + cmd == MMU_PT_UPDATE_PRESERVE_AD); 16.243 } 16.244 break; 16.245 #if CONFIG_PAGING_LEVELS >= 3 16.246 case PGT_l3_page_table: 16.247 { 16.248 l3_pgentry_t l3e = l3e_from_intpte(req.val); 16.249 - okay = mod_l3_entry(va, l3e, mfn); 16.250 + okay = mod_l3_entry(va, l3e, mfn, 16.251 + cmd == MMU_PT_UPDATE_PRESERVE_AD); 16.252 } 16.253 break; 16.254 #endif 16.255 @@ -2522,7 +2548,8 @@ int do_mmu_update( 16.256 case PGT_l4_page_table: 16.257 { 16.258 l4_pgentry_t l4e = l4e_from_intpte(req.val); 16.259 - okay = mod_l4_entry(va, l4e, mfn); 16.260 + okay = mod_l4_entry(va, l4e, mfn, 16.261 + cmd == MMU_PT_UPDATE_PRESERVE_AD); 16.262 } 16.263 break; 16.264 #endif 16.265 @@ -2652,7 +2679,7 @@ static int create_grant_pte_mapping( 16.266 } 16.267 16.268 ol1e = *(l1_pgentry_t *)va; 16.269 - if ( !UPDATE_ENTRY(l1, (l1_pgentry_t *)va, ol1e, nl1e, mfn, v) ) 16.270 + if ( !UPDATE_ENTRY(l1, (l1_pgentry_t *)va, ol1e, nl1e, mfn, v, 0) ) 16.271 { 16.272 put_page_type(page); 16.273 rc = GNTST_general_error; 16.274 @@ -2720,9 +2747,11 @@ static int destroy_grant_pte_mapping( 16.275 } 16.276 16.277 /* Delete pagetable entry. */ 16.278 - if ( unlikely(!UPDATE_ENTRY(l1, 16.279 - (l1_pgentry_t *)va, ol1e, l1e_empty(), mfn, 16.280 - d->vcpu[0] /* Change if we go to per-vcpu shadows. */)) ) 16.281 + if ( unlikely(!UPDATE_ENTRY 16.282 + (l1, 16.283 + (l1_pgentry_t *)va, ol1e, l1e_empty(), mfn, 16.284 + d->vcpu[0] /* Change if we go to per-vcpu shadows. */, 16.285 + 0)) ) 16.286 { 16.287 MEM_LOG("Cannot delete PTE entry at %p", va); 16.288 put_page_type(page); 16.289 @@ -2758,7 +2787,7 @@ static int create_grant_va_mapping( 16.290 return GNTST_general_error; 16.291 } 16.292 ol1e = *pl1e; 16.293 - okay = UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, v); 16.294 + okay = UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, v, 0); 16.295 guest_unmap_l1e(v, pl1e); 16.296 pl1e = NULL; 16.297 16.298 @@ -2796,7 +2825,7 @@ static int replace_grant_va_mapping( 16.299 } 16.300 16.301 /* Delete pagetable entry. */ 16.302 - if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, v)) ) 16.303 + if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, v, 0)) ) 16.304 { 16.305 MEM_LOG("Cannot delete PTE entry at %p", (unsigned long *)pl1e); 16.306 rc = GNTST_general_error; 16.307 @@ -2860,7 +2889,8 @@ int replace_grant_host_mapping( 16.308 } 16.309 ol1e = *pl1e; 16.310 16.311 - if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, l1e_empty(), gl1mfn, curr)) ) 16.312 + if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, l1e_empty(), 16.313 + gl1mfn, curr, 0)) ) 16.314 { 16.315 MEM_LOG("Cannot delete PTE entry at %p", (unsigned long *)pl1e); 16.316 guest_unmap_l1e(curr, pl1e); 16.317 @@ -2948,7 +2978,7 @@ int do_update_va_mapping(unsigned long v 16.318 16.319 pl1e = guest_map_l1e(v, va, &gl1mfn); 16.320 16.321 - if ( unlikely(!pl1e || !mod_l1_entry(pl1e, val, gl1mfn)) ) 16.322 + if ( unlikely(!pl1e || !mod_l1_entry(pl1e, val, gl1mfn, 0)) ) 16.323 rc = -EINVAL; 16.324 16.325 if ( pl1e ) 16.326 @@ -3517,7 +3547,7 @@ static int ptwr_emulated_update( 16.327 else 16.328 { 16.329 ol1e = *pl1e; 16.330 - if ( !UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, mfn, v) ) 16.331 + if ( !UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, mfn, v, 0) ) 16.332 BUG(); 16.333 } 16.334
17.1 --- a/xen/include/public/xen.h Tue Jan 15 07:07:01 2008 -0700 17.2 +++ b/xen/include/public/xen.h Tue Jan 15 14:39:23 2008 +0000 17.3 @@ -168,9 +168,14 @@ 17.4 * ptr[:2] -- Machine address within the frame whose mapping to modify. 17.5 * The frame must belong to the FD, if one is specified. 17.6 * val -- Value to write into the mapping entry. 17.7 + * 17.8 + * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD: 17.9 + * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed 17.10 + * with those in @val. 17.11 */ 17.12 -#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */ 17.13 -#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */ 17.14 +#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */ 17.15 +#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */ 17.16 +#define MMU_PT_UPDATE_PRESERVE_AD 2 /* atomically: *ptr = val | (*ptr&(A|D)) */ 17.17 17.18 /* 17.19 * MMU EXTENDED OPERATIONS