> compile NEMU
221220000 张三 Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux 23:53:05 up 7 days, 8:50, 1 user, load average: 0.77, 0.88, 0.74
This commit is contained in:
@ -8,4 +8,6 @@ size_t events_read(void *buf, size_t offset, size_t len);
|
||||
size_t dispinfo_read(void *buf, size_t offset, size_t len);
|
||||
size_t fb_write(const void *buf, size_t offset, size_t len);
|
||||
|
||||
int _fb_size();
|
||||
|
||||
#endif
|
@ -41,6 +41,11 @@ size_t fb_write(const void *buf, size_t offset, size_t len) {
|
||||
return len;
|
||||
}
|
||||
|
||||
int _fb_size() {
|
||||
AM_GPU_CONFIG_T gconf = io_read(AM_GPU_CONFIG);
|
||||
return gconf.vmemsz;
|
||||
}
|
||||
|
||||
void init_device() {
|
||||
Log("Initializing devices...");
|
||||
ioe_init();
|
||||
|
@ -109,4 +109,5 @@ int fs_close(int fd) {
|
||||
|
||||
void init_fs() {
|
||||
// TODO: initialize the size of /dev/fb
|
||||
file_table[FD_DEV_FB].size = _fb_size();
|
||||
}
|
||||
|
@ -51,7 +51,15 @@ void NDL_OpenCanvas(int *w, int *h) {
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int dev_w, dev_h;
|
||||
int dev_w, dev_h, num;
|
||||
char buf[32];
|
||||
while (fgets(buf, sizeof(buf), fp)) {
|
||||
printf("displayinfo %s\n", buf);
|
||||
sscanf(buf, "%[^:]:%d", buf, &num);
|
||||
if (strcmp(buf, "WIDTH") == 0) dev_w = num;
|
||||
if (strcmp(buf, "HEIGHT") == 0) dev_h = num;
|
||||
}
|
||||
fgets(buf, sizeof(buf), fp);
|
||||
if (fscanf(fp, "WIDTH %*c %d\nHEIGHT %*c %d", &dev_w, &dev_h) != 2) {
|
||||
printf("cannot parse dispinfo");
|
||||
exit(-1);
|
||||
|
Reference in New Issue
Block a user