📄 xsupport.c
字号:
/* * Copyright (C) 1996-1998 by the Board of Trustees * of Leland Stanford Junior University. * * This file is part of the SimOS distribution. * See LICENSE file for terms of the license. * *//**************************************************************** * $File$ * * $Author: bosch $ * $Date: 1998/02/10 00:28:49 $ *****************************************************************/#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/types.h>#include <sys/mman.h>#include "xsupport.h"#include "checkpoint.h"#include "startup.h"#include "sim.h"#include "simutil.h"static int framebuf_fd, eventq_fd;static CptCallback FrameCheckpointCB;static CptCallback EventQCheckpointCB;static int FrameCheckpointCB(CptDescriptor *cptd);static int EventQCheckpointCB(CptDescriptor *cptd);/***************************************************************** * This is added for supporting an X-windows session on top of * simos. The event queue needs a little bit of work. *****************************************************************/voidInitXSupport(int restoringCpt){ char *addr; int framebuf_fd; Simcpt_Register("framebuffer", FrameCheckpointCB, ALL_CPUS); Simcpt_Register("eventqueue", EventQCheckpointCB, ALL_CPUS); /* * Create a region to store the frame buffer */ framebuf_fd = open("frame.simos", O_RDWR | O_CREAT, 0700); if (framebuf_fd < 0) { perror("Opening frame.simos"); Sim_Error("Simprom_start can't start"); } addr = (char *)mmap((char *)SIMFRAMEBUFFER, SIMFRAMEBUFFER_SZ, PROT_WRITE, MAP_SHARED, framebuf_fd, 0); if (addr != (char *)SIMFRAMEBUFFER) { perror("mapping frame buffer"); Sim_Error("Can't map frame buffer"); } if (restoringCpt) { Simcpt_Restore("framebuffer"); } else { bzero((char *)SIMFRAMEBUFFER, SIMFRAMEBUFFER_SZ); } close(framebuf_fd); /* * Create a region to store the input event queue to the simulated x server */ eventq_fd = open("event.simos", O_RDWR | O_CREAT, 0777); if (eventq_fd < 0) { perror("Opening event.simos"); Sim_Error("Simprom_start can't start"); } addr = (char *)mmap((char *)SIMEVENTQ, SIMEVENTQ_SZ, PROT_WRITE, MAP_SHARED, eventq_fd, 0); if (addr != (char *) SIMEVENTQ) { perror("mapping event queue"); Sim_Error("Can't map event queue"); } if (restoringCpt) { Simcpt_Restore("eventqueue"); } bzero((char *)SIMEVENTQ, SIMEVENTQ_SZ); close(eventq_fd);}static int FrameCheckpointCB(CptDescriptor *cptd){ Simcpt_CptBlock(cptd, "framebuffer", NO_INDEX, NO_INDEX, (caddr_t)SIMFRAMEBUFFER, SIMFRAMEBUFFER_SZ, framebuf_fd); return 0;}static int EventQCheckpointCB(CptDescriptor *cptd){ Simcpt_CptBlock(cptd, "eventqueue", NO_INDEX, NO_INDEX, (caddr_t)SIMEVENTQ, SIMEVENTQ_SZ, eventq_fd); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -