> 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:
tracer-ics2023
2024-09-24 23:53:08 +08:00
committed by zzy
parent afb05e386b
commit f274f74dad
4 changed files with 17 additions and 1 deletions

View File

@ -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

View File

@ -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();

View File

@ -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();
}

View File

@ -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);