Vladimir 'phcoder' Serbinenko
ca74c50c0b
merge mainline into hints
2011-12-23 18:46:06 +01:00
Vladimir 'phcoder' Serbinenko
a1a8b1b90a
Support odc, newc and bigendian cpio formats.
...
* Makefile.util.def (libgrubmods): Add odc.c, newc.c and cpio_be.c.
* grub-core/Makefile.core.def (newc): New module.
(odc): Likewise.
(cpio_be): Likewise.
* grub-core/fs/cpio.c (ALIGN_CPIO): New macro.
(MAGIC): Likewise.
(MAGIC2): Likewise.
(head) [MODE_ODC]: Adapt for the format.
(head) [MODE_NEWC]: Likewise.
(head) [!MODE_*]: Write fields of interest as arrays.
(MAGIC_USTAR): Removed.
(read_number) [MODE_NEWC]: Change to hex.
(read_number) [!MODE_*]: Parse binary arrays.
(grub_cpio_find_file): Factor out the code for better structure and
always use read_number.
(grub_cpio_mount): Use MAGIC and MAGIC2.
(grub_cpio_dir): Exit on first hook non-0 return.
(grub_cpio_fs) [MODE_ODC]: Set name to odc.
(grub_cpio_fs) [MODE_NEWC]: Set name to newc.
(GRUB_MOD_INIT) [MODE_ODC]: Set name to odc.
(GRUB_MOD_INIT) [MODE_NEWC]: Set name to newc.
(GRUB_MOD_FINI) [MODE_ODC]: Set name to odc.
(GRUB_MOD_FINI) [MODE_NEWC]: Set name to newc.
* grub-core/fs/newc.c: New file.
* grub-core/fs/odc.c: Likewise.
* grub-core/fs/cpio_be.c: Likewise.
2011-12-23 16:15:18 +01:00
Vladimir 'phcoder' Serbinenko
58eba9eec7
Fix handling of tar numbers occupying the whole field.
...
* grub-core/fs/cpio.c (read_number): New function.
(grub_cpio_find_file): Use read_number instead of strtoull.
2011-12-23 14:11:31 +01:00
Vladimir 'phcoder' Serbinenko
a54a0e1270
* grub-core/fs/cpio.c (grub_cpio_find_file): Fix handling of names
...
occupying the whole field size.
2011-12-23 13:38:21 +01:00
Vladimir 'phcoder' Serbinenko
a93964ce11
* grub-core/net/net.c (grub_cmd_delroute): Add missing out condition.
2011-12-23 11:54:08 +01:00
Seth Goldberg
3ea1ca46c1
* grub-core/Makefile.core.def (lzma_decompress): Add missing
...
TARGET_IMG_LDFLAGS.
2011-12-23 11:39:30 +01:00
Vladimir 'phcoder' Serbinenko
31355584f1
* grub-core/lib/reed_solomon.c (grub_reed_solomon_add_redundancy): Add
...
an assert.
* util/grub-setup.c (setup): Likewise.
2011-12-23 10:23:41 +01:00
Vladimir 'phcoder' Serbinenko
1f0b1a7730
* grub-core/boot/i386/pc/startup_raw.S: Add missing argument for
...
_LzmaDecodeA.
2011-12-23 10:21:27 +01:00
Vladimir 'phcoder' Serbinenko
198e150aaf
IPv6, TCP, HTTP, ICMP and DNS support. Several cleanups and bugfixes.
...
* grub-core/Makefile.core.def (net): Add net/dns.c, net/tcp.c,
net/icmp.c and net/icmp6.c.
(http): New module.
(priority_queue): Likewise.
* grub-core/io/bufio.c: Rewritten.
* grub-core/lib/legacy_parse.c (legacy_command): New argument type
TYPE_WITH_CONFIGFILE_OPTION.
(legacy_commands): Add bootp and dhcp.
(is_option): Handle TYPE_WITH_CONFIGFILE_OPTION.
(grub_legacy_parse): Likewise.
* grub-core/lib/priority_queue.c: New file.
* grub-core/net/arp.c: Add missing license header.
(arp_find_entry): Removed.
(arp_find_entry): Likewise.
(grub_net_arp_resolve): Rename to ...
(grub_net_arp_send_request): ...this.
(grub_net_arp_receive): New card argument.
* grub-core/net/bootp.c (parse_dhcp_vendor): Clean up.
Set router and DNS server.
(grub_net_configure_by_dhcp_ack): Handle routing information.
(grub_cmd_bootp): Set checksum.
(grub_bootp_init): Remove net_dhcp.
* grub-core/net/dns.c: New file.
* grub-core/net/drivers/efi/efinet.c (send_card_buffer): Wait for
completion.
(get_card_packet): Handle allocation.
(grub_efinet_findcards): Set mtu.
* grub-core/net/drivers/emu/emunet.c: Add missing license header.
(get_card_packet): Handle allocation.
(emucard): Set mtu.
* grub-core/net/drivers/i386/pc/pxe.c (grub_pxe_recv): Handle allocation
(GRUB_MOD_INIT): Set mtu.
* grub-core/net/drivers/ieee1275/ofnet.c (grub_ofnetcard_data): Remove
mtu.
(get_card_packet): Handle allocation.
(grub_ofnet_findcards): Set mtu.
* grub-core/net/ethernet.c (send_ethernet_packet): Add compile time
assert.
(grub_net_recv_ethernet_packet): Handle IPv6.
* grub-core/net/http.c: New file.
* grub-core/net/icmp.c: Likewise.
* grub-core/net/icmp6.c: Likewise.
* grub-core/net/ip.c (ip6addr): New type.
(ip6hdr): Likewise.
(reassemble): Likewise.
(cmp): New function.
(reassembles): New variable.
(grub_net_ip_chksum): Handle 0xffff sum and unaligned buffers.
(id): New variable.
(send_fragmented): New function.
(grub_net_send_ip_packet): Rename to ...
(grub_net_send_ip4_packet): ... this. Send fragmented if needed.
Handle non-UDP.
(grub_net_recv_ip_packets): Rename to ...
(handle_dgram): ... this. Check checksum. Handle non-UDP.
(free_rsm): New function.
(free_old_fragments): Likewise.
(grub_net_recv_ip4_packets): New function.
(grub_net_send_ip6_packet): Likewise.
(grub_net_send_ip_packet): Likewise.
(grub_net_recv_ip6_packets): Likewise.
(grub_net_recv_ip_packets): Likewise.
* grub-core/net/net.c (grub_net_link_layer_entry): New struct.
(LINK_LAYER_CACHE_SIZE): New const.
(link_layer_find_entry): New function.
(grub_net_link_layer_add_address): Likewise.
(grub_net_link_layer_resolve_check): Likewise.
(grub_net_link_layer_resolve): Likewise.
(grub_net_ipv6_get_slaac): Likewise.
(grub_net_ipv6_get_link_local): Likewise.
(grub_cmd_ipv6_autoconf): Likewise.
(parse_ip): Handle one number representation.
(parse_ip6): New functoion.
(match_net): Handle IPv6.
(grub_net_resolve_address): Handle IPv6 and DNS.
(grub_net_resolve_net_address): Handle IPv6.
(route_cmp): New function.
(grub_net_route_address): Find best route.
(grub_net_addr_to_str): Handle IPv6.
(grub_net_addr_cmp): New function.
(grub_net_add_addr): Register local route.
(print_net_address): Handle net address.
(grub_net_poll_cards): Retransmit TCP.
(grub_net_poll_cards_idle_real): Likewise.
(have_ahead): New function.
(grub_net_seek_real): Use underlying seek.
(GRUB_MOD_INIT): Register net_ipv6_autoconf and init dns.
* grub-core/net/tcp.c: New file.
* grub-core/net/tftp.c (tftp_data): Add priority_queue.
(cmp): New function.
(ack): Likewise.
(tftp_receive): Handle unordered input.
(destroy_pq): New function.
(tftp_close): Close pq.
* grub-core/net/udp.c: Put missing license header.
(grub_net_udp_socket): New function.
(udp_socket_register): Likewise.
(grub_net_udp_close): Likewise.
(grub_net_recv_udp_packet): Check checksum.
* include/grub/efi/api.h (grub_efi_simple_network): Add status.
* include/grub/misc.h (grub_memchr): New function.
* include/grub/net.h (GRUB_NET_*_SIZE): New enum.
(grub_net_card_driver): Return buf in recv.
(grub_net_slaac_mac_list): New struct.
(grub_network_level_protocol_id): Add ipv6.
(grub_net_network_level_addr): Likewise.
(grub_net_network_level_net_addr): Likewise.
(grub_net_app_protocol): Add seek.
(grub_net_socket): Removed.
(grub_net_sockets): Likewise.
(grub_net_socket_register): Likewise.
(grub_net_socket_unregister): Likewise.
(FOR_NET_SOCKETS): Likewise.
(grub_net_add_addr): Add const.
(GRUB_NET_BOOTP_*): New enum.
(grub_net_addr_cmp): New proto.
(GRUB_NET_MAX_STR_ADDR_LEN): Take IPV6 into account.
(GRUB_NET_MAX_STR_HWADDR_LEN): New define.
(grub_net_hwaddr_to_str): NEw proto.
(FOR_NET_NETWORK_LEVEL_INTERFACES): New macro.
(FOR_NET_NETWORK_LEVEL_INTERFACES_SAFE): Handle NULL.
(grub_dns_init): New proto.
(grub_dns_fini): Likewise.
(grub_net_tcp_retransmit): Likewise.
(grub_net_link_layer_add_address): Likewise.
(grub_net_link_layer_resolve_check): Likewise.
(grub_net_link_layer_resolve): Likewise.
(grub_net_dns_lookup): Likewise.
(grub_net_add_dns_server): Likewise.
(grub_net_remove_dns_server): Likewise.
(GRUB_NET_TRIES): New const.
(GRUB_NET_INTERVAL): Likewise.
* include/grub/net/arp.h: Mostly rewritten.
* include/grub/net/ethernet.h (grub_net_ethertype_t): New enum.
* include/grub/net/ip.h: Mostly rewritten.
* include/grub/net/netbuff.h: Indent.
* include/grub/net/tcp.h: New file.
* include/grub/net/udp.h: Mostly rewritten.
* include/grub/priority_queue.h: New file.
* include/grub/types.h (PRIdGRUB_SSIZE): New define.
(grub_swap_bytes64_compile_time): Likewise.
(grub_cpu_to_be16_compile_time): Likewise.
(grub_cpu_to_be32_compile_time): Likewise.
(grub_cpu_to_be64_compile_time): Likewise.
(grub_be_to_cpu64_compile_time): Likewise.
2011-12-20 18:17:07 +01:00
Vladimir 'phcoder' Serbinenko
ec08f14936
merge mainline into net
2011-12-16 18:00:16 +01:00
Vladimir 'phcoder' Serbinenko
215c18008e
* grub-core/commands/i386/pc/drivemap.c (int13slot): Replace
...
UINT_TO_PTR with cast.
2011-12-16 17:46:28 +01:00
Vladimir 'phcoder' Serbinenko
aa7d205236
Retrieve DNS names from DHCP/BOOTP
2011-12-16 17:37:47 +01:00
Vladimir 'phcoder' Serbinenko
f0f4253cd2
Integrate DNS with address parsing
2011-12-16 17:12:01 +01:00
Vladimir 'phcoder' Serbinenko
8d4e4fc0e5
DNS cache support
2011-12-16 15:08:46 +01:00
Vladimir 'phcoder' Serbinenko
3729fcfc1a
support cname
2011-12-16 13:43:31 +01:00
Vladimir 'phcoder' Serbinenko
34feab6f21
Remerge net branch
2011-12-15 20:53:29 +01:00
Vladimir 'phcoder' Serbinenko
bd67ad0f70
merge mainline into net
2011-12-15 20:51:35 +01:00
Vladimir 'phcoder' Serbinenko
078d2b2e68
Add forgotten file
2011-12-15 20:50:21 +01:00
Vladimir 'phcoder' Serbinenko
e5f4d2607a
* grub-core/lib/libgcrypt/cipher/md4.c (transform) [WORDS_BIGENDIAN]:
...
Add missing const attribute.
* grub-core/lib/libgcrypt/cipher/md5.c (transform) [WORDS_BIGENDIAN]:
Likewise.
* grub-core/lib/libgcrypt/cipher/rmd160.c (transform) [WORDS_BIGENDIAN]:
Likewise.
2011-12-15 20:26:17 +01:00
Vladimir 'phcoder' Serbinenko
8e54b4b76a
* grub-core/lib/libgcrypt/cipher/serpent.c (serpent_key_prepare): Fix
...
misaligned access.
(serpent_setkey): Likewise.
(serpent_encrypt_internal): Likewise.
(serpent_decrypt_internal): Likewise.
(serpent_encrypt): Don't put an alignment-increasing cast.
(serpent_decrypt): Likewise.
(serpent_test): Likewise.
2011-12-15 20:20:02 +01:00
Vladimir 'phcoder' Serbinenko
813c0a2be8
* grub-core/loader/multiboot.c (grub_cmd_module): Fix target address.
2011-12-15 20:05:27 +01:00
Vladimir 'phcoder' Serbinenko
3a38c67235
forgotten file for previous commit
2011-12-15 20:04:21 +01:00
Vladimir 'phcoder' Serbinenko
f2b60fbdb8
Replace UINT_TO_PTR and PTR_TO_UINT with explicit grub_addr_t casts.
...
* include/grub/types.h (UINT_TO_PTR): Removed. All users switched to
grub_addr_t casts.
(PTR_TO_UINT64): Likewise.
(PTR_TO_UINT32): Likewise.
2011-12-15 19:59:49 +01:00
Vladimir 'phcoder' Serbinenko
c476e6df16
* grub-core/gfxmenu/gui_label.c (label_paint): Handle the case
...
text_width > available width a bit more gracefully.
2011-12-15 19:35:54 +01:00
Vladimir 'phcoder' Serbinenko
384ad7cc1b
* grub-core/loader/i386/bsdXX.c (grub_freebsd_load_elfmodule): Fix
...
current address calculation.
2011-12-15 19:32:41 +01:00
Vladimir 'phcoder' Serbinenko
96f8caf812
* grub-core/lib/reed_solomon.c (decode_block): Allocate on heap and not
...
stack.
(encode_block): Likewise.
2011-12-15 19:27:01 +01:00
Vladimir 'phcoder' Serbinenko
276b7a8bdd
* grub-core/boot/i386/pc/startup_raw.S: Clear direction flag for
...
certainety.
2011-12-15 19:22:36 +01:00
Vladimir 'phcoder' Serbinenko
e3fd394a10
* grub-core/boot/i386/pc/startup_raw.S: Move realmode routines to
...
non-RS part to avoid RS messing with GDT.
* include/grub/offsets.h (GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART):
Increase to suit in realmode routines.
2011-12-15 19:20:41 +01:00
Vladimir 'phcoder' Serbinenko
b81d609e4c
* grub-core/kern/i386/realmode.S: Increase alignment.
...
* grub-core/boot/i386/pc/startup_raw.S: Likewise.
2011-12-15 19:17:36 +01:00
Vladimir 'phcoder' Serbinenko
ee9c2e7a97
* grub-core/lib/reed_solomon.c (init_powx): Set gf_powx_inv[0] just to
...
be deterministic.
(syndroms): Compute 0 syndrom.
(rs_recover): Use 0 syndrom.
2011-12-15 02:20:21 +01:00
Vladimir 'phcoder' Serbinenko
ca1b552c02
* grub-core/gfxmenu/widget-box.c (get_left_pad): Take corners into
...
account.
(get_top_pad): Likewise.
(get_right_pad): Likewise.
(get_bottom_pad): Likewise.
2011-12-14 14:20:57 +01:00
Vladimir 'phcoder' Serbinenko
9f59e9fc36
* grub-core/gfxmenu/gui_list.c (draw_menu): Don't use set in if.
2011-12-14 12:05:26 +01:00
Vladimir 'phcoder' Serbinenko
cb8f88ea82
* include/grub/charset.h (grub_utf16_to_utf8): Make src a const pointer.
...
(grub_ucs4_to_utf8_alloc): Likewise.
(grub_ucs4_to_utf8): Likewise.
* grub-core/normal/charset.c (grub_ucs4_to_utf8): Likewise.
(grub_ucs4_to_utf8_alloc): Likewise.
2011-12-14 10:01:24 +01:00
Vladimir 'phcoder' Serbinenko
309e535231
AFFS never uses unicode.
...
* include/grub/charset.h (GRUB_MAX_UTF8_PER_LATIN1): New const.
(grub_latin1_to_utf8): New inline function.
* grub-core/fs/affs.c (grub_affs_iterate_dir): Convert latin1 to UTF8.
2011-12-14 09:52:00 +01:00
Vladimir 'phcoder' Serbinenko
e7987e1b3b
* grub-core/fs/romfs.c (grub_romfs_mount): Fix pointer comparison
...
overflow.
2011-12-13 23:15:56 +01:00
Vladimir 'phcoder' Serbinenko
efc2616ee1
* grub-core/fs/squash4.c (grub_squash_inode): Fix field sizes.
...
(grub_squash_dirent_header): Likewise.
(read_chunk): Don't double swap.
(grub_squash_iterate_dir): Fix swap sizes.
2011-12-13 23:14:25 +01:00
Vladimir 'phcoder' Serbinenko
3c349f5a37
* grub-core/fs/jfs.c (grub_jfs_getent): Handle UTF16 endianness.
2011-12-13 23:11:48 +01:00
Vladimir 'phcoder' Serbinenko
b453412d2f
* grub-core/fs/hfs.c (grub_hfs_find_node): Handle unaligned keys.
...
(grub_hfs_iterate_dir): Likewise.
2011-12-13 23:10:38 +01:00
Vladimir 'phcoder' Serbinenko
12e9d4d152
Fix video on platforms where unaligned access is forbidden.
...
Make several optimisations while on it.
* grub-core/video/fb/fbblit.c (grub_video_fbblit_replace_directN):
Optimise and use GRUB_VIDEO_FB_ADVANCE_POINTER.
(grub_video_fbblit_replace_32bit_1bit): Likewise.
(grub_video_fbblit_replace_24bit_1bit) [!GRUB_HAVE_UNALIGNED_ACCESS]:
Disable.
(grub_video_fbblit_replace_16bit_1bit):
Optimise and use GRUB_VIDEO_FB_ADVANCE_POINTER.
(grub_video_fbblit_replace_8bit_1bit): Likewise.
(grub_video_fbblit_replace_BGRX8888_RGBX8888): Likewise.
(grub_video_fbblit_replace_BGRX8888_RGB888): Likewise.
(grub_video_fbblit_replace_BGR888_RGBX8888): Likewise.
(grub_video_fbblit_replace_BGR888_RGBX8888): Likewise.
(grub_video_fbblit_replace_BGR888_RGB888): Likewise.
(grub_video_fbblit_replace_RGBX8888_RGB88): Likewise.
(grub_video_fbblit_replace_RGB888_RGBX888): Likewise.
(grub_video_fbblit_replace_RGB888_RGBX8888): Likewise.
(grub_video_fbblit_replace_index_RGBX8888): Likewise.
(grub_video_fbblit_replace_index_RGB888): Likewise.
(grub_video_fbblit_blend_BGRA8888_RGBA8888): Likewise.
(grub_video_fbblit_blend_BGR888_RGBA8888): Likewise.
(grub_video_fbblit_blend_RGBA8888_RGBA8888): Likewise.
(grub_video_fbblit_blend_RGB888_RGBA8888): Likewise.
(grub_video_fbblit_blend_index_RGBA8888): Likewise.
(grub_video_fbblit_blend_XXXA8888_1bit): Likewise.
(grub_video_fbblit_blend_XXX888_1bit) [!GRUB_HAVE_UNALIGNED_ACCESS]:
Disable.
(grub_video_fbblit_blend_XXX565_1bit):
Optimise and use GRUB_VIDEO_FB_ADVANCE_POINTER.
* grub-core/video/fb/fbfill.c (grub_video_fbfill_direct32): Likewise.
* grub-core/video/fb/fbutil.c (grub_video_fb_get_video_ptr): Return
void *.
* grub-core/video/fb/video_fb.c (common_blitter)
[!GRUB_HAVE_UNALIGNED_ACCESS]: Skip disabled blitters.
(grub_video_fb_create_render_target_from_pointer)
[!GRUB_HAVE_UNALIGNED_ACCESS]: Check alignment.
* include/grub/fbutil.h (grub_video_fb_get_video_ptr): Return void *.
* include/grub/i386/types.h (GRUB_HAVE_UNALIGNED_ACCESS): New
definition.
* include/grub/x86_64/types.h (GRUB_HAVE_UNALIGNED_ACCESS): Likewise.
2011-12-13 20:07:33 +01:00
Vladimir 'phcoder' Serbinenko
ace96609b6
* grub-core/kern/sparc64/dl.c (grub_arch_dl_relocate_symbols): Support
...
HH22 and HM10 relocations.
2011-12-13 19:56:50 +01:00
Vladimir 'phcoder' Serbinenko
fd261d7300
* grub-core/kern/misc.c (grub_vsnprintf_real): Fix fmt2 parsing.
2011-12-13 19:55:27 +01:00
Vladimir 'phcoder' Serbinenko
e59b7857f8
* grub-core/commands/videotest.c (grub_cmd_videotest): Check that
...
allocation succeeded.
2011-12-13 19:53:57 +01:00
Vladimir 'phcoder' Serbinenko
9b4baaa4ee
* grub-core/fs/iso9660.c (grub_iso9660_convert_string): Make first
...
argument a u8 pointer. All users updated.
Handle unaligned buffers.
2011-12-13 16:35:12 +01:00
Vladimir 'phcoder' Serbinenko
dc71319397
* grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Force inlining of
...
add_part to workaround compiler bug.
2011-12-13 16:33:27 +01:00
Vladimir 'phcoder' Serbinenko
0c6087a8c9
* grub-core/loader/multiboot_mbi2.c (grub_multiboot_add_elfsyms):
...
Reserve alignment invariants.
(grub_multiboot_load): Likewise.
(retrieve_video_parameters): Likewise.
(grub_multiboot_make_mbi): Likewise.
2011-12-13 16:22:44 +01:00
Vladimir 'phcoder' Serbinenko
c2e777777b
* grub-core/loader/i386/xnu.c (grub_xnu_devprop_remove_property): Fix
...
incorrect pointer.
2011-12-13 16:20:25 +01:00
Vladimir 'phcoder' Serbinenko
b70b6d1107
* grub-core/disk/pata.c (grub_pata_pio_read): Handle unaligned buffer.
...
(grub_pata_pio_write): Likewise.
2011-12-13 15:55:36 +01:00
Vladimir 'phcoder' Serbinenko
02a2bf8384
Add noreturn attributes and remove unreachable code.
...
* grub-core/bus/cs5536.c (grub_cs5536_smbus_wait): Remove unreachable
code.
* grub-core/commands/halt.c (grub_cmd_halt): Remove unreachable
code. Mark as noreturn.
* grub-core/commands/minicmd.c (grub_mini_cmd_exit): Likewise.
* grub-core/commands/reboot.c (grub_cmd_reboot): Likewise.
* grub-core/disk/efi/efidisk.c (grub_efidisk_get_device_name): Remove
unreachable code.
* grub-core/kern/main.c (grub_main): Mark as noreturn.
* grub-core/kern/rescue_reader.c (grub_rescue_run): Likewise.
* grub-core/lib/posix_wrap/stdlib.h (abort): Likewise.
* grub-core/normal/menu.c (run_menu): Remove unreachable code.
* include/grub/kernel.h (grub_main): Mark as noreturn.
* include/grub/reader.h (grub_rescue_run): Likewise.
2011-12-13 15:13:51 +01:00
Vladimir 'phcoder' Serbinenko
6166442083
* grub-core/commands/hdparm.c (le16_to_char): Make src and dest uint16 *
...
to ensure alignment.
(grub_hdparm_print_identify): Make argument uint16 * to ensure
alignment. Ensure tmp alignment.
(grub_cmd_hdparm): Ensure buf alignment.
* grub-core/disk/ata.c (grub_ata_strncpy): Make src and dest uint16 *
to ensure alignment.
(grub_ata_dumpinfo): Ensure text alignment.
(grub_atapi_identify): Preserve alignment invariant.
(grub_ata_identify): Likewise. Use grub_get_unaligned32 when necessary.
2011-12-13 14:57:46 +01:00
Vladimir 'phcoder' Serbinenko
85c85365bb
* grub-core/partmap/dvh.c (grub_dvh_is_valid): Make argument
...
uint32_t * to ensure alignment.
(dvh_partition_map_iterate): Make `block' a union to ensure alignment.
2011-12-13 14:44:38 +01:00