Revision 44654490 hw/sm501.c

b/hw/sm501.c
455 455
    target_phys_addr_t base;
456 456
    uint32_t local_mem_size_index;
457 457
    uint8_t * local_mem;
458
    ram_addr_t local_mem_offset;
458 459
    uint32_t last_width;
459 460
    uint32_t last_height;
460 461

  
......
972 973
    int y_start = -1;
973 974
    int page_min = 0x7fffffff;
974 975
    int page_max = -1;
976
    ram_addr_t offset = s->local_mem_offset;
975 977

  
976 978
    /* choose draw_line function */
977 979
    switch (s->dc_crt_control & 3) {
......
1005 1007
    /* draw each line according to conditions */
1006 1008
    for (y = 0; y < height; y++) {
1007 1009
	int update = full_update;
1008
	uint8_t * line_end = &src[width * src_bpp - 1];
1009
	int page0 = (src - phys_ram_base) & TARGET_PAGE_MASK;
1010
	int page1 = (line_end - phys_ram_base) & TARGET_PAGE_MASK;
1011
	int page;
1010
	ram_addr_t page0 = offset & TARGET_PAGE_MASK;
1011
	ram_addr_t page1 = (offset + width * src_bpp - 1) & TARGET_PAGE_MASK;
1012
	ram_addr_t page;
1012 1013

  
1013 1014
	/* check dirty flags for each line */
1014 1015
	for (page = page0; page <= page1; page += TARGET_PAGE_SIZE)
......
1033 1034
	}
1034 1035

  
1035 1036
	src += width * src_bpp;
1037
	offset += width * src_bpp;
1036 1038
    }
1037 1039

  
1038 1040
    /* complete flush to display */
......
1053 1055
	sm501_draw_crt(s);
1054 1056
}
1055 1057

  
1056
void sm501_init(uint32_t base, unsigned long local_mem_base,
1057
		uint32_t local_mem_bytes, CharDriverState *chr)
1058
void sm501_init(uint32_t base, uint32_t local_mem_bytes, CharDriverState *chr)
1058 1059
{
1059 1060
    SM501State * s;
1060 1061
    int sm501_system_config_index;
......
1073 1074
    s->dc_crt_control = 0x00010000;
1074 1075

  
1075 1076
    /* allocate local memory */
1076
    s->local_mem = (uint8 *)phys_ram_base + local_mem_base;
1077
    cpu_register_physical_memory(base, local_mem_bytes, local_mem_base);
1077
    s->local_mem_offset = qemu_ram_alloc(local_mem_bytes);
1078
    s->local_mem = qemu_get_ram_ptr(s->local_mem_offset);
1079
    cpu_register_physical_memory(base, local_mem_bytes, s->local_mem_offset);
1078 1080

  
1079 1081
    /* map mmio */
1080 1082
    sm501_system_config_index

Also available in: Unified diff